Skip to content

Commit 298af7e

Browse files
authored
Switch to dependency groups (#202)
1 parent 2eedf07 commit 298af7e

File tree

4 files changed

+29
-38
lines changed

4 files changed

+29
-38
lines changed

.github/CONTRIBUTING.md

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,14 @@ But don't be afraid to open half-finished PRs and ask questions if something is
2525
- Don’t break backwards-compatibility.
2626

2727

28-
## Local Development Environment
28+
## Local development environment
2929

30-
You can (and should) run our test suite using [*tox*].
31-
However, you’ll probably want a more traditional environment as well.
30+
First, **fork** the repository on GitHub and **clone** it using one of the alternatives that you can copy-paste by pressing the big green button labeled `<> Code`.
3231

33-
First, create a [virtual environment](https://virtualenv.pypa.io/) so you don't break your system-wide Python installation.
34-
We recommend using the Python version from the `.python-version-default` file in project's root directory.
32+
You can (and should) run our test suite using [*tox*](https://tox.wiki/).
33+
However, you'll probably want a more traditional environment as well.
3534

36-
If you're using tools that understand `.python-version` files like [*pyenv*](https://github.com/pyenv/pyenv) does, you can make it a link to the `.python-version-default` file (`ln -s .python-version-default .python-version`).
35+
We recommend using the Python version from the `.python-version-default` file in the project's root directory, because that's the one that is used in the CI by default, too.
3736

3837
If you're using [*direnv*](https://direnv.net), you can automate the creation of the project virtual environment with the correct Python version by adding the following `.envrc` to the project root:
3938

@@ -48,37 +47,25 @@ test -d .venv || uv venv --python python$(cat .python-version-default)
4847
. .venv/bin/activate
4948
```
5049

51-
---
52-
53-
Next, fork the repository on GitHub and get an up-to-date checkout:
54-
55-
```console
56-
$ git clone [email protected]:<your-username>/argon2-cffi.git
57-
```
50+
> [!WARNING]
51+
> - **Before** you start working on a new pull request, use the "*Sync fork*" button in GitHub's web UI to ensure your fork is up to date.
52+
> - **Always create a new branch off `main` for each new pull request.**
53+
> Yes, you can work on `main` in your fork and submit pull requests.
54+
> But this will *inevitably* lead to you not being able to synchronize your fork with upstream and having to start over.
5855
59-
or if you prefer to use *Git* via `https`:
56+
Change into the newly created directory and after activating a virtual environment, install an editable version of this project along with its tests requirements:
6057

6158
```console
62-
$ git clone https://github.com/<your-username>/argon2-cffi.git
59+
$ pip install -e . --group dev # or `uv pip install -e . --group dev`
6360
```
6461

65-
Change into the newly created directory and **after activating your virtual environment** install an editable version of *argon2-cffi* along with its tests and docs requirements:
62+
Now you can run the test suite:
6663

6764
```console
68-
$ cd argon2-cffi
69-
$ python -m pip install --upgrade pip wheel # PLEASE don't skip this step
70-
$ python -m pip install -e '.[dev]'
65+
$ python -Im pytest
7166
```
7267

73-
At this point,
74-
75-
```console
76-
$ python -m pytest
77-
```
78-
79-
should work and pass.
80-
81-
For documentation, you can use:
68+
When working on the documentation, use:
8269

8370
```console
8471
$ tox run -e docs-watch

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ jobs:
195195

196196
- run: |
197197
uv venv
198-
uv pip install .[typing]
198+
uv pip install . --group typing
199199
echo "$PWD/.venv/bin" >> $GITHUB_PATH
200200
- uses: jakebailey/pyright-action@v2
201201

@@ -235,7 +235,7 @@ jobs:
235235

236236
- name: Install in dev mode and run CLI
237237
run: |
238-
python -Im pip install -e .[dev]
238+
python -Im pip install -e . --group dev
239239
python -Im argon2 -n 1 -t 1 -m 8 -p 1
240240
241241

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ classifiers = [
3939
]
4040
dependencies = ["argon2-cffi-bindings"]
4141

42-
[project.optional-dependencies]
42+
[dependency-groups]
4343
tests = ["hypothesis", "pytest"]
4444
typing = ["mypy"]
4545
docs = [
@@ -49,7 +49,11 @@ docs = [
4949
"furo",
5050
"myst-parser",
5151
]
52-
dev = ["argon2-cffi[tests,typing]", "tox>4"]
52+
dev = [
53+
{include-group = "tests"},
54+
{include-group = "typing"},
55+
"tox>4"
56+
]
5357

5458
[project.urls]
5559
Documentation = "https://argon2-cffi.readthedocs.io/"

tox.ini

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ env_list =
1515
description = Run tests / check types and do NOT measure coverage.
1616
package = wheel
1717
wheel_build_env = .pkg
18-
extras =
18+
dependency_groups =
1919
tests: tests
2020
mypy: typing
2121
pass_env =
@@ -56,7 +56,7 @@ install_command = pip install {opts} --no-binary=argon2-cffi-bindings {packages}
5656

5757
[testenv:py312-bindings-main]
5858
description = Run tests against the current main branch of argon2-cffi-bindings
59-
extras =
59+
dependency_groups =
6060
deps =
6161
commands_pre = pip install -I hypothesis pytest git+https://github.com/hynek/argon2-cffi-bindings
6262
install_command = pip install {opts} --no-deps {packages}
@@ -71,7 +71,7 @@ commands = pre-commit run --all-files
7171

7272
[testenv:pyright]
7373
deps = pyright
74-
extras = typing
74+
dependency_groups = typing
7575
commands = pyright tests/typing src
7676

7777

@@ -84,7 +84,7 @@ commands = mypy src
8484
[testenv:docs-{build,doctests,linkcheck}]
8585
# Keep base_python in sync with .readthedocs.yaml.
8686
base_python = py313
87-
extras = docs
87+
dependency_groups = docs
8888
commands =
8989
build: sphinx-build -n -T -W -b html -d {envtmpdir}/doctrees docs {posargs:docs/_build/}html
9090
doctests: python -m doctest README.md
@@ -95,7 +95,7 @@ commands =
9595
[testenv:docs-watch]
9696
package = editable
9797
base_python = {[testenv:docs-build]base_python}
98-
extras = {[testenv:docs-build]extras}
98+
dependency_groups = {[testenv:docs-build]dependency_groups}
9999
deps = watchfiles
100100
commands =
101101
watchfiles \
@@ -108,5 +108,5 @@ commands =
108108

109109
[testenv:docs-linkcheck]
110110
base_python = {[testenv:docs]base_python}
111-
extras = {[testenv:docs]extras}
111+
dependency_groups = {[testenv:docs]dependency_groups}
112112
commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/html

0 commit comments

Comments
 (0)