Skip to content

Commit

Permalink
refactor: migrate to uv
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirVondukr committed Nov 16, 2024
1 parent a739f4f commit f6694a1
Show file tree
Hide file tree
Showing 6 changed files with 1,735 additions and 75 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/deploy-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Cache PIP
uses: actions/cache@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
path: |
~/.cache/pip
.venv
key: pip-${{ matrix.python-version }}-${{ hashFiles('pdm.lock') }}
- name: Install PDM
run: |
pip install pdm
pdm sync --clean
- run: pdm run mkdocs gh-deploy --force
enable-cache: true

- name: Install dependencies
run: uv sync --all-extras --dev

- run: uv run mkdocs gh-deploy --force
20 changes: 8 additions & 12 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
strategy:
matrix:
python-version:
- 3.11.7
- 3.12.7
job:
- mypy .
- ruff format --check .
Expand All @@ -18,16 +18,12 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache PIP
uses: actions/cache@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
path: |
~/.cache/pip
.venv
key: pip-${{ matrix.python-version }}-${{ hashFiles('pdm.lock') }}
- name: Install PDM
run: |
pip install pdm
pdm sync --clean
enable-cache: true

- run: pdm run ${{ matrix.job }}
- name: Install dependencies
run: uv sync --all-extras --dev

- run: uv run ${{ matrix.job }}
22 changes: 9 additions & 13 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,15 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache PIP
uses: actions/cache@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
path: |
~/.cache/pip
.venv
key: pip-${{ matrix.python-version }}-${{ hashFiles('pdm.lock') }}
- name: Install PDM
run: |
pip install pdm
pdm sync --clean
enable-cache: true

- name: Install dependencies
run: uv sync --all-extras --dev

- run: |
pdm run coverage run
pdm run coverage report -m
pdm run coverage xml
uv run coverage run
uv run coverage report -m
uv run coverage xml
20 changes: 10 additions & 10 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,45 @@ stages:
- lint

.lint-job:
image: python:3.10-slim
image: python:3.12-slim
stage: lint
interruptible: true
cache:
- key:
files:
- pdm.lock
- uv.lock
paths:
- .venv
- .cache/pip

before_script:
- pip install pdm
- pdm install
- pip install uv
- uv sync
variables:
GIT_STRATEGY: clone
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"

mypy:
extends: .lint-job
script:
- pdm run mypy .
- uv run mypy .

black:
extends: .lint-job
script:
- pdm run black --check .
- uv run black --check .

ruff:
extends: .lint-job
script:
- pdm run ruff check .
- uv run ruff check .

pytest:
extends: .lint-job
script:
- pdm run coverage run
- pdm run coverage report -m
- pdm run coverage xml
- uv run coverage run
- uv run coverage report -m
- uv run coverage xml
coverage: "/^TOTAL.*\\s(\\d*)/"
artifacts:
reports:
Expand Down
48 changes: 19 additions & 29 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,47 +20,37 @@ dependencies = [
Documentation = "https://thirvondukr.github.io/aioinject/"
Repository = "https://github.com/ThirVondukr/aioinject"

[build-system]
requires = ["pdm-pep517>=1.0"]
build-backend = "pdm.pep517.api"


[tool.pdm]
[tool.pdm.dev-dependencies]
docs = [
"mkdocs>=1.6.0",
"mkdocs-material>=9.5.19",
]
[dependency-groups]
dev = [
"aiogram>=3.14.0",
"anyio>=4.6.2.post1",
"asgi-lifespan>=2.1.0",
"commitizen>=3.30.0",
"coverage[toml]>=7.6.4",
"fastapi>=0.115.4",
"coverage[toml]>=7.6.7",
"fastapi>=0.115.5",
"litestar>=2.12.1",
"mkdocs>=1.6.1",
"mkdocs-material>=9.5.44",
"mypy>=1.13.0",
"pydantic-settings>=2.6.1",
"pytest>=8.3.3",
"ruff>=0.7.3",
"ruff>=0.7.4",
"strawberry-graphql>=0.248.1",
"trio>=0.27.0",
"uvicorn>=0.32.0",
]
[tool.pdm.build]
includes = ["aioinject/"]

[tool.pdm.scripts]
lint = { composite = [
"black .",
"ruff check --fix .",
"mypy .",
"black --check .",
] }
test = { composite = [
"coverage run",
"coverage report",
] }

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"


[tool.hatch.build.targets.sdist]
ignore-vcs = true
include = ["aioinject/*", "tests/*", "docs/*", "benchmark/*"]

[tool.hatch.build.targets.wheel]
include = ["aioinject/*"]


[tool.coverage.run]
source = ["aioinject"]
Expand Down
Loading

0 comments on commit f6694a1

Please sign in to comment.