Skip to content

Commit

Permalink
switch from project.optional-dependencies to dependency-groups
Browse files Browse the repository at this point in the history
...now that the latest version of uv supports it.

Also update flake.lock to include latest revision of nixpkgs, which
contains the latest version of uv.
  • Loading branch information
jab committed Nov 3, 2024
1 parent b14773c commit c85aab0
Show file tree
Hide file tree
Showing 9 changed files with 344 additions and 281 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
uses: hynek/setup-cached-uv@4b4bfa932036976749a9653b0fa4fa10b1a7092b
- name: create and activate virtualenv
run: |
uv sync --extra=test
uv sync --only-group=test
source .venv/bin/activate
echo PATH="$PATH" >> "$GITHUB_ENV"
- name: install the version of bidict to benchmark
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
uses: hynek/setup-cached-uv@4b4bfa932036976749a9653b0fa4fa10b1a7092b
- name: create and activate virtualenv
run: |
uv sync --extra=test
uv sync --only-group=test
source .venv/bin/activate
echo PATH="$PATH" >> "$GITHUB_ENV"
- name: cache .mypy_cache dir
Expand Down
25 changes: 21 additions & 4 deletions flake.lock

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

14 changes: 8 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
description = "bidict";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs";
# Get pypy310 from a nixpkgs revision where its binary is in the binary cache
# to avoid building it from source.
pypy310.url = "github:NixOS/nixpkgs/d4f247e89f6e10120f911e2e2d2254a050d0f732";
};

outputs = { self, nixpkgs, flake-utils }:
outputs = { self, flake-utils, nixpkgs, pypy310 }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
Expand All @@ -19,14 +22,13 @@
python311
python310
python39
pypy310
pypy39
uv # bootstrap uv version (another version is installed in the dev env by this version)
uv # Bootstrap version used to install a possibly-newer version when 'uv sync' is run (via uv.lock)
] ++ [
pypy310.legacyPackages.${system}.pypy310
];
shellHook = ''
./init_dev_env
source ".venv/bin/activate"
echo "* Activated development virtualenv"
'';
};
});
Expand Down
5 changes: 2 additions & 3 deletions init_dev_env
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ for cmd in uv pre-commit; do
done
pre-commit install -f

uv sync --all-extras
echo "Development virtualenv initialized"
echo "To activate, run: source .venv/bin/activate (or equivalent for your shell)"
uv sync
echo "Development virtualenv initialized and activated"
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Documentation = "https://bidict.readthedocs.io"
Sponsor = "https://bidict.readthedocs.io/#sponsoring"
Repository = "https://github.com/jab/bidict"

[project.optional-dependencies]
[dependency-groups]
test = [
"coverage",
"coverage-enable-subprocess",
Expand All @@ -58,6 +58,9 @@ docs = [
"furo",
]

[tool.uv]
default-groups = ["test", "dev", "docs"]

[build-system]
requires = ["setuptools >= 40.9.0"]
build-backend = "setuptools.build_meta"
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ wheel_build_env = .pkg

[testenv]
runner = uv-venv-lock-runner
extras = test
passenv =
# https://docs.pytest.org/en/stable/example/simple.html
PYTEST_ADDOPTS
Expand Down
3 changes: 0 additions & 3 deletions update_dev_dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# shellcheck disable=SC2086,SC1091


set -euo pipefail

log() {
Expand Down
568 changes: 307 additions & 261 deletions uv.lock

Large diffs are not rendered by default.

0 comments on commit c85aab0

Please sign in to comment.