Skip to content

Commit

Permalink
switch to uv lockfile + associated cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jab committed Oct 5, 2024
1 parent f73239e commit 3288007
Show file tree
Hide file tree
Showing 17 changed files with 1,030 additions and 271 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,13 @@ jobs:
uses: hynek/setup-cached-uv@4b4bfa932036976749a9653b0fa4fa10b1a7092b
- name: create and activate virtualenv
run: |
uv venv
uv sync --extra=test
source .venv/bin/activate
echo PATH="$PATH" >> "$GITHUB_ENV"
- name: uv pip install
run: uv pip install -r dev-deps/test.txt
- name: install the version of bidict to benchmark
run: |
git checkout ${{ github.event.inputs.ref || github.sha }}
# install a non-editable version of bidict at the revision under test
uv pip install --no-deps .
# restore the current revision so we use its version of tests/microbenchmarks.py
git checkout ${{ github.sha }}
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ jobs:
- pyversion: "3.10"
- pyversion: "3.9"
- pyversion: "pypy-3.10"
deps_subdir: "pypy3.10"
- pyversion: "pypy-3.9"
deps_subdir: "pypy3.9"
steps:
- name: check out source
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
Expand All @@ -54,11 +51,9 @@ jobs:
uses: hynek/setup-cached-uv@4b4bfa932036976749a9653b0fa4fa10b1a7092b
- name: create and activate virtualenv
run: |
uv venv
uv sync --extra=test
source .venv/bin/activate
echo PATH="$PATH" >> "$GITHUB_ENV"
- name: uv pip install
run: uv pip install -r dev-deps/test.txt
- name: cache .mypy_cache dir
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
with:
Expand All @@ -78,12 +73,9 @@ jobs:
- name: maybe enable coverage
if: matrix.enable_coverage
run: |
echo COVERAGE_CORE=sysmon >> "$GITHUB_ENV"
echo COVERAGE_PROCESS_START="$(pwd)/.coveragerc" >> "$GITHUB_ENV"
echo RUN_PYTEST_CMD="coverage run -m pytest" >> "$GITHUB_ENV"
- name: set COVERAGE_CORE=sysmon if py3.12
if: matrix.pyversion == '3.12'
run: |
echo COVERAGE_CORE=sysmon >> "$GITHUB_ENV"
- name: run pytest
run: ${RUN_PYTEST_CMD:-pytest}
- name: combine and show any collected coverage
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update_dev_deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
# - name: set up upterm session
# uses: lhotari/action-upterm@v1
- name: update development dependencies
run: nix develop --command bash -c './init_dev_env && ./dev-deps/update_dev_dependencies'
run: nix develop --command bash -c './update_dev_dependencies'
- name: create PR
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c
with:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ repos:
- pytest

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.8
rev: v0.6.9
hooks:
- id: ruff
args: [--fix, --unsafe-fixes]
Expand Down
8 changes: 0 additions & 8 deletions dev-deps/dev.env

This file was deleted.

5 changes: 0 additions & 5 deletions dev-deps/dev.in

This file was deleted.

68 changes: 0 additions & 68 deletions dev-deps/dev.txt

This file was deleted.

3 changes: 0 additions & 3 deletions dev-deps/docs.in

This file was deleted.

62 changes: 0 additions & 62 deletions dev-deps/docs.txt

This file was deleted.

11 changes: 0 additions & 11 deletions dev-deps/test.in

This file was deleted.

51 changes: 0 additions & 51 deletions dev-deps/test.txt

This file was deleted.

14 changes: 4 additions & 10 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,12 @@
python39
pypy310
pypy39
uv # bootstrap uv version
uv # bootstrap uv version (another version is installed in the dev env by this version)
];
shellHook = ''
source ./dev-deps/dev.env
if test -e "$VENV_SUBDIR"; then
echo "* Using pre-existing development virtualenv dir ($VENV_SUBDIR)"
else
echo "* No pre-existing development virtualenv dir ($VENV_SUBDIR), initializing..."
./init_dev_env
fi
source "$VENV_SUBDIR/bin/activate"
echo "* Activated development virtualenv ($VENV_SUBDIR)"
./init_dev_env
source ".venv/bin/activate"
echo "* Activated development virtualenv"
'';
};
});
Expand Down
13 changes: 4 additions & 9 deletions init_dev_env
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,14 @@ set -euo pipefail

declare -r hint="Hint: Use 'nix develop' to bootstrap a development environment"

source "$BIDICT_ROOT_DIR/dev-deps/dev.env"

for cmd in uv pre-commit "$DEFAULT_PY"; do
for cmd in uv pre-commit; do
if ! type "$cmd"; then
>&2 echo "Error: No '$cmd' on PATH. $hint"
exit 1
fi
done
pre-commit install -f

test -d "$VENV_DIR" || uv venv --python="$DEFAULT_PY" "$VENV_DIR"
uv pip sync dev-deps/*.txt
uv pip show -q bidict || uv pip install -e "$BIDICT_ROOT_DIR"

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

[project.optional-dependencies]
test = [
"coverage",
"coverage-enable-subprocess",
"hypothesis",
"mypy",
"pytest",
"pytest-benchmark",
"pytest-sphinx",
"pytest-xdist",
"sortedcollections",
"sortedcontainers",
"typing_extensions",
]
dev = [
"pytest-clarity",
"pytest-icdiff",
"tox",
"tox-uv",
"uv",
]
docs = [
"sphinx",
"sphinx-copybutton",
"furo",
]

[build-system]
requires = ["setuptools >= 40.9.0"]
build-backend = "setuptools.build_meta"
Expand Down
Loading

0 comments on commit 3288007

Please sign in to comment.