Skip to content

Commit 975fbd6

Browse files
authored
Merge pull request #46 from MHoroszowski/feature/modernization-uv-migration
Feature/modernization uv migration
2 parents 53fea8f + bea100c commit 975fbd6

10 files changed

Lines changed: 2024 additions & 78 deletions

File tree

.github/workflows/ci.yml

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,29 @@ jobs:
2525
runs-on: ubuntu-latest
2626
steps:
2727
- uses: actions/checkout@v4
28-
- name: Set up Python
29-
uses: actions/setup-python@v5
28+
- name: Install uv
29+
uses: astral-sh/setup-uv@v5
3030
with:
31-
python-version: "3.12"
32-
- name: Install ruff
33-
run: python -m pip install --upgrade ruff
31+
enable-cache: true
32+
# ---uv tool run auto-installs on first invocation; no separate install step needed---
3433
- name: ruff check
35-
run: ruff check src tests
34+
run: uv tool run ruff check src tests
3635
- name: ruff format check
37-
run: ruff format --check src tests
36+
run: uv tool run ruff format --check src tests
3837

3938
typecheck:
4039
name: Typecheck (pyright strict — public API)
4140
runs-on: ubuntu-latest
4241
steps:
4342
- uses: actions/checkout@v4
44-
- name: Set up Python
45-
uses: actions/setup-python@v5
43+
- name: Install uv
44+
uses: astral-sh/setup-uv@v5
4645
with:
47-
python-version: "3.12"
48-
- name: Install package and pyright
49-
run: |
50-
python -m pip install --upgrade pip pyright
51-
python -m pip install -e .
46+
enable-cache: true
47+
- name: Set up Python
48+
run: uv python install 3.12
49+
- name: Sync dev dependencies
50+
run: uv sync --extra dev
5251
# ---public-API surface: pptx/__init__.py is the literal entrypoint
5352
# ---resolved by `from pptx import Presentation`, plus the modules
5453
# ---it pulls in (api, presentation, util, exc, types).
@@ -57,8 +56,8 @@ jobs:
5756
# ---oxml.simpletypes); those are tracked as future work, not this gate.
5857
- name: pyright (public-API entry points)
5958
run: |
60-
pyright src/pptx/__init__.py src/pptx/api.py src/pptx/presentation.py \
61-
src/pptx/util.py src/pptx/exc.py src/pptx/types.py
59+
uv run pyright src/pptx/__init__.py src/pptx/api.py src/pptx/presentation.py \
60+
src/pptx/util.py src/pptx/exc.py src/pptx/types.py
6261
6362
test:
6463
name: Test (Python ${{ matrix.python-version }})
@@ -69,38 +68,35 @@ jobs:
6968
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
7069
steps:
7170
- uses: actions/checkout@v4
72-
- name: Set up Python ${{ matrix.python-version }}
73-
uses: actions/setup-python@v5
71+
- name: Install uv
72+
uses: astral-sh/setup-uv@v5
7473
with:
75-
python-version: ${{ matrix.python-version }}
74+
enable-cache: true
75+
- name: Set up Python ${{ matrix.python-version }}
76+
run: uv python install ${{ matrix.python-version }}
77+
- name: Sync test dependencies
78+
run: uv sync --extra test --python ${{ matrix.python-version }}
7679
- name: Display Python version
77-
run: python -c "import sys; print(sys.version)"
78-
- name: Install package and test deps
79-
run: |
80-
python -m pip install --upgrade pip
81-
python -m pip install -e .
82-
python -m pip install -r requirements-test.txt
80+
run: uv run python -c "import sys; print(sys.version)"
8381
- name: Unit + integration tests (pytest)
84-
run: pytest --cov=pptx --cov-report=term-missing tests
82+
run: uv run pytest --cov=pptx --cov-report=term-missing tests
8583
- name: Acceptance tests (behave)
86-
run: behave --stop
84+
run: uv run behave --stop
8785

8886
build-check:
8987
name: Build sdist and wheel (smoke)
9088
runs-on: ubuntu-latest
9189
needs: test
9290
steps:
9391
- uses: actions/checkout@v4
94-
- name: Set up Python
95-
uses: actions/setup-python@v5
92+
- name: Install uv
93+
uses: astral-sh/setup-uv@v5
9694
with:
97-
python-version: "3.12"
98-
- name: Install build tooling
99-
run: python -m pip install --upgrade build twine
95+
enable-cache: true
10096
- name: Build distributions
101-
run: python -m build
97+
run: uv build
10298
- name: Verify metadata renders
103-
run: python -m twine check dist/*
99+
run: uv tool run --from twine twine check dist/*
104100
- name: Upload build artifacts
105101
uses: actions/upload-artifact@v4
106102
with:

.github/workflows/publish.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,14 @@ jobs:
2222
runs-on: ubuntu-latest
2323
steps:
2424
- uses: actions/checkout@v4
25-
- name: Set up Python
26-
uses: actions/setup-python@v5
25+
- name: Install uv
26+
uses: astral-sh/setup-uv@v5
2727
with:
28-
python-version: "3.12"
29-
- name: Install build tooling
30-
run: python -m pip install --upgrade build
28+
enable-cache: true
3129
- name: Build distributions
32-
run: python -m build
30+
run: uv build
3331
- name: Verify metadata renders
34-
run: |
35-
python -m pip install --upgrade twine
36-
python -m twine check dist/*
32+
run: uv tool run --from twine twine check dist/*
3733
- name: Upload build artifacts
3834
uses: actions/upload-artifact@v4
3935
with:

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.cache
33
.coverage
44
/.tox/
5+
/.venv/
56
/src/*.egg-info
67
*.pyc
78
/dist/
@@ -11,3 +12,5 @@ _scratch/
1112
/spec/gen_spec/spec*.db
1213
tags
1314
/tests/debug.py
15+
/uat/
16+
/AGENTS.md

pyproject.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,30 @@ license = { text = "MIT" }
3535
readme = "README.rst"
3636
requires-python = ">=3.9"
3737

38+
# -- Optional dependency groups, installable as `pip install python-pptx-extended[test]`
39+
# -- or via uv as `uv sync --extra test`. The legacy requirements*.txt files were
40+
# -- removed in the uv migration (see HISTORY.rst); the same package sets live here.
41+
[project.optional-dependencies]
42+
test = [
43+
"behave>=1.2.5",
44+
"pyparsing>=2.0.1,<3",
45+
"pytest>=2.5",
46+
"pytest-cov",
47+
"pytest-xdist",
48+
]
49+
dev = [
50+
"build",
51+
"pyright",
52+
"ruff",
53+
"twine",
54+
]
55+
docs = [
56+
"Sphinx==1.8.6",
57+
"Jinja2==2.11.3",
58+
"MarkupSafe==0.23",
59+
"alabaster<0.7.14",
60+
]
61+
3862
[project.urls]
3963
Changelog = "https://github.com/MHoroszowski/python-pptx/blob/master/HISTORY.rst"
4064
Documentation = "https://python-pptx.readthedocs.io/en/latest/"

requirements-dev.txt

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

requirements-docs.txt

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

requirements-test.txt

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

requirements.txt

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

tox.ini

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

0 commit comments

Comments
 (0)