Skip to content

Commit 285498d

Browse files
committed
🛠️️ Move to UV and Ruff
1 parent 4aa2fa6 commit 285498d

File tree

2 files changed

+104
-81
lines changed

2 files changed

+104
-81
lines changed

.github/workflows/ci.yml

+63-53
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,60 @@ jobs:
1212
lint:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v2
16-
- uses: actions/setup-python@v2
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-python@v5
1717
with:
18-
python-version: '3.9'
18+
python-version: '3.13'
1919

20-
- name: Install Poetry
21-
uses: snok/install-poetry@v1.4.1
20+
- name: Install UV
21+
uses: astral-sh/setup-uv@v3
2222
with:
23-
virtualenvs-create: false
24-
version: 1.1.15
23+
enable-cache: true
24+
cache-suffix: "${{ matrix.os }}-${{ matrix.python-version }}"
25+
cache-dependency-glob: "**/pyproject.toml"
2526

26-
- name: Load cached wheels
27-
id: cached-pip-wheels
28-
uses: actions/cache@v2
27+
- name: Install dependencies
28+
run: uv sync --extra typing
29+
30+
- name: check
31+
run: uv run ruff check parametrize
32+
33+
- name: format
34+
run: uv run ruff format parametrize
35+
36+
37+
type-check:
38+
needs: lint
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
43+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
44+
defaults:
45+
run:
46+
shell: bash # required for windows
47+
runs-on: ${{ matrix.os }}
48+
steps:
49+
- name: Check out repository
50+
uses: actions/checkout@v4
51+
52+
- name: Setup Python ${{ matrix.python-version }}
53+
uses: actions/setup-python@v5
2954
with:
30-
path: |
31-
~/cache
32-
poetry.lock
33-
key: venv-${{ runner.os }}-${{ hashFiles('**/pyproject.toml') }}
55+
python-version: ${{ matrix.python-version }}
56+
57+
- name: Install UV
58+
uses: astral-sh/setup-uv@v3
59+
with:
60+
enable-cache: true
61+
cache-suffix: "${{ matrix.os }}-${{ matrix.python-version }}"
62+
cache-dependency-glob: "**/pyproject.toml"
3463

3564
- name: Install dependencies
36-
run: poetry install --no-interaction --no-root
65+
run: uv sync --extra typing
3766

38-
- name: flake8
39-
run: flake8 parametrize tests
67+
- name: Run MyPy
68+
run: uv run mypy parametrize
4069

4170
test:
4271
needs: lint
@@ -51,65 +80,46 @@ jobs:
5180
runs-on: ${{ matrix.os }}
5281
steps:
5382
- name: Check out repository
54-
uses: actions/checkout@v2
83+
uses: actions/checkout@v4
5584

5685
- name: Set up python ${{ matrix.python-version }}
57-
uses: actions/setup-python@v2
86+
uses: actions/setup-python@v5
5887
with:
5988
python-version: ${{ matrix.python-version }}
6089

61-
- name: Install Poetry
62-
uses: snok/install-poetry@v1.4.1
63-
with:
64-
virtualenvs-create: false
65-
version: 1.1.15
66-
67-
- name: Load cached wheels
68-
id: cached-pip-wheels
69-
uses: actions/cache@v2
90+
- name: Install uv
91+
uses: astral-sh/setup-uv@v3
7092
with:
71-
path: |
72-
~/cache
73-
poetry.lock
74-
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
93+
enable-cache: true
94+
cache-suffix: "${{ matrix.os }}-${{ matrix.python-version }}"
95+
cache-dependency-glob: "**/pyproject.toml"
7596

7697
- name: Install dependencies
77-
run: poetry install --no-interaction --no-root
78-
79-
- name: Run mypy
80-
run: mypy parametrize
98+
run: uv sync --extra test
8199

82100
- name: Run tests
83101
run: pytest tests --cov=parametrize
84102

85-
86103
deploy:
87104
needs: test
88105
if: "success() && startsWith(github.ref, 'refs/tags/')"
89106
runs-on: ubuntu-latest
90107
steps:
91-
- uses: actions/checkout@v2
92-
- uses: actions/setup-python@v2
108+
- uses: actions/checkout@v4
109+
- uses: actions/setup-python@v5
93110
with:
94-
python-version: '3.9'
111+
python-version: '3.13'
95112

96-
- name: Install Poetry
97-
uses: snok/install-poetry@v1.4.1
98-
with:
99-
virtualenvs-create: false
100-
version: 1.1.15
101-
102-
- name: Install poetry-dynamic-versioning
103-
run: python -m pip install poetry-dynamic-versioning
104-
105-
- name: Bump version
106-
run: poetry-dynamic-versioning
113+
- name: Build
114+
run: uv build
107115

108116
- name: Generate Changelog
109117
run: python tools/get_changes.py ${{ github.ref }} > changelog.txt
110118

111-
- name: Upload to pypi
112-
run: poetry publish --build --username __token__ --password ${{ secrets.PYPI_TOKEN }}
119+
- name: Upload to PyPI
120+
env:
121+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
122+
run: uv publish
113123

114124
- name: Release
115125
uses: softprops/action-gh-release@v1

pyproject.toml

+41-28
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
[tool.poetry]
1+
2+
[project]
23
name = "parametrize"
3-
version = "0.0.0"
44
description = "Drop-in @pytest.mark.parametrize replacement working with unittest.TestCase"
5-
authors = ["Bobronium <appkiller16@gmail.com>"]
6-
license = "MIT"
5+
authors = [
6+
{name = "Bobronium", email = "write@bobronium.me"}
7+
]
8+
dynamic = ["version"]
9+
license = {text = "MIT"}
10+
requires-python = ">=3.6"
711
readme = "readme.md"
8-
repository = "https://github.com/Bobronium/parametrize/"
12+
keywords = ["pytest", "parametrize", "unittest"]
13+
homepage = "https://github.com/Bobronium/parametrize/"
914
classifiers = [
1015
"Development Status :: 3 - Alpha",
1116
"Framework :: Pytest",
@@ -28,34 +33,42 @@ classifiers = [
2833
"Typing :: Typed",
2934
]
3035

31-
[tool.black]
32-
target_version = ["py36", "py37", "py38", "py39"]
36+
[tool.ruff]
37+
target-version = "py37" # technically it should be py36, but ruff doesn't support it
3338
line-length = 100
3439

35-
[tool.poetry-dynamic-versioning]
36-
vcs = "git"
37-
style = "semver"
40+
[tool.ruff.lint]
41+
select = ["E4", "E7", "E9", "F", "B", "Q"]
3842

39-
[tool.poetry.dependencies]
40-
python = "^3.6.2"
4143

42-
[tool.poetry.dev-dependencies]
43-
black = "^21.4b2"
44-
isort = "^5.8.0"
45-
mypy = "^0.971"
44+
[tool.uv-dynamic-versioning]
45+
vcs = "git"
46+
style = "semver"
4647

47-
flake8 = "^3.9.1"
48-
flake8-use-fstring = "^1.1"
49-
flake8-comprehensions = "^3.4.0"
50-
flake8-bugbear = "^21.4.3"
51-
flake8-black = "^0.2.1"
52-
flake8-isort = "^4.0.0"
48+
[project.optional-dependencies]
49+
typing = [
50+
"mypy==0.971",
51+
]
52+
test = [
53+
"pytest-cov>=2.11.1",
54+
"pytest-sugar>=0.9.4",
55+
"pytest-mock>=3.6.0"
56+
]
57+
lint = [
58+
"ruff",
59+
]
60+
dev = [
61+
"parametrize[lint,typing,test]"
62+
]
5363

54-
pytest = "^6.2.3"
55-
pytest-cov = "^2.11.1"
56-
pytest-sugar = "^0.9.4"
57-
pytest-mock = "^3.6.0"
64+
[tool.setuptools.dynamic]
65+
version = {vcs = "git", style = "semver"}
5866

5967
[build-system]
60-
requires = ["poetry-core>=1.0.0"]
61-
build-backend = "poetry.core.masonry.api"
68+
requires = ["hatchling", "uv-dynamic-versioning"]
69+
build-backend = "hatchling.build"
70+
71+
[tool.hatch.version]
72+
source = "uv-dynamic-versioning"
73+
vcs = "git"
74+
style = "semver"

0 commit comments

Comments
 (0)