Skip to content

Commit 2b92573

Browse files
Merge pull request #469 from robbievanleeuwen/feature/uv-ruff
Use uv & ruff in favour of poetry, nox, black, flake8 etc.
2 parents 9a64611 + 61926ba commit 2b92573

File tree

94 files changed

+5070
-6687
lines changed

Some content is hidden

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

94 files changed

+5070
-6687
lines changed

.darglint

-3
This file was deleted.

.flake8

-8
This file was deleted.

.github/PULL_REQUEST_TEMPLATE.md

+4-1
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/section-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

-24
This file was deleted.

.github/release-drafter.yml

+3-15
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,24 +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 contains several important bug fixes and dependency updates.
58-
59-
Python 3.9 support is dropped ahead of the upcoming 3.13 release. Python 3.13 support
60-
will be added once all the core upstream dependencies support 3.13.
61-
62-
A bug in the `CompoundGeometry` offset dilation algorithm was fixed by @connorferster,
63-
a live stream of this fix can be watched [here](https://www.youtube.com/live/hSfsojAAJjc?si=Zuwn7Mr6zXS1wHFF).
64-
65-
Most importantly a critical bug in the plastic moment calculation was found and fixed,
66-
see issue 460. Note that this bug affected plastic moment calculations for composite
67-
sections only, the plastic centroid calculation and geometric-only analyses were
68-
unaffected.
56+
Insert header here...
6957
7058
template: |
7159

.github/workflows/ci.yml

+194
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
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.27"
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
38+
39+
- name: Run pre-commit
40+
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} 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 --all-extras
61+
62+
- name: Run pyright
63+
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} 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+
- { python: "3.12", os: "ubuntu-latest", session: "tests-extended" }
85+
86+
steps:
87+
- name: Check out the repo
88+
uses: actions/checkout@v4
89+
90+
- name: Install uv version ${{ env.UV_VERSION }}
91+
uses: astral-sh/setup-uv@v3
92+
with:
93+
version: ${{ env.UV_VERSION }}
94+
enable-cache: true
95+
96+
- name: Install python ${{ matrix.python }} using uv
97+
run: uv python install ${{ matrix.python }}
98+
99+
- name: Install test dependencies
100+
if: matrix.session != 'tests-extended'
101+
run: uv sync -p ${{ matrix.python }} --frozen --extra rhino --extra dxf
102+
103+
- name: Install extended test dependencies
104+
if: matrix.session == 'tests-extended'
105+
run: uv sync -p ${{ matrix.python }} --frozen --all-extras
106+
107+
- name: Run pytest
108+
run: uv run -p ${{ matrix.python }} coverage run --parallel-mode -m pytest -m 'not benchmark_suite' --junitxml=junit.xml -o junit_family=legacy
109+
110+
- name: Upload coverage data
111+
uses: actions/upload-artifact@v4
112+
with:
113+
name: coverage-data-${{ matrix.session }}-${{ matrix.os }}-${{ matrix.python }}
114+
include-hidden-files: true
115+
path: ".coverage.*"
116+
117+
- name: Upload test results to Codecov
118+
if: matrix.session == 'tests-extended'
119+
uses: codecov/test-results-action@v1
120+
with:
121+
token: ${{ secrets.CODECOV_TOKEN }}
122+
123+
docs-build:
124+
name: docs-build
125+
runs-on: ubuntu-latest
126+
127+
steps:
128+
- name: Check out the repo
129+
uses: actions/checkout@v4
130+
131+
- name: Install uv version ${{ env.UV_VERSION }}
132+
uses: astral-sh/setup-uv@v3
133+
with:
134+
version: ${{ env.UV_VERSION }}
135+
enable-cache: true
136+
137+
- name: Install python ${{ env.DEFAULT_PYTHON_VERSION }} using uv
138+
run: uv python install ${{ env.DEFAULT_PYTHON_VERSION }}
139+
140+
- name: Install dependencies
141+
run: uv sync -p ${{ env.DEFAULT_PYTHON_VERSION }} --frozen --extra rhino --extra dxf
142+
143+
- name: Install pandoc
144+
uses: pandoc/actions/setup@v1
145+
146+
- name: Build docs
147+
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} sphinx-build --color docs docs/_build
148+
149+
- name: Upload docs
150+
uses: actions/upload-artifact@v4
151+
with:
152+
name: docs
153+
path: docs/_build
154+
155+
coverage:
156+
name: coverage
157+
runs-on: ubuntu-latest
158+
needs: tests
159+
160+
steps:
161+
- name: Check out the repo
162+
uses: actions/checkout@v4
163+
164+
- name: Install uv version ${{ env.UV_VERSION }}
165+
uses: astral-sh/setup-uv@v3
166+
with:
167+
version: ${{ env.UV_VERSION }}
168+
enable-cache: true
169+
170+
- name: Install python ${{ env.DEFAULT_PYTHON_VERSION }} using uv
171+
run: uv python install ${{ env.DEFAULT_PYTHON_VERSION }}
172+
173+
- name: Install dependencies
174+
run: uv sync -p ${{ env.DEFAULT_PYTHON_VERSION }} --frozen
175+
176+
- name: Download coverage data
177+
uses: actions/download-artifact@v4
178+
with:
179+
pattern: coverage-data-*
180+
merge-multiple: true
181+
182+
- name: Combine coverage data
183+
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} coverage combine
184+
185+
- name: Display coverage report
186+
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} coverage report -i
187+
188+
- name: Create coverage report
189+
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} coverage xml -i
190+
191+
- name: Upload coverage report
192+
uses: codecov/codecov-action@v4
193+
with:
194+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/constraints.txt

-5
This file was deleted.

.github/workflows/labeler.yml

+1-1
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

+23-30
Original file line numberDiff line numberDiff line change
@@ -5,72 +5,65 @@ on:
55
branches:
66
- master
77

8+
env:
9+
UV_VERSION: "0.4.27"
10+
DEFAULT_PYTHON_VERSION: "3.12"
11+
812
jobs:
913
release:
1014
name: Release
1115
runs-on: ubuntu-latest
16+
1217
steps:
1318
- name: Check out the repository
1419
uses: actions/checkout@v4
1520
with:
1621
fetch-depth: 2
1722

18-
- name: Set up Python
19-
uses: actions/setup-python@v5
23+
- name: Install uv version ${{ env.UV_VERSION }}
24+
uses: astral-sh/setup-uv@v3
2025
with:
21-
python-version: "3.12"
26+
version: ${{ env.UV_VERSION }}
2227

23-
- name: Upgrade pip
24-
run: |
25-
pip install --constraint=.github/workflows/constraints.txt pip
26-
pip --version
28+
- name: Install python ${{ env.DEFAULT_PYTHON_VERSION }} using uv
29+
run: uv python install ${{ env.DEFAULT_PYTHON_VERSION }}
2730

28-
- name: Install Poetry
29-
run: |
30-
pip install --constraint=.github/workflows/constraints.txt poetry
31-
poetry --version
32-
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^)"
31+
- name: Get previous commit SHA
32+
run: echo "sha=$(git rev-parse --verify --quiet HEAD^)" >> $GITHUB_ENV
3733

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

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

5750
- name: Publish package on PyPI
5851
if: steps.check-version.outputs.tag
59-
uses: pypa/gh-action-pypi-publish@v1.10.3
52+
uses: pypa/gh-action-pypi-publish@release/v1
6053
with:
6154
user: __token__
6255
password: ${{ secrets.PYPI_API_TOKEN }}
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:
6861
user: __token__
6962
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
70-
repository_url: https://test.pypi.org/legacy/
63+
repository-url: https://test.pypi.org/legacy/
7164

7265
- name: Publish the release notes
73-
uses: release-drafter/release-drafter@v6.0.0
66+
uses: release-drafter/release-drafter@v6
7467
with:
7568
publish: ${{ steps.check-version.outputs.tag != '' }}
7669
tag: ${{ steps.check-version.outputs.tag }}

0 commit comments

Comments
 (0)