diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e0a8c79..70c85a0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,13 +10,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Release - uses: patrick-kidger/action_update_python_project@v7 + uses: patrick-kidger/action_update_python_project@v8 with: python-version: "3.11" test-script: | cp -r ${{ github.workspace }}/tests ./tests cp ${{ github.workspace }}/pyproject.toml ./pyproject.toml - uv sync --extra dev --no-install-project --inexact + uv sync --extra tests --no-install-project --inexact uv run --no-sync pytest pypi-token: ${{ secrets.pypi_token }} github-user: patrick-kidger diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 318f30a..9d44003 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -7,7 +7,7 @@ jobs: run-test: strategy: matrix: - python-version: [ "3.11" ] + python-version: [ "3.11", "3.13" ] os: [ ubuntu-latest ] fail-fast: false runs-on: ${{ matrix.os }} @@ -23,11 +23,12 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install '.[dev]' + python -m pip install '.[dev,tests]' - name: Checks with pre-commit - uses: pre-commit/action@v3.0.1 + run: | + pre-commit run --all-files - name: Test with pytest run: | - python -m pytest + pytest diff --git a/.gitignore b/.gitignore index 24c78af..080be7a 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ examples/multipart_serialised.eqx .python-version .DS_Store .venv +uv.lock diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 37a665f..34bc32d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ repos: files: ^pyproject\.toml$ additional_dependencies: ["toml-sort==0.23.1"] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.4 + rev: v0.13.0 hooks: - id: ruff-format # formatter types_or: [python, pyi, jupyter, toml] @@ -16,7 +16,8 @@ repos: types_or: [python, pyi, jupyter, toml] args: [--fix] - repo: https://github.com/RobertCraigie/pyright-python - rev: v1.1.379 + rev: v1.1.405 hooks: - id: pyright - additional_dependencies: [numpy, pytest] + additional_dependencies: + [pytest] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..9398d7d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,40 @@ +# Contributing + +Contributions (pull requests) are very welcome! Here's how to get started. + +--- + +**Getting started** + +First fork the library on GitHub. + +Then clone and install the library: + +```bash +git clone https://github.com/your-username-here/tinyio.git +cd tinyio +pip install -e '.[dev]' +pre-commit install # `pre-commit` is installed by `pip` on the previous line +``` + +--- + +**If you're making changes to the code:** + +Now make your changes. Make sure to include additional tests if necessary. + +Next verify the tests all pass: + +```bash +pip install -e '.[tests]' +pytest # `pytest` is installed by `pip` on the previous line. +``` + +Then push your changes back to your fork of the repository: + +```bash +git push +``` + +Finally, open a pull request on GitHub! + diff --git a/pyproject.toml b/pyproject.toml index 60db1cb..e238a4e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,10 +23,14 @@ urls = {repository = "https://github.com/patrick-kidger/tinyio"} version = "0.2.0" [project.optional-dependencies] -dev = ["pre-commit", "pytest"] +dev = ["pre-commit"] +tests = ["pytest"] [tool.hatch.build] include = ["tinyio/*"] +reportFunctionMemberAccess = false +reportIncompatibleMethodOverride = true +reportIncompatibleVariableOverride = false [tool.pyright] include = ["tinyio", "tests"] @@ -48,5 +52,6 @@ select = ["E", "F", "I001", "UP"] [tool.ruff.lint.isort] combine-as-imports = true +extra-standard-library = ["typing_extensions"] lines-after-imports = 2 order-by-type = true diff --git a/tinyio/_core.py b/tinyio/_core.py index 0d10a87..b08ac6e 100644 --- a/tinyio/_core.py +++ b/tinyio/_core.py @@ -167,7 +167,7 @@ def _step( for out_i in out: if isinstance(out_i, Generator): if out_i not in self._results.keys() and out_i not in waiting_on.keys(): - if out_i.gi_frame is None: + if out_i.gi_frame is None: # pyright: ignore[reportAttributeAccessIssue] todo.coro.throw(_already_finished(out_i)) queue.appendleft(_Todo(out_i, None)) waiting_on[out_i] = [] @@ -184,7 +184,7 @@ def _step( elif out_i in waiting_on.keys(): waiting_on[out_i].append(waiting_for) else: - if out_i.gi_frame is None: + if out_i.gi_frame is None: # pyright: ignore[reportAttributeAccessIssue] todo.coro.throw(_already_finished(out_i)) queue.appendleft(_Todo(out_i, None)) waiting_on[out_i] = [waiting_for]