Switch to dependency groups (#202)
This commit is contained in:
parent
2eedf07ac7
commit
298af7e4db
43
.github/CONTRIBUTING.md
vendored
43
.github/CONTRIBUTING.md
vendored
@ -25,15 +25,14 @@ But don't be afraid to open half-finished PRs and ask questions if something is
|
||||
- Don’t break backwards-compatibility.
|
||||
|
||||
|
||||
## Local Development Environment
|
||||
## Local development environment
|
||||
|
||||
You can (and should) run our test suite using [*tox*].
|
||||
However, you’ll probably want a more traditional environment as well.
|
||||
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`.
|
||||
|
||||
First, create a [virtual environment](https://virtualenv.pypa.io/) so you don't break your system-wide Python installation.
|
||||
We recommend using the Python version from the `.python-version-default` file in project's root directory.
|
||||
You can (and should) run our test suite using [*tox*](https://tox.wiki/).
|
||||
However, you'll probably want a more traditional environment as well.
|
||||
|
||||
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`).
|
||||
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.
|
||||
|
||||
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:
|
||||
|
||||
@ -48,37 +47,25 @@ test -d .venv || uv venv --python python$(cat .python-version-default)
|
||||
. .venv/bin/activate
|
||||
```
|
||||
|
||||
---
|
||||
> [!WARNING]
|
||||
> - **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.
|
||||
> - **Always create a new branch off `main` for each new pull request.**
|
||||
> Yes, you can work on `main` in your fork and submit pull requests.
|
||||
> But this will *inevitably* lead to you not being able to synchronize your fork with upstream and having to start over.
|
||||
|
||||
Next, fork the repository on GitHub and get an up-to-date checkout:
|
||||
Change into the newly created directory and after activating a virtual environment, install an editable version of this project along with its tests requirements:
|
||||
|
||||
```console
|
||||
$ git clone git@github.com:<your-username>/argon2-cffi.git
|
||||
$ pip install -e . --group dev # or `uv pip install -e . --group dev`
|
||||
```
|
||||
|
||||
or if you prefer to use *Git* via `https`:
|
||||
Now you can run the test suite:
|
||||
|
||||
```console
|
||||
$ git clone https://github.com/<your-username>/argon2-cffi.git
|
||||
$ python -Im pytest
|
||||
```
|
||||
|
||||
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:
|
||||
|
||||
```console
|
||||
$ cd argon2-cffi
|
||||
$ python -m pip install --upgrade pip wheel # PLEASE don't skip this step
|
||||
$ python -m pip install -e '.[dev]'
|
||||
```
|
||||
|
||||
At this point,
|
||||
|
||||
```console
|
||||
$ python -m pytest
|
||||
```
|
||||
|
||||
should work and pass.
|
||||
|
||||
For documentation, you can use:
|
||||
When working on the documentation, use:
|
||||
|
||||
```console
|
||||
$ tox run -e docs-watch
|
||||
|
||||
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -195,7 +195,7 @@ jobs:
|
||||
|
||||
- run: |
|
||||
uv venv
|
||||
uv pip install .[typing]
|
||||
uv pip install . --group typing
|
||||
echo "$PWD/.venv/bin" >> $GITHUB_PATH
|
||||
- uses: jakebailey/pyright-action@v2
|
||||
|
||||
@ -235,7 +235,7 @@ jobs:
|
||||
|
||||
- name: Install in dev mode and run CLI
|
||||
run: |
|
||||
python -Im pip install -e .[dev]
|
||||
python -Im pip install -e . --group dev
|
||||
python -Im argon2 -n 1 -t 1 -m 8 -p 1
|
||||
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ classifiers = [
|
||||
]
|
||||
dependencies = ["argon2-cffi-bindings"]
|
||||
|
||||
[project.optional-dependencies]
|
||||
[dependency-groups]
|
||||
tests = ["hypothesis", "pytest"]
|
||||
typing = ["mypy"]
|
||||
docs = [
|
||||
@ -49,7 +49,11 @@ docs = [
|
||||
"furo",
|
||||
"myst-parser",
|
||||
]
|
||||
dev = ["argon2-cffi[tests,typing]", "tox>4"]
|
||||
dev = [
|
||||
{include-group = "tests"},
|
||||
{include-group = "typing"},
|
||||
"tox>4"
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
Documentation = "https://argon2-cffi.readthedocs.io/"
|
||||
|
||||
12
tox.ini
12
tox.ini
@ -15,7 +15,7 @@ env_list =
|
||||
description = Run tests / check types and do NOT measure coverage.
|
||||
package = wheel
|
||||
wheel_build_env = .pkg
|
||||
extras =
|
||||
dependency_groups =
|
||||
tests: tests
|
||||
mypy: typing
|
||||
pass_env =
|
||||
@ -56,7 +56,7 @@ install_command = pip install {opts} --no-binary=argon2-cffi-bindings {packages}
|
||||
|
||||
[testenv:py312-bindings-main]
|
||||
description = Run tests against the current main branch of argon2-cffi-bindings
|
||||
extras =
|
||||
dependency_groups =
|
||||
deps =
|
||||
commands_pre = pip install -I hypothesis pytest git+https://github.com/hynek/argon2-cffi-bindings
|
||||
install_command = pip install {opts} --no-deps {packages}
|
||||
@ -71,7 +71,7 @@ commands = pre-commit run --all-files
|
||||
|
||||
[testenv:pyright]
|
||||
deps = pyright
|
||||
extras = typing
|
||||
dependency_groups = typing
|
||||
commands = pyright tests/typing src
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@ commands = mypy src
|
||||
[testenv:docs-{build,doctests,linkcheck}]
|
||||
# Keep base_python in sync with .readthedocs.yaml.
|
||||
base_python = py313
|
||||
extras = docs
|
||||
dependency_groups = docs
|
||||
commands =
|
||||
build: sphinx-build -n -T -W -b html -d {envtmpdir}/doctrees docs {posargs:docs/_build/}html
|
||||
doctests: python -m doctest README.md
|
||||
@ -95,7 +95,7 @@ commands =
|
||||
[testenv:docs-watch]
|
||||
package = editable
|
||||
base_python = {[testenv:docs-build]base_python}
|
||||
extras = {[testenv:docs-build]extras}
|
||||
dependency_groups = {[testenv:docs-build]dependency_groups}
|
||||
deps = watchfiles
|
||||
commands =
|
||||
watchfiles \
|
||||
@ -108,5 +108,5 @@ commands =
|
||||
|
||||
[testenv:docs-linkcheck]
|
||||
base_python = {[testenv:docs]base_python}
|
||||
extras = {[testenv:docs]extras}
|
||||
dependency_groups = {[testenv:docs]dependency_groups}
|
||||
commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/html
|
||||
|
||||
Loading…
Reference in New Issue
Block a user