Use dependency groups (#94)

* Use dependency groups

* Ensure dev env contains pytest

* Doesn't work

* Use dep group in dev env

* update ruff
This commit is contained in:
Hynek Schlawack 2025-07-30 09:30:51 +02:00 committed by GitHub
parent 41aecc1974
commit cc7181e7de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 18 additions and 21 deletions

View File

@ -69,14 +69,14 @@ $ git submodule update # update the vendored Argon2 C library to the version w
Now an editable version of *argon2-cffi-bindings* along with its test requirements can be installed as usual:
```console
$ python -Im pip install --upgrade pip setuptools cffi # PLEASE don't skip this step
$ python -Im pip install -e '.[dev]'
$ python -Im pip install --upgrade pip # PLEASE don't skip this step
$ python -Im pip install -e . --group dev
```
At this point,
```console
$ python -m pytest
$ python -Im pytest
```
should work and pass.
@ -99,8 +99,8 @@ You can also run them anytime (as our tox does) using:
$ pre-commit run --all-files
```
[^dev]: *pre-commit* should have been installed into your virtualenv automatically when you ran `pip install -e '.[dev]'` above.
If *pre-commit* is missing, your probably need to run `pip install -e '.[dev]'` again.
[^dev]: *pre-commit* should have been installed into your virtualenv automatically when you ran `python -Im pip install -e . --group dev` above.
If *pre-commit* is missing, your probably need to run `python -Im pip install -e . --group dev` again.
## Code

View File

@ -120,7 +120,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version-file: .python-version-default
- run: python -Im pip install -e .[dev]
- run: python -Im pip install -e . --group dev
- name: Import package
run: python -c 'from _argon2_cffi_bindings import ffi, lib; print(lib.ARGON2_VERSION_NUMBER)'
@ -129,6 +129,9 @@ jobs:
- run: ldd src/_argon2_cffi_bindings/_ffi.abi3.so
if: startsWith(matrix.os , 'ubuntu')
- name: Check presence of pytest
run: pytest --version
cog-check:
name: Ensure cogified files are up-to-date
runs-on: ubuntu-latest

View File

@ -4,7 +4,7 @@ ci:
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.2
rev: v0.12.7
hooks:
- id: ruff-check
args: [--fix, --exit-non-zero-on-fix]

View File

@ -44,14 +44,15 @@ dependencies = [
"cffi>=2.0.0b1; python_version >= '3.14'",
]
[project.optional-dependencies]
[dependency-groups]
tests = ["pytest"]
dev = ["argon2-cffi-bindings[tests]", "cogapp", "pre-commit", "wheel"]
dev = [{ include-group = "tests" }, "cogapp", "pre-commit"]
[project.urls]
Tidelift = "https://tidelift.com/?utm_source=lifter&utm_medium=referral&utm_campaign=hynek"
Changelog = "https://github.com/hynek/argon2-cffi-bindings/blob/main/CHANGELOG.md"
GitHub= "https://github.com/hynek/argon2-cffi-bindings"
GitHub = "https://github.com/hynek/argon2-cffi-bindings"
Funding = "https://github.com/sponsors/hynek"
@ -65,8 +66,8 @@ local_scheme = "no-local-version"
[tool.cibuildwheel]
build = [
"cp39-*" , # We have portable abi3 wheels.
build = [
"cp39-*", # We have portable abi3 wheels.
"cp314t-*", # Free-threading / nogil.
"pp310-*", # PyPy 3.9 is EOL and doesn't build on Windows anymore.
]

11
tox.ini
View File

@ -1,10 +1,3 @@
[flake8]
exclude = src/_argon2_cffi_bindings/_ffi.py
ignore =
# Black vs flake8 conflict
E203
[tox]
min_version = 4
env_list =
@ -38,14 +31,14 @@ commands = cog --check -P README.md CHANGELOG.md
[testenv]
description = Run tests.
extras = tests
dependency_groups = tests
commands = pytest {posargs}
[testenv:system-argon2]
description = Run tests against bindings that use a system installation of Argon2.
set_env = ARGON2_CFFI_USE_SYSTEM=1
extras = tests
dependency_groups = tests
install_command = pip install {opts} --no-binary=argon2-cffi-bindings {packages}