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

dep groups update #99

Merged
merged 6 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
enable-cache: true

- name: Install dependencies
run: uv sync --no-install-project --group lint
run: uv sync --only-dev

- name: Cache pre-commit
uses: actions/cache@v4
Expand All @@ -27,4 +27,4 @@ jobs:
key: precommit-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Run pre-commit
run: make fmt
run: uv run pre-commit run --all-files
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
enable-cache: true

- name: Install dependencies
run: uv sync --group test
run: uv sync

- name: Run tests and generate coverage report
run: make coverage
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,9 @@ Simply run `make` to get an overview of available commands.

[uv](https://docs.astral.sh/uv/) is an amazing, modern tool for developing Python packages.

Note that the dependency specification for this repository contains two [dependency groups](https://docs.astral.sh/uv/concepts/projects/dependencies/#dependency-groups):

- `test`: Includes all testing dependencies.
- `lint`: Includes all linting dependencies. This can be useful to help your IDE do autoformatting or show in-line linting errors.

Having these development dependencies in separate groups makes it easy to install only the required dependencies in the CI workflows.
Note that the dependency specification for this repository contains a single `dev` [dependency group](https://docs.astral.sh/uv/concepts/projects/dependencies/#dependency-groups).
With the speed that uv offers, it's not really required to further split this out into a `test` and `lint` group, for example.
Furthermore, using `dev` is the default and this offers some minor integration benefits.

## GitHub Actions

Expand Down
13 changes: 6 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@ dependencies = [
mycli = 'mypackage.__main__:main'

[dependency-groups]
test = [
dev = [
"coverage>=7.6.10",
"pytest>=8.3.4",
"pytest-mock>=3.14.0",
]
lint = [
"mypy>=1.14.1",
"pre-commit>=4.1.0",
"pytest>=8.3.4",
"pytest-mock>=3.14.0",
"ruff>=0.9.4",
]

Expand All @@ -32,8 +30,9 @@ requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.uv]
required-version = ">=0.5,<0.6"
default-groups = ["test", "lint"]
# TODO: Set to ">=0.5,<0.6" when bug is fixed
# https://github.com/astral-sh/setup-uv/issues/264
required-version = "<0.6"

[tool.ruff]
src = ["src"]
Expand Down
16 changes: 6 additions & 10 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.