Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Migrate to use UV for dependencies management #218

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 39 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,41 @@ on:

jobs:
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu]
python-version: ['3.11']

runs-on: ${{ matrix.os }}-latest


steps:
- uses: actions/checkout@v4

- name: set up python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.11'

- name: setup UV
uses: yezz123/setup-uv@v4

- name: install
run: |
pip install -r requirements/pyproject.txt && pip install -r requirements/linting.txt
uv sync

- uses: pre-commit/action@v3.0.1
with:
extra_args: --all-files --verbose
- name: Virtual Environment
run: |
source .venv/bin/activate

- name: Freeze Dependencies
run: uv tree

- name: Run Lint
run: make pre-commit
env:
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}-with-deps

test:
name: test py${{ matrix.python-version }} on ${{ matrix.os }}
Expand All @@ -46,12 +64,22 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- run: |
pip install -r requirements/pyproject.txt && pip install -r requirements/testing.txt
- name: setup UV
uses: yezz123/setup-uv@v4

- name: install
run: |
uv sync

- name: Virtual Environment
run: |
source .venv/bin/activate

- run: pip freeze
- name: Freeze Dependencies
run: uv tree

- run: make test
- name: Run tests
run: make test
env:
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}-with-deps

Expand Down Expand Up @@ -85,7 +113,7 @@ jobs:
- name: set up python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.11'

- name: install
run: pip install -U build
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ venv/
.venv/
env3*/
Pipfile
*.lock
*.py[cod]
*.egg-info/
/build/
Expand Down
11 changes: 2 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,11 @@ sources = pydantic_extra_types tests

.PHONY: install
install:
python -m pip install -U pip
pip install -r requirements/all.txt
pip install -e .
uv sync

.PHONY: refresh-lockfiles
refresh-lockfiles:
@echo "Updating requirements/*.txt files using pip-compile"
find requirements/ -name '*.txt' ! -name 'all.txt' -type f -delete
pip-compile -q --no-emit-index-url --resolver backtracking -o requirements/linting.txt requirements/linting.in
pip-compile -q --no-emit-index-url --resolver backtracking -o requirements/testing.txt requirements/testing.in
pip-compile -q --no-emit-index-url --resolver backtracking --extra all -o requirements/pyproject.txt pyproject.toml
pip install --dry-run -r requirements/all.txt
uv lock --upgrade

.PHONY: format
format:
Expand Down
18 changes: 17 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ classifiers = [
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Internet',
]
requires-python = '>=3.8'
requires-python = '>=3.10,<4.0'

dependencies = ['pydantic>=2.5.2','typing-extensions']
dynamic = ['version']

Expand All @@ -62,6 +63,21 @@ python_ulid = [
]
pendulum = ['pendulum>=3.0.0,<4.0.0']

[tool.uv]
dev-dependencies = [
'dirty-equals',
'coverage[toml]',
'pytest',
'codecov',
'pytest-cov',
'pytest-pretty',
'pre-commit',
'mypy',
'annotated-types',
'ruff',
'types-pytz',
]

[project.urls]
Homepage = 'https://github.com/pydantic/pydantic-extra-types'
Source = 'https://github.com/pydantic/pydantic-extra-types'
Expand Down
3 changes: 0 additions & 3 deletions requirements/all.txt

This file was deleted.

5 changes: 0 additions & 5 deletions requirements/linting.in

This file was deleted.

39 changes: 0 additions & 39 deletions requirements/linting.txt

This file was deleted.

39 changes: 0 additions & 39 deletions requirements/pyproject.txt

This file was deleted.

6 changes: 0 additions & 6 deletions requirements/testing.in

This file was deleted.

50 changes: 0 additions & 50 deletions requirements/testing.txt

This file was deleted.

Loading
Loading