Skip to content

Commit 208a8ee

Browse files
Merge pull request #141 from robbievanleeuwen/feature/uv-ruff
Use uv & ruff in favour of poetry, nox, black, flake8 etc.
2 parents 9ba26df + 8a0e157 commit 208a8ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+3565
-5467
lines changed

.darglint

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

.flake8

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

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ tick all *appropriate* boxes. But please read our
77
[contribution guide](https://github.com/robbievanleeuwen/concrete-properties/blob/master/CONTRIBUTING.md)
88
at least once, it will save you unnecessary review cycles! -->
99

10+
- [ ] Added a description of your pull request below.
1011
- [ ] Added **tests** for changed code.
1112
- [ ] Updated **documentation** for changed code.
12-
- [ ] Run the **Nox** test suite to check for errors and warnings.
13+
- [ ] Run `uv run pre-commit run --all-files` and `uv run pyright` to ensure code quality.
1314

1415
<!-- If you have *any* questions to *any* of the points above, just **submit and ask**!
1516
This checklist is here to *help* you, not to deter you from contributing! -->
17+
18+
<!-- PR descrtiption below -->

.github/dependabot.yml

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

.github/release-drafter.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ categories:
3535
- "build"
3636

3737
category-template: "### $TITLE"
38+
name-template: "v$RESOLVED_VERSION"
39+
tag-template: "v$RESOLVED_VERSION"
3840

3941
version-resolver:
4042
major:
@@ -48,13 +50,10 @@ version-resolver:
4850
- "patch"
4951
default: patch
5052

51-
exclude-contributors:
52-
- "robbievanleeuwen"
53-
5453
# Custom text at start of release
5554
header: |
5655
57-
This release adds python 3.12 support!
56+
Insert header here...
5857
5958
template: |
6059

.github/workflows/ci.yml

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types: [opened, reopened, synchronize]
9+
10+
env:
11+
UV_VERSION: "0.4.28"
12+
DEFAULT_PYTHON_VERSION: "3.12"
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
pre-commit:
20+
name: pre-commit
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Check out the repo
25+
uses: actions/checkout@v4
26+
27+
- name: Install uv version ${{ env.UV_VERSION }}
28+
uses: astral-sh/setup-uv@v3
29+
with:
30+
version: ${{ env.UV_VERSION }}
31+
enable-cache: true
32+
33+
- name: Install python ${{ env.DEFAULT_PYTHON_VERSION }} using uv
34+
run: uv python install ${{ env.DEFAULT_PYTHON_VERSION }}
35+
36+
- name: Install dependencies
37+
run: uv sync -p ${{ env.DEFAULT_PYTHON_VERSION }} --frozen --only-group lint
38+
39+
- name: Run pre-commit
40+
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} --no-sync pre-commit run --all-files --color always --show-diff-on-failure
41+
42+
type-checking:
43+
name: type-checking
44+
runs-on: ubuntu-latest
45+
46+
steps:
47+
- name: Check out the repo
48+
uses: actions/checkout@v4
49+
50+
- name: Install uv version ${{ env.UV_VERSION }}
51+
uses: astral-sh/setup-uv@v3
52+
with:
53+
version: ${{ env.UV_VERSION }}
54+
enable-cache: true
55+
56+
- name: Install python ${{ env.DEFAULT_PYTHON_VERSION }} using uv
57+
run: uv python install ${{ env.DEFAULT_PYTHON_VERSION }}
58+
59+
- name: Install dependencies
60+
run: uv sync -p ${{ env.DEFAULT_PYTHON_VERSION }} --frozen --no-group test --no-group docs
61+
62+
- name: Run pyright
63+
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} --no-sync pyright
64+
65+
tests:
66+
name: ${{ matrix.session }} ${{ matrix.python }} [${{ matrix.os }}]
67+
runs-on: ${{ matrix.os }}
68+
strategy:
69+
fail-fast: false
70+
matrix:
71+
include:
72+
- { python: "3.12", os: "ubuntu-latest", session: "tests" }
73+
- { python: "3.11", os: "ubuntu-latest", session: "tests" }
74+
- { python: "3.10", os: "ubuntu-latest", session: "tests" }
75+
- { python: "3.12", os: "windows-latest", session: "tests" }
76+
- { python: "3.11", os: "windows-latest", session: "tests" }
77+
- { python: "3.10", os: "windows-latest", session: "tests" }
78+
- { python: "3.12", os: "macos-latest", session: "tests" }
79+
- { python: "3.11", os: "macos-latest", session: "tests" }
80+
- { python: "3.10", os: "macos-latest", session: "tests" }
81+
- { python: "3.12", os: "macos-13", session: "tests" }
82+
- { python: "3.11", os: "macos-13", session: "tests" }
83+
- { python: "3.10", os: "macos-13", session: "tests" }
84+
85+
steps:
86+
- name: Check out the repo
87+
uses: actions/checkout@v4
88+
89+
- name: Install uv version ${{ env.UV_VERSION }}
90+
uses: astral-sh/setup-uv@v3
91+
with:
92+
version: ${{ env.UV_VERSION }}
93+
enable-cache: true
94+
95+
- name: Install python ${{ matrix.python }} using uv
96+
run: uv python install ${{ matrix.python }}
97+
98+
- name: Install test dependencies
99+
run: uv sync -p ${{ matrix.python }} --frozen --no-group docs --no-group lint
100+
101+
- name: Run pytest
102+
run: uv run -p ${{ matrix.python }} --no-sync coverage run --parallel-mode -m pytest
103+
104+
- name: Upload coverage data
105+
uses: actions/upload-artifact@v4
106+
with:
107+
name: coverage-data-${{ matrix.session }}-${{ matrix.os }}-${{ matrix.python }}
108+
include-hidden-files: true
109+
path: ".coverage.*"
110+
111+
docs-build:
112+
name: docs-build
113+
runs-on: ubuntu-latest
114+
115+
steps:
116+
- name: Check out the repo
117+
uses: actions/checkout@v4
118+
119+
- name: Install uv version ${{ env.UV_VERSION }}
120+
uses: astral-sh/setup-uv@v3
121+
with:
122+
version: ${{ env.UV_VERSION }}
123+
enable-cache: true
124+
125+
- name: Install python ${{ env.DEFAULT_PYTHON_VERSION }} using uv
126+
run: uv python install ${{ env.DEFAULT_PYTHON_VERSION }}
127+
128+
- name: Install dependencies
129+
run: uv sync -p ${{ env.DEFAULT_PYTHON_VERSION }} --frozen --no-group test --no-group lint
130+
131+
- name: Install pandoc
132+
uses: pandoc/actions/setup@v1
133+
134+
- name: Build docs
135+
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} --no-sync sphinx-build --color docs docs/_build
136+
137+
- name: Upload docs
138+
uses: actions/upload-artifact@v4
139+
with:
140+
name: docs
141+
path: docs/_build
142+
143+
coverage:
144+
name: coverage
145+
runs-on: ubuntu-latest
146+
needs: tests
147+
148+
steps:
149+
- name: Check out the repo
150+
uses: actions/checkout@v4
151+
152+
- name: Install uv version ${{ env.UV_VERSION }}
153+
uses: astral-sh/setup-uv@v3
154+
with:
155+
version: ${{ env.UV_VERSION }}
156+
enable-cache: true
157+
158+
- name: Install python ${{ env.DEFAULT_PYTHON_VERSION }} using uv
159+
run: uv python install ${{ env.DEFAULT_PYTHON_VERSION }}
160+
161+
- name: Install dependencies
162+
run: uv sync -p ${{ env.DEFAULT_PYTHON_VERSION }} --frozen --only-group test
163+
164+
- name: Download coverage data
165+
uses: actions/download-artifact@v4
166+
with:
167+
pattern: coverage-data-*
168+
merge-multiple: true
169+
170+
- name: Combine coverage data
171+
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} --no-sync coverage combine
172+
173+
- name: Display coverage report
174+
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} --no-sync coverage report -i
175+
176+
- name: Create coverage report
177+
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} --no-sync coverage xml -i
178+
179+
- name: Upload coverage report
180+
uses: codecov/codecov-action@v4
181+
with:
182+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/constraints.txt

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

.github/workflows/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ jobs:
1313
uses: actions/checkout@v4
1414

1515
- name: Run Labeler
16-
uses: crazy-max/ghaction-github-labeler@v5.0.0
16+
uses: crazy-max/ghaction-github-labeler@v5
1717
with:
1818
skip-delete: true

.github/workflows/release.yml

Lines changed: 26 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,72 +5,63 @@ on:
55
branches:
66
- master
77

8+
env:
9+
UV_VERSION: "0.4.28"
10+
DEFAULT_PYTHON_VERSION: "3.12"
11+
812
jobs:
913
release:
1014
name: Release
1115
runs-on: ubuntu-latest
16+
permissions:
17+
id-token: write
18+
contents: write
19+
1220
steps:
1321
- name: Check out the repository
1422
uses: actions/checkout@v4
1523
with:
1624
fetch-depth: 2
1725

18-
- name: Set up Python
19-
uses: actions/setup-python@v5
26+
- name: Install uv version ${{ env.UV_VERSION }}
27+
uses: astral-sh/setup-uv@v3
2028
with:
21-
python-version: "3.11"
22-
23-
- name: Upgrade pip
24-
run: |
25-
pip install --constraint=.github/workflows/constraints.txt pip
26-
pip --version
29+
version: ${{ env.UV_VERSION }}
2730

28-
- name: Install Poetry
29-
run: |
30-
pip install --constraint=.github/workflows/constraints.txt poetry
31-
poetry --version
31+
- name: Install python ${{ env.DEFAULT_PYTHON_VERSION }} using uv
32+
run: uv python install ${{ env.DEFAULT_PYTHON_VERSION }}
3233

33-
- name: Check if there is a parent commit
34-
id: check-parent-commit
35-
run: |
36-
echo "::set-output name=sha::$(git rev-parse --verify --quiet HEAD^)"
34+
- name: Get previous commit SHA
35+
run: echo "sha=$(git rev-parse --verify --quiet HEAD^)" >> $GITHUB_ENV
3736

3837
- name: Detect and tag new version
3938
id: check-version
40-
if: steps.check-parent-commit.outputs.sha
41-
uses: salsify/action-detect-and-tag-new-version@v2.0.3
39+
if: ${{ env.sha }}
40+
uses: salsify/action-detect-and-tag-new-version@v2
4241
with:
43-
version-command: |
44-
bash -o pipefail -c "poetry version | awk '{ print \$2 }'"
42+
version-command: echo $(grep "^version =" pyproject.toml | sed 's/version = "\(.*\)"/\1/')
4543

46-
- name: Bump version for developmental release
44+
- name: Bump version for dev release
4745
if: "! steps.check-version.outputs.tag"
4846
run: |
49-
poetry version patch &&
50-
version=$(poetry version | awk '{ print $2 }') &&
51-
poetry version $version.dev.$(date +%s)
47+
VERSION=$(grep "^version =" pyproject.toml | sed 's/version = "\(.*\)"/\1/')
48+
uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version $VERSION.dev.$(date +%s)
5249
5350
- name: Build package
54-
run: |
55-
poetry build --ansi
51+
run: uv build
5652

5753
- name: Publish package on PyPI
5854
if: steps.check-version.outputs.tag
59-
uses: pypa/[email protected]
60-
with:
61-
user: __token__
62-
password: ${{ secrets.PYPI_API_TOKEN }}
55+
uses: pypa/gh-action-pypi-publish@release/v1
6356

6457
- name: Publish package on TestPyPI
6558
if: "! steps.check-version.outputs.tag"
66-
uses: pypa/gh-action-pypi-publish@v1.10.3
59+
uses: pypa/gh-action-pypi-publish@release/v1
6760
with:
68-
user: __token__
69-
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
70-
repository_url: https://test.pypi.org/legacy/
61+
repository-url: https://test.pypi.org/legacy/
7162

7263
- name: Publish the release notes
73-
uses: release-drafter/release-drafter@v6.0.0
64+
uses: release-drafter/release-drafter@v6
7465
with:
7566
publish: ${{ steps.check-version.outputs.tag != '' }}
7667
tag: ${{ steps.check-version.outputs.tag }}

0 commit comments

Comments
 (0)