Skip to content

Commit 9132ee4

Browse files
authored
chore: update tooling (#1381)
* chore: update tooling - Replace poetry with uv - Replace build backend with setuptools - Add flake for nix support - Add poe for task running (not supported by uv yet) - Implement ruff for linting * chore: add pre-commit hooks * ci(lint-test): update job names
1 parent 94a1eea commit 9132ee4

File tree

12 files changed

+1394
-1712
lines changed

12 files changed

+1394
-1712
lines changed

.envrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
watch_file flake.nix
2+
watch_file pyproject.toml
3+
4+
use flake

.github/workflows/cd-pypi.yml

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,22 @@
11
name: "CD: PyPI"
22
on:
33
release:
4-
types: [created]
4+
types: [published]
55
jobs:
66
release:
77
name: Release
88
runs-on: ubuntu-latest
9+
permissions:
10+
id-token: write
911
defaults:
1012
run:
1113
shell: bash
12-
strategy:
13-
matrix:
14-
python: [3.9]
1514
steps:
1615
- name: "[INIT] Checkout repository"
17-
uses: actions/checkout@v2
18-
- name: "[INIT] Install Python ${{ matrix.python }}"
19-
uses: actions/setup-python@v2
20-
with:
21-
python-version: ${{ matrix.python }}
22-
- name: "[INIT] Install Poetry"
23-
uses: snok/install-poetry@v1.3
24-
- name: "[INIT] Restore dependency cache"
25-
id: cache-restore
26-
uses: actions/cache@v2
27-
with:
28-
path: |
29-
~/.cache/pip
30-
~/.cache/pypoetry
31-
key: ${{ runner.os }}-py${{ matrix.python }}-${{ hashFiles('**/poetry.lock') }}
32-
- name: "[INIT] Install dependencies"
33-
if: ${{ !steps.cache-restore.outputs.cache-hit }}
34-
run: pip install poetry && poetry install
35-
- name: "[EXEC] Build"
36-
run: poetry build
37-
- name: "[EXEC] Publish to PyPI"
38-
run: poetry run twine upload dist/*
39-
env:
40-
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
41-
TWINE_PASSWORD: ${{ secrets.PYPI_PASS }}
16+
uses: actions/checkout@v4
17+
- name: "[INIT] Install uv"
18+
uses: astral-sh/setup-uv@v5
19+
- name: "[EXEC] Build project"
20+
run: uv build
21+
- name: "[EXEC] Publish package"
22+
run: uv publish

.github/workflows/ci-lint-test.yml

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,60 +14,41 @@ jobs:
1414
steps:
1515
- name: "[INIT] Checkout repository"
1616
uses: actions/checkout@v3
17-
- name: "[INIT] Install Python ${{ matrix.python }}"
18-
uses: actions/setup-python@v4
17+
- name: "[INIT] Install uv"
18+
uses: astral-sh/setup-uv@v5
1919
with:
20-
python-version: ${{ matrix.python }}
21-
- name: "[INIT] Install Poetry"
22-
uses: snok/install-poetry@v1.3
23-
- name: "[INIT] Restore dependency cache"
24-
id: cache-restore
25-
uses: actions/cache@v3
26-
with:
27-
path: |
28-
~/.cache/pip
29-
~/.cache/pypoetry
30-
key: ${{ runner.os }}-py${{ matrix.python }}-${{ hashFiles('**/poetry.lock') }}
20+
enable-cache: true
3121
- name: "[INIT] Install dependencies"
32-
if: ${{ !steps.cache-restore.outputs.cache-hit }}
33-
run: pip install poetry && poetry install
22+
run: uv sync --locked --all-extras --dev
3423
- name: "[EXEC] Lint"
35-
run: ./utils ci lint
24+
run: uv run poe lint
3625
test-cover:
3726
name: Test & Cover
3827
if: "!(contains(github.event.head_commit.message, '[skip_ci]'))"
3928
runs-on: ${{ matrix.os }}
29+
permissions:
30+
id-token: write
4031
defaults:
4132
run:
4233
shell: bash
4334
strategy:
4435
matrix:
45-
python: ["3.8", "3.9", "3.10", "pypy3.9", "pypy3.10"]
46-
os: [ubuntu-22.04, macos-12, windows-2022]
36+
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
37+
os: [ubuntu-latest, macos-latest, windows-latest]
4738
steps:
4839
- name: "[INIT] Checkout repository"
4940
uses: actions/checkout@v3
50-
- name: "[INIT] Install Python ${{ matrix.python }}"
51-
uses: actions/setup-python@v4
52-
with:
53-
python-version: ${{ matrix.python }}
54-
- name: "[INIT] Install Poetry"
55-
uses: snok/install-poetry@v1.3
56-
- name: "[INIT] Restore dependency cache"
57-
id: cache-restore
58-
uses: actions/cache@v3
41+
- name: "[INIT] Install uv"
42+
uses: astral-sh/setup-uv@v5
5943
with:
60-
path: |
61-
~/.cache/pip
62-
~/.cache/pypoetry
63-
key: ${{ runner.os }}-py${{ matrix.python }}-${{ hashFiles('**/poetry.lock') }}
44+
enable-cache: true
6445
- name: "[INIT] Install dependencies"
65-
if: ${{ !steps.cache-restore.outputs.cache-hit }}
66-
run: pip install poetry && poetry install
46+
run: uv sync --locked --all-extras --dev --group test
6747
- name: "[EXEC] Test"
68-
run: ./utils ci test --coverage
48+
run: uv run poe test-cover
6949
- name: "[EXEC] Upload coverage to Codecov"
70-
uses: codecov/codecov-action@v3
50+
uses: codecov/codecov-action@v5
7151
with:
7252
fail_ci_if_error: true
7353
flags: ${{ matrix.os }},py${{ matrix.python }}
54+
use_oidc: true

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ build/*
1010
*.egg
1111
*.rdb
1212
.coverage
13+
coverage.lcov
1314
proselint/proselint_develop.sublime-project
1415
proselint/proselint_develop.sublime-workspace
1516
corpora/*
1617
!corpora/README.md
1718
dist/
1819
*.pstore
20+
.pre-commit-config.yaml

.ruff.toml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
2+
line-length = 80
3+
target-version = "py39"
4+
5+
[lint]
6+
select = [
7+
"A", # flake8-builtins
8+
"ANN", # flake8-annotations
9+
"ARG", # flake8-unused-arguments
10+
"B", # Bugbear
11+
"C",
12+
"COM", # flake8-commas
13+
# "CPY", # flake8-copyright
14+
"C4", # flake8-comprehensions
15+
"DTZ", # flake8-datetimez
16+
"D", # pydocstyle
17+
"E", # pycodestyle errors
18+
# "ERA", # eradicate commented out code
19+
"F", # pyflakes
20+
"FA", # flake8-future-annotations
21+
"FBT", # boolean traps
22+
"FLY", # flynt
23+
"FURB", # refurb
24+
"G", # flake8-logging-format
25+
"I", # incomplete isort
26+
"INP", # flake8-no-pep420
27+
"LOG", # flake8-logging
28+
"N", # naming
29+
"NPY", # NumPy-specific rules
30+
"PD", # pandas-vet
31+
"PERF", # Perflint
32+
"PL", # Pylint
33+
"PTH", # flake8-use-pathlib
34+
"PYI", # flake8-pyi
35+
"RET", # flake8-return
36+
"RUF", # Ruff-specific rules
37+
"S", # bandit, security
38+
"SLF", # flake8-self
39+
"SIM", # flake8-simplify
40+
"TID", # flake8-tidy-imports
41+
"TCH", # flake8-type-checking
42+
"T10", # flake8-print
43+
"UP", # pyupgrade
44+
"W", # pycodestyle warnings
45+
"YTT", # flake8-2020
46+
]
47+
ignore = [
48+
"PLR2004", # magic values
49+
"COM812", # trailing comma -> done by formatter
50+
"D203", # no blank lines between classes and documentation
51+
"D212", # consistent start level for multi-line edocumentation
52+
"D415", # first line of docs should end with a period
53+
# TODO: below is temporary
54+
55+
]
56+
preview = true
57+
58+
[lint.per-file-ignores]
59+
"tests/**" = ["S", "N8", "SLF001", "PLR", "PLC2701"]
60+
"scripts/**" = ["E501", "DTZ005"]
61+
"proselint/checks/**" = ["RUF001"]
62+
"plugins/**" = ["INP001", "RUF012"]
63+
"scripts_web/**" = ["S1", "SIM", "RET", "TCH"]
64+
65+
[lint.mccabe]
66+
# Unlike Flake8, default to a complexity level of 10.
67+
max-complexity = 11
68+
69+
[lint.pyupgrade]
70+
keep-runtime-typing = true
71+
72+
[format]
73+
# per default like Black
74+
#preview = true

MANIFEST.in

Lines changed: 0 additions & 1 deletion
This file was deleted.

flake.lock

Lines changed: 156 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)