Skip to content

Commit b7c3ec8

Browse files
committed
debt: uv python and package management over poetry
- Abstract contributing guidelines from Python project README
1 parent 2d1f995 commit b7c3ec8

File tree

7 files changed

+409
-414
lines changed

7 files changed

+409
-414
lines changed

.github/workflows/release-pypi.yaml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: Release Python
22

33
on:
44
push:
5-
branches: [ release/* ]
5+
branches: [release/*]
66

77
jobs:
8-
release:
9-
name: Release
8+
publish-pypi:
9+
name: Publish PyPI Package
1010
runs-on: ubuntu-latest
1111
environment: Release
1212
permissions:
@@ -15,23 +15,17 @@ jobs:
1515
run:
1616
working-directory: python
1717
steps:
18-
- name: Checkout code
19-
uses: actions/checkout@v5
20-
- name: Set up Python 3.10
21-
uses: actions/setup-python@v6
18+
- uses: actions/checkout@v5
19+
20+
- name: Install uv and set the python version
21+
uses: astral-sh/setup-uv@v7
2222
with:
23+
enable-cache: true
2324
python-version: "3.14"
24-
25-
- name: Show Python version
26-
run: python --version
25+
version: "0.9.1"
2726

2827
- name: Build package
29-
run: |
30-
python -m pip install build twine
31-
python -m build
32-
twine check --strict dist/*
28+
run: uv build
3329

34-
- name: Publish package distributions to PyPI
35-
uses: pypa/gh-action-pypi-publish@release/v1
36-
with:
37-
packages-dir: python/dist
30+
- name: Publish package
31+
run: uv publish

.github/workflows/test-python.yml

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -24,61 +24,37 @@ jobs:
2424
uses: astral-sh/setup-uv@v6
2525
with:
2626
enable-cache: true
27-
python-version: "3.13"
27+
python-version: "3.14"
2828
version: "0.8.17"
2929

3030
- name: Linting
3131
run: uvx pre-commit run --all-files
3232

3333
test-python:
3434
runs-on: ${{ matrix.os }}
35-
defaults:
36-
run:
37-
working-directory: python
38-
shell: bash
3935
strategy:
4036
fail-fast: false
4137
matrix:
4238
os:
4339
- ubuntu-latest
44-
python-version: ["3.9", "3.10", "3.11", "3.12"]
40+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
4541
include:
4642
- os: windows-latest
4743
python-version: "3.10"
4844
- os : macos-latest
4945
python-version: "3.10"
46+
defaults:
47+
run:
48+
working-directory: python
5049
steps:
5150
- uses: actions/checkout@v5
52-
- name: Set up Python ${{ matrix.python-version }}
53-
uses: actions/setup-python@v6
51+
52+
- name: Install uv and set the python version
53+
uses: astral-sh/setup-uv@v7
5454
with:
55+
enable-cache: true
5556
python-version: ${{ matrix.python-version }}
56-
- name: Get full Python version
57-
id: full-python-version
58-
run: echo "version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")" >> $GITHUB_OUTPUT
59-
- name: Bootstrap poetry
60-
run: |
61-
curl -sL https://install.python-poetry.org | python - -y ${{ matrix.bootstrap-args }}
62-
- name: Update PATH
63-
if: ${{ matrix.os != 'windows-latest' }}
64-
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
65-
- name: Update Path for Windows
66-
if: ${{ matrix.os == 'windows-latest' }}
67-
run: echo "$APPDATA\Python\Scripts" >> $GITHUB_PATH
68-
- name: Configure poetry
69-
run: poetry config virtualenvs.in-project true
70-
- name: Set up cache
71-
uses: actions/cache@v4
72-
id: cache
73-
with:
74-
path: .venv
75-
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
76-
- name: Ensure cache is healthy
77-
if: steps.cache.outputs.cache-hit == 'true'
78-
run: timeout 10s poetry rupoen pip --version || rm -rf .venv
79-
- name: Install dependencies
80-
run: poetry install
81-
- name: Install pytest plugin
82-
run: poetry run pip install pytest-github-actions-annotate-failures
57+
version: "0.9.1"
58+
8359
- name: Run pytest
84-
run: poetry run python -m pytest -p no:sugar -q tests/
60+
run: uv run --with pytest-github-actions-annotate-failures pytest -p no:sugar --quiet tests/

python/CONTRIBUTING.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Contributing
2+
3+
Thank you for your interest in contributing to `cucumber-expressions`, a simpler alternative to regular expressions! This guide will help you get set up and understand our development workflow.
4+
5+
## 🚀 Quick Start
6+
7+
Using [`uv`](https://docs.astral.sh/uv/) is recommended for contributing with this project, though you can also install dependencies via `pip` (use `pip install . --group dev` with v25.1+) or your preferred tool.
8+
9+
First change to the directory containing the Python implementation and install development dependencies.
10+
11+
```console
12+
cd python
13+
uv sync
14+
```
15+
16+
At the root of the repository, install pre-commit hooks to automatically validate linting and formatting of your Python code with every commit.
17+
18+
```console
19+
cd ..
20+
uv run pre-commit install
21+
```
22+
23+
Unit tests can run via `pytest`.
24+
25+
```console
26+
uv run pytest
27+
```

python/README.md

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,3 @@
11
# Cucumber Expressions for Python
22

33
[The main docs are here](https://github.com/cucumber/cucumber-expressions#readme).
4-
5-
## Build system
6-
7-
This project uses [Poetry](https://python-poetry.org/) as its build system.
8-
In order to develop on this project, please install Poetry as per your system's instructions on the link above.
9-
10-
## Tests
11-
12-
The test suite uses `pytest` as its testing Framework.
13-
14-
15-
### Preparing to run the tests
16-
17-
In order to set up your dev environment, run the following command from this project's directory:
18-
19-
``` python
20-
poetry install
21-
```
22-
It will install all package and development requirements, and once that is done it will do a dev-install of the source code.
23-
24-
You only need to run it once, code changes will propagate directly and do not require running the install again.
25-
26-
27-
### Running the tests
28-
29-
`pytest` automatically picks up files in the current directory or any subdirectories that have the prefix or suffix of `test_*.py`.
30-
Test function names must start with `test*`.
31-
Test class names must start with `Test*`.
32-
33-
To run all tests:
34-
35-
``` python
36-
poetry run pytest
37-
```
38-

0 commit comments

Comments
 (0)