Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert project & packaging config to uv #589

Merged
merged 5 commits into from
Jan 18, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use uv to install test dependencies into nox venvs
JWCook committed Jan 18, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit b7242d5693387dd2416caf901c81df9910ac7bdb
10 changes: 6 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -20,8 +20,10 @@ Here are some general guidelines for submitting a pull request:
- Submit the PR to be merged into the `main` branch.

### Tests
We use the [pytest](https://docs.pytest.org/en/latest/) framework for unit testing.
Just run the `pytest` command to run locally.
To run all tests and linting:
```sh
uv run nox
```

#### Testing supported python versions
For PRs, GitHub Actions will run these tests for each supported python version.
@@ -43,7 +45,7 @@ For PRs, please include docstrings for all functions and classes.

To build the docs locally:
```bash
$ nox -e docs
$ uv run nox -e docs
```

To preview:
@@ -56,7 +58,7 @@ $ xdg-open docs/_build/html/index.html

You can also use [sphinx-autobuild](https://github.com/executablebooks/sphinx-autobuild) to rebuild the docs and live reload in the browser whenever doc contents change:
```bash
$ nox -e livedocs
$ uv run nox -e livedocs
```

Project documentation is generated using [Sphinx](https://www.sphinx-doc.org),
15 changes: 13 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -27,11 +27,22 @@
]


@nox.session(python=['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'])
def install_deps(session):
"""Install project and test dependencies using uv"""
session.env['UV_PROJECT_ENVIRONMENT'] = session.virtualenv.location
session.run_install(
'uv',
'sync',
'--frozen',
'--all-extras',
)


@nox.session(python=['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'], venv_backend='uv')
def test(session):
"""Run tests for a specific python version"""
test_paths = session.posargs or ['test']
session.install('.', 'filelock', 'pytest', 'pytest-sugar', 'pytest-xdist', 'requests-mock')
install_deps(session)
session.run('pytest', '-n', 'auto', *test_paths)


1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -125,6 +125,7 @@ files = ['pyinaturalist']
markers = [
'enable_client_session: Enable all ClientSession features: caching, rate-limiting, etc.',
]
asyncio_default_fixture_loop_scope = 'module'

[tool.ruff]
fix = true