Skip to content

Commit

Permalink
♻️ Refactor dependency management in pyproject.toml and Makefile; upd…
Browse files Browse the repository at this point in the history
…ate CI workflow for improved linting and coverage
  • Loading branch information
yezz123 committed Nov 22, 2024
1 parent 43ff8cb commit 1bd2075
Show file tree
Hide file tree
Showing 4 changed files with 406 additions and 18 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,20 @@ env:
jobs:
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.12']

steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v3
with:
enable-cache: true

- run: uv sync --python 3.12 --frozen --no-dev --group lint
- name: Install dependencies
run: uv sync --python ${{ matrix.python-version }} --group lint --all-extras

- uses: pre-commit/[email protected]
with:
Expand All @@ -48,10 +54,12 @@ jobs:
with:
enable-cache: true

- name: Install Extra Dependencies
run: uv sync --frozen --group all --all-extras
- name: Install extra dependencies
run: uv sync --group dev --all-extras

- name: Make coverage directory
run: mkdir coverage

- run: mkdir coverage
- run: uv run --frozen coverage run -m pytest
env:
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ sources = pydantic_extra_types tests
.uv:
@uv --version || echo 'Please install uv: https://docs.astral.sh/uv/getting-started/installation/'

.PHONY: install # Install the package, dependencies, and pre-commit for local development
.PHONY: install ## Install the package, dependencies, and pre-commit for local development
install: .uv
uv sync --frozen --group all --all-extras
uv run pre-commit install --install-hooks
uv pip install pre-commit
pre-commit install --install-hooks

.PHONY: rebuild-lockfiles ## Rebuild lockfiles from scratch, updating all dependencies
rebuild-lockfiles: .uv
Expand Down
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies = ['pydantic>=2.5.2','typing-extensions']
dynamic = ['version']

[project.optional-dependencies]
all = [
extra = [
'phonenumbers>=8,<9',
'pycountry>=23',
'semver>=3.0.2',
Expand Down Expand Up @@ -72,12 +72,15 @@ dev = [
"pytest-cov>=5.0.0",
]
lint = [
"pre-commit>=3.5.0",
"ruff>=0.7.4",
"mypy>=0.910",
"annotated-types>=0.7.0",
"types-pytz>=2024.1.0.20240417",
]
all = [
{ include-group = 'dev' },
{ include-group = 'lint' },
]

[project.urls]
Homepage = 'https://github.com/pydantic/pydantic-extra-types'
Expand Down
Loading

0 comments on commit 1bd2075

Please sign in to comment.