Skip to content

Commit 1933c3d

Browse files
gcampclaude
andcommitted
Convert project to uv with Python >=3.10
- Migrated from setup.py to pyproject.toml with uv - Set requires-python to >=3.10 - Updated workflows to use uv for building and publishing - Added flake8 and pytest as dev dependencies - Both workflows test CPython 3.10 and PyPy 3.10 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent a681031 commit 1933c3d

File tree

5 files changed

+200
-45
lines changed

5 files changed

+200
-45
lines changed

.github/workflows/publish.yml

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,42 +15,30 @@ jobs:
1515
with:
1616
fetch-depth: 2
1717

18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v5
20+
1821
- name: Check if version changed
1922
id: version_check
2023
run: |
21-
VERSION=$(python setup.py --version)
24+
VERSION=$(uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
2225
echo "version=$VERSION" >> $GITHUB_OUTPUT
2326
24-
if git diff HEAD^ HEAD -- setup.py | grep -q "version="; then
27+
if git diff HEAD^ HEAD -- pyproject.toml | grep -q 'version ='; then
2528
echo "changed=true" >> $GITHUB_OUTPUT
2629
else
2730
echo "changed=false" >> $GITHUB_OUTPUT
2831
fi
2932
30-
- name: Set up Python
31-
if: steps.version_check.outputs.changed == 'true'
32-
uses: actions/setup-python@v5
33-
with:
34-
python-version: '3.11'
35-
36-
- name: Install build dependencies
37-
if: steps.version_check.outputs.changed == 'true'
38-
run: |
39-
python -m pip install --upgrade pip
40-
python -m pip install build
41-
4233
- name: Build package
4334
if: steps.version_check.outputs.changed == 'true'
44-
run: python -m build
35+
run: uv build
4536

4637
- name: Publish to PyPI
4738
if: steps.version_check.outputs.changed == 'true'
4839
env:
49-
TWINE_USERNAME: __token__
50-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
51-
run: |
52-
python -m pip install twine
53-
python -m twine upload dist/*
40+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
41+
run: uv publish
5442

5543
- name: Create GitHub Release
5644
if: steps.version_check.outputs.changed == 'true'

.github/workflows/pull-request.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,19 @@ jobs:
1414
runs-on: [ubuntu-latest]
1515
strategy:
1616
matrix:
17-
python-version: ['3.11', 'pypy-3.11']
17+
python-version: ['3.10', 'pypy3.10']
1818

1919
steps:
2020
- uses: actions/checkout@v2
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v5
2123
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v2
23-
with:
24-
python-version: ${{ matrix.python-version }}
24+
run: uv python install ${{ matrix.python-version }}
2525
- name: Install dependencies
26-
run: |
27-
python -m pip install --upgrade pip
28-
python -m pip install flake8 pytest
29-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
26+
run: uv sync --all-extras --dev
3027
- name: Lint with flake8
3128
run: |
32-
# stop the build if there are Python syntax errors or undefined names
33-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
34-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
35-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
29+
uv run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
30+
uv run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
3631
- name: Test with pytest
37-
run: |
38-
python -m pytest .
32+
run: uv run pytest .

pyproject.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[project]
2+
name = "py-gtfs-loader"
3+
version = "0.3.0"
4+
description = "Load GTFS"
5+
readme = "README.md"
6+
authors = [
7+
{ name = "Jonathan Milot" },
8+
{ name = "Jeremy Steele" }
9+
]
10+
requires-python = ">=3.10"
11+
dependencies = []
12+
license = { text = "MIT" }
13+
classifiers = [
14+
"License :: OSI Approved :: MIT License",
15+
]
16+
17+
[project.urls]
18+
Homepage = "https://github.com/TransitApp/py-gtfs-loader"
19+
20+
[build-system]
21+
requires = ["uv_build>=0.8.3,<0.9.0"]
22+
build-backend = "uv_build"
23+
24+
[dependency-groups]
25+
dev = [
26+
"flake8>=7.3.0",
27+
"pytest>=8.4.2",
28+
]

setup.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

uv.lock

Lines changed: 156 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)