Skip to content

Commit

Permalink
migrate to uv
Browse files Browse the repository at this point in the history
  • Loading branch information
cyface committed Jan 10, 2025
1 parent 8196dbd commit 8a29025
Show file tree
Hide file tree
Showing 7 changed files with 573 additions and 1,487 deletions.
30 changes: 8 additions & 22 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,18 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
cache-dependency-glob: "uv.lock"
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies via poetry
run: poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Install dependencies
run: |
poetry install
- run: uv sync
- name: Test
run: |
poetry run ruff check .
poetry run coverage run manage.py test
poetry run coverage xml
uv run ruff check .
uv run coverage run manage.py test
uv run coverage xml
- name: codecov-umbrella
uses: codecov/codecov-action@v4
with:
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow uses Poetry to upload a new package version when a release is created.
# This workflow uses UV to upload a new package version when a release is created.

name: Upload Python Package

Expand All @@ -19,11 +19,12 @@ jobs:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry setuptools wheel
python -m pip install --upgrade uv
uv install setuptools wheel
- name: Build and publish
env:
POETRY_HTTP_BASIC_PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
UV_PUBLISH_USERNAME: ${{ secrets.PYPI_USERNAME }}
UV_PUBLISH_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
poetry publish --build
uv build
uv publish
20 changes: 0 additions & 20 deletions .gitpod.yml

This file was deleted.

1,415 changes: 0 additions & 1,415 deletions poetry.lock

This file was deleted.

2 changes: 0 additions & 2 deletions poetry.toml

This file was deleted.

62 changes: 40 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
[project]
name = "django-termsandconditions"
version = "2.0.12"
description = "Django app that enables users to accept terms and conditions of a site."
authors = [{ name = "Tim White", email = "tim@cyface.com" }]
requires-python = ">=3.8,<4.0"
readme = "README.md"
license = { text = "BSD License" }
classifiers = [
"Development Status :: 5 - Production/Stable",
"Framework :: Django",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Topic :: Internet :: WWW/HTTP",
]
dependencies = ["Django>2.2"]

[project.urls]
Homepage = "https://github.com/cyface/django-termsandconditions"

[tool.black]
line-length = 88
target-version = ['py38', 'py39', 'py310', 'py311']
Expand All @@ -18,6 +42,14 @@ exclude = '''
)/
'''

[dependency-groups]
dev = [
"black~=24.8",
"coverage[toml]~=7.6",
"ruff>=0.9.0,<0.10",
"uv>=0.5"
]

[tool.coverage.run]
branch = true
omit = [
Expand All @@ -34,30 +66,15 @@ omit = [
"*/wsgi.py"
]

[tool.poetry]
authors = ["Tim White <tim@cyface.com>"]
classifiers = ["Development Status :: 5 - Production/Stable", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Topic :: Internet :: WWW/HTTP"]
description = "Django app that enables users to accept terms and conditions of a site."
homepage = "https://github.com/cyface/django-termsandconditions"
license = "BSD"
name = "django-termsandconditions"
packages = [{ include = "termsandconditions" }, ]
readme = "README.md"
version = "2.0.12"
[tool.hatch.build.targets.sdist]
include = ["termsandconditions"]

[tool.poetry.dependencies]
python = ">=3.8,<4.0"
Django = ">2.2"

[tool.poetry.dev-dependencies]
black = "^24.8"
coverage = {extras = ["toml"], version = "^7.6"}
poetry = "^1.8.5"
ruff = "^0.9.0"
[tool.hatch.build.targets.wheel]
include = ["termsandconditions"]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.ruff]
extend-exclude = ["migrations"]
Expand All @@ -73,7 +90,6 @@ lint.ignore = [
"N806",
"N815",
]
line-length = 88
lint.select = [
"B",
"B9",
Expand All @@ -86,6 +102,8 @@ lint.select = [
"UP",
"W",
]
line-length = 88

[tool.ruff.lint.isort]
forced-separate = ["django"]

Expand Down
Loading

0 comments on commit 8a29025

Please sign in to comment.