improvements to project files

This commit is contained in:
Jakob Pinterits
2025-01-19 12:52:33 +01:00
parent 5ea37cf476
commit 1ed819ae6d
6 changed files with 45 additions and 40 deletions
-1
View File
@@ -8,7 +8,6 @@ build/
wheels/
*.egg-info
/.venv
/.python-version
/requirements.lock
/requirements-dev.lock
+1
View File
@@ -0,0 +1 @@
3.10.13
+27 -23
View File
@@ -39,23 +39,23 @@ changes, or close it.
### Prerequisites
- You have [Python](https://www.python.org/) at `version 3.10 or higher`
- You have [Python](https://www.python.org/) at `version 3.10 or higher`
installed.
- You have [Rye](https://rye.astral.sh/) at `version 0.33.0 or higher`
- You have [Rye](https://rye.astral.sh/) at `version 0.33.0 or higher`
installed.
- You have [Node.js](https://nodejs.org/) at `version 20.0 or higher` installed.
- You are familiar with [Git](https://git-scm.com/).
- You have [Node.js](https://nodejs.org/) at `version 20.0 or higher` installed.
- You are familiar with [Git](https://git-scm.com/).
### Project structure
- `frontend/` - TypeScript code for the Rio frontend
- `raw-icons` - In addition to the official material icons, Rio ships with some
- `frontend/` - TypeScript code for the Rio frontend
- `raw-icons` - In addition to the official material icons, Rio ships with some
of its own. This directory contains any and all custom icons.
- `rio/` - Python code for the Rio backend
- `scripts/` - Contains scripts which are tangentially related to Rio, but not
- `rio/` - Python code for the Rio backend
- `scripts/` - Contains scripts which are tangentially related to Rio, but not
used during runtime. For example, you can find benchmarking and publishing
scripts here
- `tests/` - Contains tests for Rio
- `tests/` - Contains tests for Rio
### Development Setup
@@ -85,9 +85,13 @@ cd rio
Use rye to install all Python dependencies:
```bash
rye sync
rye sync --all-features
```
(`--all-features` will install everything necessary for local apps to work in
addition to websites. Since some of this functionality is tested in the test
suite, tests would fail without installing these dependencies.)
Make sure the pre-commit hooks are installed. These will run some basic checks
before creating commits:
@@ -122,10 +126,10 @@ of things. The only thing worse than a bad solution is two good ones.
To avoid this, we've decided on a few conventions used throughout Rio:
- Event handlers are always written in present tense: `on_change`, `on_move`,
- Event handlers are always written in present tense: `on_change`, `on_move`,
etc., NOT past tense (`on_changed`, `on_moved`).
- Whenever a value has physical units attached, prefer to use SI base units. For
- Whenever a value has physical units attached, prefer to use SI base units. For
example, measure time in seconds, not milliseconds.
Occasionally it can make sense to break this rule. For example, when
@@ -139,17 +143,17 @@ To avoid this, we've decided on a few conventions used throughout Rio:
preferable to all of the above. This way times can be expressed in any unit
the user prefers.
- Avoid negatives. For example, use `is_visible` instead of `is_hidden`. Nobody
- Avoid negatives. For example, use `is_visible` instead of `is_hidden`. Nobody
likes to think around corners. Here's some more examples
- `is_visible` instead of `is_hidden`
- `is_sensitive` instead of `is_insensitive`
- `is_active` instead of `is_disabled`
- `is_visible` instead of `is_hidden`
- `is_sensitive` instead of `is_insensitive`
- `is_active` instead of `is_disabled`
Along the same lines, **absolutely avoid double negatives**. Never, ever, ever
use names like `is_not_hidden` or `dont_hide_something`.
- Python code follows Python naming conventions, such as all_lower_case for
- Python code follows Python naming conventions, such as all_lower_case for
variables and functions, and CamelCase for classes.
JavaScript, TypeScript & JSON follow JavaScript naming conventions, such as
@@ -157,7 +161,7 @@ To avoid this, we've decided on a few conventions used throughout Rio:
Files use all_lower_case.
- When naming a dictionary after its contents, name it `keys_to_values`, rather
- When naming a dictionary after its contents, name it `keys_to_values`, rather
than e.g. `values_by_key`. For example, `ids_to_instances` or `names_to_id`.
It is of course also perfectly fine to use a different name if it makes more
sense in your particular context.
@@ -172,8 +176,8 @@ Before submitting an issue, please check the existing issues to see if your
issue has already been reported. If it has, please add a comment to the existing
issue instead of creating a new one.
- You are experiencing a technical issue with Rio.
- Your issue title is concise, on-topic, and polite.
- You provide steps to reproduce the issue.
- Make sure the issue template is respected.
- Make sure your issue body is readable and [well formatted](https://docs.github.com/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax).
- You are experiencing a technical issue with Rio.
- Your issue title is concise, on-topic, and polite.
- You provide steps to reproduce the issue.
- Make sure the issue template is respected.
- Make sure your issue body is readable and [well formatted](https://docs.github.com/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax).
+1 -9
View File
@@ -1,11 +1,3 @@
# Security Policy
## Supported Versions
| Version | Supported |
| ---------- | ------------------ |
| >= 0.5 | :white_check_mark: |
## Reporting a Vulnerability
Please report any security vulnerabilities to rio.labs@outlook.com
Please report any security vulnerabilities to <rio.labs@outlook.com>
+1 -1
View File
@@ -92,7 +92,7 @@ build-backend = "hatchling.build"
[tool.rye]
dev-dependencies = [
"aiofiles~=23.2",
"aiofiles~=24.1",
"alt-pytest-asyncio~=0.7.2",
"coverage~=7.2",
"matplotlib~=3.8",
+15 -6
View File
@@ -1,4 +1,6 @@
import aiofiles
from __future__ import annotations
import typing_extensions as te
from pytest import MonkeyPatch
from uniserde import JsonDoc
@@ -6,13 +8,13 @@ import rio.testing
class FakeFile:
def __init__(self, content: str):
def __init__(self, content: str) -> None:
self._content = content
async def __aenter__(self):
async def __aenter__(self) -> te.Self:
return self
async def __aexit__(self, *args):
async def __aexit__(self, *args) -> None:
pass
async def read(self) -> str:
@@ -29,7 +31,7 @@ class FooSettings(rio.UserSettings):
bar: str = "bar"
async def test_load_settings():
async def test_load_settings() -> None:
user_settings: JsonDoc = {
":foo": "bar",
"foo:bar": "baz",
@@ -47,7 +49,14 @@ async def test_load_settings():
assert foo_settings.bar == "baz"
async def test_load_settings_file(monkeypatch: MonkeyPatch):
async def test_load_settings_file(monkeypatch: MonkeyPatch) -> None:
try:
import aiofiles
except ImportError:
raise RuntimeError(
"This test requires the window extra to run, specifically `aiofiles`."
)
monkeypatch.setattr(
aiofiles,
"open",