Skip to content

Commit

Permalink
uv-ize project
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasertl committed Dec 20, 2024
1 parent c6cec1e commit 8c92744
Show file tree
Hide file tree
Showing 11 changed files with 3,433 additions and 61 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,12 @@ jobs:
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "requirements.txt"

- name: Update setuptools/wheel
run: uv pip install -U setuptools wheel

- name: Install dependencies
run: uv pip install -r requirements.txt -r requirements/requirements-docs.txt
run: uv sync --no-group=local

- name: doc8 style checks
run: doc8 docs/source/
run: uv run doc8 docs/source/

- name: Generate documentation
run: make -C docs html
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/faketime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,9 @@ jobs:
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "requirements.txt"

- name: Update setuptools/wheel
run: uv pip install -U setuptools wheel

- name: Install dependencies
run: uv pip install -r requirements.txt -r requirements/requirements-test.txt
run: uv sync --no-group local --all-extras

- name: Run tests
run: faketime -f +100y pytest -v --no-selenium --cov-report term-missing --durations=20
run: faketime -f +100y uv run --offline pytest -v --no-selenium --cov-report term-missing --durations=20
8 changes: 2 additions & 6 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,9 @@ jobs:
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "requirements.txt"

- name: Update setuptools/wheel
run: uv pip install -U setuptools wheel

- name: Install dependencies
run: uv pip install -r requirements.txt -r requirements/requirements-mypy.txt
run: uv sync --no-group local --all-extras

- name: run mypy
run: mypy .
run: uv run mypy .
25 changes: 7 additions & 18 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,24 @@ jobs:
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "requirements.txt"

- name: Update setuptools/wheel
run: uv pip install -U setuptools wheel

- name: Install dependencies
run: |
uv pip install -r requirements.txt
uv pip install -r requirements/requirements-test.txt
uv pip install -r requirements/requirements-lint.txt
# Mitigate "Unable to import 'typing_extensions' (import-error)"
uv pip install typing-extensions
run: uv sync --no-group local

- name: Run ruff
run: python dev.py code-quality
run: uv run python dev.py code-quality

# Will show outdated dependencies, etc
- name: Validate state
run: python dev.py validate state
run: uv run python dev.py validate state

- name: Check license headers
run: python dev.py validate license-headers
run: uv run python dev.py validate license-headers

- name: Validate sdist/wheel
run: |
uv pip install -r requirements/requirements-dist.txt
python -m build
twine check --strict dist/*
uv run python -m build
uv run twine check --strict dist/*
- name: Run pylint
run: pylint --verbose ca/django_ca/ ca/ca/ docs/source/django_ca_sphinx/ devscripts/
run: uv run pylint --verbose ca/django_ca/ ca/ca/ docs/source/django_ca_sphinx/ devscripts/
13 changes: 6 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,15 @@ jobs:
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "requirements.txt"

- name: Update setuptools/wheel
run: uv pip install -U setuptools wheel

- name: Install dependencies
run: uv pip install -r requirements.txt -r requirements/requirements-test.txt django~=${{ matrix.django-version }} cryptography~=${{ matrix.cryptography-version }} pydantic~=${{ matrix.pydantic-version }}
run: |
python --version
uv sync --no-group=local --all-extras --system
uv pip install django~=${{ matrix.django-version }} cryptography~=${{ matrix.cryptography-version }} pydantic~=${{ matrix.pydantic-version }}
- name: Initialize demo
run: python dev.py init-demo
run: uv run python dev.py init-demo

- name: Run tests
run: pytest -v --cov-report term-missing --durations=20
run: uv run pytest -v --cov-report term-missing --durations=20
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
/.coverage
/.docker/
/.env
/.python-version
/.tox/
/MANIFEST
/Makefile
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
6 changes: 3 additions & 3 deletions ca/django_ca/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,11 +547,11 @@ def test_wrong_values(self) -> None:

for key_type in ("Ed448", "Ed25519"):
with pytest.raises(ValueError, match=rf"^Key size is not supported for {key_type} keys\.$"):
validate_private_key_parameters(key_type, key_size, None) # type: ignore
validate_private_key_parameters(key_type, key_size, None)
with pytest.raises(
ValueError, match=rf"^Elliptic curves are not supported for {key_type} keys\.$"
):
validate_private_key_parameters(key_type, None, elliptic_curve) # type: ignore
validate_private_key_parameters(key_type, None, elliptic_curve)


class ValidatePublicKeyParametersTest(TestCase):
Expand All @@ -561,7 +561,7 @@ def test_valid_parameters(self) -> None:
"""Test valid parameters."""
for key_type in ("RSA", "DSA", "EC"):
for algorithm in (hashes.SHA256(), hashes.SHA512()):
validate_public_key_parameters(key_type, algorithm) # type: ignore[arg-type]
validate_public_key_parameters(key_type, algorithm)
for key_type in ("Ed448", "Ed25519"):
validate_public_key_parameters(key_type, None) # type: ignore[arg-type]

Expand Down
65 changes: 65 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -506,3 +506,68 @@ where = ["ca"]
include = ["django_ca*"]
exclude = ["django_ca.tests*"]

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

[dependency-groups]
local = [
"ipython>=8.18.1",
"pytest-xdist>=3.6.1",
"tox-uv>=1.16.2",
"tox>=4.23.2",
"wheel-inspect>=1.7.2",
]
dev = [
"build>=1.2.2.post1",
"coverage[toml]>=7.6.9",
"django-test-migrations>=1.4.0",
"doc8>=1.1.2",
"gitpython>=3.1.43",
"jinja2>=3.1.4",
"numpydoc>=1.8.0",
"pytest>=8.3.4",
"pytest-cov>=6.0.0",
"pytest-django>=4.9.0",
"pyyaml>=6.0.2",
"selenium>=4.27.1",
"semantic-version>=2.10.0",
"sphinx-inline-tabs>=2023.4.21",
"sphinx>=7.4.7",
"tabulate>=0.9.0",
"termcolor>=2.5.0",
"tomli>=2.2.1",
"twine>=6.0.1",
"wheel>=0.45.1",
"sphinx-jinja>=2.0.2",
"sphinx-rtd-theme>=3.0.2",
"sphinxcontrib-openapi>=0.8.4",
"sphinxcontrib-spelling>=8.0.0",
"mypy>=1.14.0",
"django-stubs>=5.1.1",
"types-docutils>=0.21.0.20241128",
"types-freezegun>=1.1.10",
"types-jinja2>=2.11.9",
"types-mysqlclient>=2.2.0.20240911",
"types-pytz>=2024.2.0.20241003",
"types-psycopg2>=2.9.21.20241019",
"types-pyopenssl>=24.1.0.20240722",
"types-pyrfc3339>=2.0.1.20241107",
"types-redis>=4.6.0.20241004",
"types-requests>=2.32.0.20241016",
"types-setuptools>=75.6.0.20241126",
"types-tabulate>=0.9.0.20241207",
"pyvirtualdisplay>=3.0",
"django-webtest>=1.9.12",
"freezegun>=1.5.1",
"pyopenssl>=24.3.0",
"pyrfc3339>=2.0.1",
"pytest-env>=1.1.5",
"pytest-freezer>=0.4.9",
"pytest-random-order>=1.1.1",
"requests-mock>=1.12.1",
"pre-commit>=4.0.1",
"pylint-django>=2.6.1",
"pylint>=3.3.2",
"ruff>=0.8.4",
]

14 changes: 0 additions & 14 deletions requirements-dev.txt

This file was deleted.

Loading

0 comments on commit 8c92744

Please sign in to comment.