Skip to content

Commit 33b2b30

Browse files
authored
Merge pull request #834 from pytest-dev/switch-to-uv
Migrate project from Poetry to UV
2 parents a7cbc52 + e0346d3 commit 33b2b30

9 files changed

Lines changed: 2275 additions & 2604 deletions

File tree

‎.envrc‎

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

‎.github/workflows/main.yml‎

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,20 @@ on:
55
pull_request:
66
workflow_dispatch:
77

8-
env:
9-
POETRY_VERSION: "2.4.3"
10-
118
jobs:
129
build:
1310
name: Build package
1411
runs-on: ubuntu-latest
1512
steps:
1613
- uses: actions/checkout@v4
14+
- name: Install uv
15+
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
1716
- name: Set up Python
1817
uses: actions/setup-python@v5
19-
with:
20-
cache: "pip"
21-
- name: Install poetry
22-
run: python3 -m pip install poetry==${{ env.POETRY_VERSION }}
23-
- name: Install build dependencies
24-
run: poetry install --only build
2518
- name: Build a binary wheel and a source tarball
26-
run: poetry run python -m build
19+
run: uv build
2720
- name: Check the distribution files with `twine`
28-
run: poetry run twine check --strict dist/*
21+
run: uv run --only-group build twine check --strict dist/*
2922
- name: Upload artifact
3023
id: artifact-upload-step
3124
uses: actions/upload-artifact@v4
@@ -73,32 +66,16 @@ jobs:
7366
steps:
7467
- uses: actions/checkout@v4
7568

69+
- name: Install uv
70+
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
7671
- name: Set up Python ${{ matrix.python-version }}
77-
uses: actions/setup-python@v4
72+
uses: actions/setup-python@v5
7873
id: setup-python
7974
with:
8075
python-version: ${{ matrix.python-version }}
8176

82-
- name: Install poetry
83-
run: |
84-
# When upgrading poetry, remember to upgrade poetry-core in `pyproject.toml` (`build-system.requires`)
85-
python -m pip install poetry==${{ env.POETRY_VERSION }}
86-
87-
- name: Configure poetry
88-
run: |
89-
python -m poetry config virtualenvs.in-project true
90-
91-
- name: Cache the virtualenv
92-
id: poetry-dependencies-cache
93-
uses: actions/cache@v3
94-
with:
95-
path: ./.venv
96-
key: ${{ runner.os }}-venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
97-
9877
- name: Install dev dependencies
99-
if: steps.poetry-dependencies-cache.outputs.cache-hit != 'true'
100-
run: |
101-
python -m poetry install --only=dev
78+
run: uv sync --only-group dev
10279

10380
- name: Download artifact
10481
uses: actions/download-artifact@v4

‎.gitignore‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ cover/
5252
# Sublime
5353
/*.sublime-*
5454

55-
#PyCharm
55+
# PyCharm
5656
/.idea
5757

58-
# Generated by the tox mypy env (poetry export)
59-
/requirements.txt
58+
/.venv

‎.pre-commit-config.yaml‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ repos:
1414
- id: ruff
1515
args: [ --fix ]
1616
- id: ruff-format
17-
- repo: https://github.com/python-poetry/poetry
18-
rev: "811a12dae0fe81f199e3f1b88b8b8be9eed543c2" # frozen: 2.4.1
17+
- repo: https://github.com/astral-sh/uv-pre-commit
18+
rev: "4f783b6470be305483837130a5be2e21ed7ff52b" # frozen: 0.12.13
1919
hooks:
20-
- id: poetry-check
21-
args: ["--lock"]
20+
- id: uv-lock

‎CONTRIBUTING.md‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
# How to setup development environment
2-
- Install poetry: https://python-poetry.org/docs/#installation
2+
- Install uv: https://docs.astral.sh/uv/getting-started/installation/
33
- (Optional) Install pre-commit: https://pre-commit.com/#install
4-
- Run `poetry install` to install dependencies
4+
- Run `uv sync` to install dependencies
55
- Run `pre-commit install` to install pre-commit hooks
66

77
# How to run tests
8-
- Run `poetry run pytest`
9-
- or run `tox`
8+
- Run `uv run pytest`
9+
- or run `tox` (or `uv run tox`)
10+
1011
# How to make a release
1112

1213
```shell
13-
python -m pip install --upgrade build twine
14-
1514
# cleanup the ./dist folder
1615
rm -rf ./dist
1716

1817
# Build the distributions
19-
python -m build
18+
uv build
2019

2120
# Upload them
22-
23-
twine upload dist/*
21+
uv run --only-group build twine upload dist/*
2422
```

‎poetry.lock‎

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

‎pyproject.toml‎

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ name = "pytest-bdd"
33
version = "8.1.0"
44
description = "BDD for pytest"
55
authors = [
6-
{name="Oleg Pidsadnyi", email="oleg.pidsadnyi@gmail.com"},
7-
{name="Anatoly Bubenkov", email="bubenkoff@gmail.com"},
6+
{ name = "Oleg Pidsadnyi", email = "oleg.pidsadnyi@gmail.com" },
7+
{ name = "Anatoly Bubenkov", email = "bubenkoff@gmail.com" },
88
]
9-
maintainers = [
10-
{name="Alessio Bogon", email="778703+youtux@users.noreply.github.com"},
11-
]
12-
license = "MIT"
9+
requires-python = ">=3.10"
1310
readme = "README.rst"
11+
license = "MIT"
12+
license-files = ["LICENSE.txt"]
13+
maintainers = [{ name = "Alessio Bogon", email = "778703+youtux@users.noreply.github.com" }]
1414
classifiers = [
1515
"Development Status :: 6 - Mature",
1616
"Intended Audience :: Developers",
@@ -29,7 +29,6 @@ classifiers = [
2929
"Programming Language :: Python :: 3.14",
3030
"Programming Language :: Python :: 3.15",
3131
]
32-
requires-python = ">=3.10"
3332
dependencies = [
3433
"Mako",
3534
"parse",
@@ -46,31 +45,34 @@ homepage = "https://pytest-bdd.readthedocs.io/"
4645
documentation = "https://pytest-bdd.readthedocs.io/"
4746
repository = "https://github.com/pytest-dev/pytest-bdd"
4847

49-
[project.entry-points."pytest11"]
50-
"pytest-bdd" = "pytest_bdd.plugin"
51-
5248
[project.scripts]
53-
"pytest-bdd" = "pytest_bdd.scripts:main"
49+
pytest-bdd = "pytest_bdd.scripts:main"
50+
51+
[project.entry-points.pytest11]
52+
pytest-bdd = "pytest_bdd.plugin"
5453

55-
[tool.poetry.group.dev.dependencies]
56-
tox = ">=4.11.3"
57-
mypy = ">=1.6.0"
58-
types-setuptools = ">=68.2.0.0"
59-
pytest-xdist = ">=3.3.1"
60-
coverage = {extras = ["toml"], version = ">=6.5.0"}
61-
Pygments = ">=2.20.0" # for code-block highlighting
62-
# Docs tooling is not needed by the CI test jobs; sphinx-autobuild pulls in
63-
# watchfiles, which does not build (yet) on pre-release pythons.
64-
sphinx = {version = "*", python = "<3.15"}
65-
sphinx-autobuild = {version = "*", python = "<3.15"}
54+
[dependency-groups]
55+
dev = [
56+
"tox>=4.22.0",
57+
"mypy>=1.6.0",
58+
"types-setuptools>=68.2.0.0",
59+
"pytest-xdist>=3.3.1",
60+
"coverage[toml]>=6.5.0",
61+
"Pygments>=2.20.0",
62+
"sphinx",
63+
"sphinx-autobuild",
64+
]
65+
build = [
66+
"build",
67+
"twine",
68+
]
6669

67-
[tool.poetry.group.build.dependencies]
68-
build = "*"
69-
twine = "*"
70+
[tool.uv]
71+
default-groups = "all"
7072

7173
[build-system]
72-
requires = ["poetry-core==2.4.1"]
73-
build-backend = "poetry.core.masonry.api"
74+
requires = ["uv_build>=0.12.13,<0.13.0"]
75+
build-backend = "uv_build"
7476

7577
[tool.ruff]
7678
line-length = 120

‎tox.ini‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,5 @@ deps =
4646
commands = {env:_PYTEST_CMD:pytest} {env:_PYTEST_MORE_ARGS:} {posargs:-vvl}
4747

4848
[testenv:mypy]
49-
deps =
50-
poetry==2.4.3
51-
poetry-plugin-export
52-
allowlist_externals = sh
53-
commands_pre =
54-
sh -c "\
55-
poetry export --only=dev --format requirements.txt > requirements.txt && \
56-
pip install -r requirements.txt && \
57-
:"
49+
dependency_groups = dev
5850
commands = mypy

0 commit comments

Comments
 (0)