Skip to content

Commit 5a65e76

Browse files
takiscodingjoe
andauthored
Migrate to PEP 517 build frontend for packaging (#278)
* Drop Python 3.9 support * Update build workflow * Update release workflow --------- Co-authored-by: Johannes Maron <[email protected]>
1 parent 297501b commit 5a65e76

18 files changed

+225
-314
lines changed

.editorconfig

+1-21
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,12 @@ trim_trailing_whitespace = true
1111
[*.py]
1212
indent_style = space
1313
indent_size = 4
14-
# isort config
15-
atomic = true
16-
multi_line_output = 5
17-
line_length = 79
18-
combine_as_imports = true
19-
skip = wsgi.py,docs,.tox,env
20-
known_first_party = vies,tests
21-
known_third_party = django
2214

2315

2416
[*.{rst,ini}]
2517
indent_style = space
2618
indent_size = 4
2719

28-
[*.{yml,yaml,html,xml,xsl,json}]
20+
[*.{yml,yaml,html,xml,xsl,json,toml}]
2921
indent_style = space
3022
indent_size = 2
31-
32-
[*.{css,less}]
33-
indent_style = space
34-
indent_size = 2
35-
36-
[*.{js,coffee}]
37-
indent_style = space
38-
indent_size = 4
39-
40-
[Makefile]
41-
indent_style = tab
42-
indent_size = 1

.github/workflows/ci.yml

+27-62
Original file line numberDiff line numberDiff line change
@@ -2,71 +2,40 @@ name: CI
22
on:
33
push:
44
branches:
5-
- master
5+
- main
66
pull_request:
77

88
jobs:
99

10-
analyze:
11-
name: CodeQL
12-
runs-on: ubuntu-latest
13-
steps:
14-
- name: Checkout repository
15-
uses: actions/checkout@v4
16-
- name: Initialize CodeQL
17-
uses: github/codeql-action/init@v3
18-
with:
19-
languages: python
20-
- name: Perform CodeQL Analysis
21-
uses: github/codeql-action/analyze@v3
22-
23-
msgcheck:
24-
runs-on: ubuntu-latest
25-
steps:
26-
- uses: actions/[email protected]
27-
- uses: actions/checkout@v4
28-
- run: sudo apt install -y gettext aspell libenchant-2-dev
29-
- uses: actions/cache@v4
30-
with:
31-
path: ~/.cache/pip
32-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
33-
restore-keys: |
34-
${{ runner.os }}-pip-
35-
- run: python -m pip install -r requirements.txt
36-
- run: msgcheck -n vies/locale/*/LC_MESSAGES/*.po
37-
3810
lint:
11+
runs-on: ubuntu-latest
3912
strategy:
40-
fail-fast: false
4113
matrix:
4214
lint-command:
43-
- "bandit -r vies -x tests"
44-
- "black --check --diff ."
45-
- "flake8 ."
46-
- "isort --check-only --diff ."
47-
- "pydocstyle ."
48-
runs-on: ubuntu-latest
15+
- "ruff format --check --diff ."
16+
- "ruff check --output-format=github ."
17+
- "msgcheck -n vies/locale/*/LC_MESSAGES/*.po"
4918
steps:
50-
- uses: actions/[email protected]
5119
- uses: actions/checkout@v4
52-
- uses: actions/cache@v4
20+
- run: sudo apt install -y gettext aspell libenchant-2-dev
21+
- uses: actions/setup-python@v5
5322
with:
54-
path: ~/.cache/pip
55-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
56-
restore-keys: |
57-
${{ runner.os }}-pip-
58-
- run: python -m pip install -r requirements.txt
23+
python-version: "3.x"
24+
cache: 'pip'
25+
cache-dependency-path: 'pyproject.toml'
26+
- run: python -m pip install -e .[lint]
5927
- run: ${{ matrix.lint-command }}
6028

61-
readme:
29+
dist:
6230
runs-on: ubuntu-latest
6331
steps:
64-
- run: sudo apt install -y gettext
65-
- uses: actions/[email protected]
6632
- uses: actions/checkout@v4
67-
- name: Install Python dependencies
68-
run: python -m pip install --upgrade pip setuptools wheel twine readme-renderer
69-
- run: python setup.py sdist bdist_wheel
33+
- run: sudo apt install -y gettext
34+
- uses: actions/setup-python@v5
35+
with:
36+
python-version: "3.x"
37+
- run: python -m pip install --upgrade pip build twine
38+
- run: python -m build --sdist --wheel
7039
- run: python -m twine check dist/*
7140
- uses: actions/upload-artifact@v4
7241
with:
@@ -75,6 +44,7 @@ jobs:
7544
pytest:
7645
needs:
7746
- lint
47+
- dist
7848
strategy:
7949
matrix:
8050
os:
@@ -88,22 +58,17 @@ jobs:
8858
- "4.2"
8959
- "5.1"
9060
- "5.2"
91-
exclude:
92-
# Django 5.x requires Python ≥ 3.10
93-
- python-version: "3.9"
94-
django-version: "5.1"
95-
- python-version: "3.9"
96-
django-version: "5.2"
9761
runs-on: ${{ matrix.os }}
9862
steps:
63+
- uses: actions/checkout@v4
64+
- run: sudo apt install -y gettext
9965
- name: Set up Python ${{ matrix.python-version }}
100-
uses: actions/setup-python@v5.6.0
66+
uses: actions/setup-python@v5
10167
with:
10268
python-version: ${{ matrix.python-version }}
103-
- uses: actions/checkout@v4
104-
- run: python -m pip install --upgrade setuptools wheel codecov pytest pytest-cov pytest-django zeep
105-
- run: python -m pip install django~=${{ matrix.django-version }}
69+
- run: python -m pip install .[test]
70+
- run: python -m pip install django~=${{ matrix.django-version }}.0
10671
- run: python -m pytest
107-
- run: codecov
108-
env:
109-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
72+
- uses: codecov/codecov-action@v5
73+
with:
74+
flags: py${{ matrix.python-version }}-dj${{ matrix.django-version }}

.github/workflows/release.yml

+31-12
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,39 @@ name: Release
33
on:
44
release:
55
types: [published]
6+
workflow_dispatch:
7+
8+
permissions:
9+
id-token: write
610

711
jobs:
8-
PyPI:
12+
13+
release-build:
914
runs-on: ubuntu-latest
15+
1016
steps:
11-
- run: sudo apt install -y gettext
1217
- uses: actions/checkout@v4
13-
- uses: actions/[email protected]
14-
- name: Install Python dependencies
15-
run: python -m pip install --upgrade pip setuptools wheel twine
16-
- name: Build dist packages
17-
run: python setup.py sdist bdist_wheel
18-
- name: Upload packages
19-
run: python -m twine upload dist/*
20-
env:
21-
TWINE_USERNAME: __token__
22-
TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }}
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.x"
21+
- run: sudo apt update && sudo apt install -y gettext
22+
- run: python -m pip install --upgrade pip build wheel
23+
- run: python -m build --sdist --wheel
24+
- uses: actions/upload-artifact@v4
25+
with:
26+
name: release-dists
27+
path: dist/
28+
29+
pypi-publish:
30+
runs-on: ubuntu-latest
31+
needs:
32+
- release-build
33+
permissions:
34+
id-token: write
35+
36+
steps:
37+
- uses: actions/download-artifact@v4
38+
with:
39+
name: release-dists
40+
path: dist/
41+
- uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ lib/
1313
docs/_build/
1414
.coverage
1515
htmlcov/
16+
_version.py

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
include README.rst
2+
include LICENSE
23
include vies/locale/*/LC_MESSAGES/django.mo
34
exclude .*
45
exclude CONTRIBUTING.md

pyproject.toml

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
[build-system]
2+
requires = ["flit_core>=3.2", "flit-gettext[scm]", "wheel"]
3+
build-backend = "flit_gettext.scm"
4+
5+
[project]
6+
name = "django-vies"
7+
readme = "README.rst"
8+
license = "MIT"
9+
authors = [{ name = "Johannes Hoppe", email = "[email protected]" }]
10+
requires-python = ">=3.10"
11+
dependencies = [
12+
"Django>=4.2",
13+
"retrying>=1.1.0",
14+
"zeep>=2.5.0",
15+
]
16+
dynamic = ["version", "description"]
17+
classifiers = [
18+
"Development Status :: 5 - Production/Stable",
19+
"Environment :: Web Environment",
20+
"Operating System :: OS Independent",
21+
"Intended Audience :: Developers",
22+
"Intended Audience :: Financial and Insurance Industry",
23+
"Programming Language :: Python :: 3",
24+
"Programming Language :: Python :: 3 :: Only",
25+
"Programming Language :: Python :: 3.10",
26+
"Programming Language :: Python :: 3.11",
27+
"Programming Language :: Python :: 3.12",
28+
"Programming Language :: Python :: 3.13",
29+
"Framework :: Django",
30+
"Framework :: Django :: 4.2",
31+
"Framework :: Django :: 5.1",
32+
"Framework :: Django :: 5.2",
33+
"Topic :: Software Development",
34+
"Topic :: Office/Business :: Financial :: Accounting",
35+
]
36+
37+
[project.optional-dependencies]
38+
test = [
39+
"pytest",
40+
"pytest-cov",
41+
"pytest-django",
42+
]
43+
lint = [
44+
"ruff==0.11.7",
45+
"msgcheck==4.1.0",
46+
]
47+
48+
[tool.flit.module]
49+
name = "vies"
50+
51+
[tool.setuptools_scm]
52+
write_to = "vies/_version.py"
53+
54+
[tool.pytest.ini_options]
55+
norecursedirs = ["venv", "env", ".eggs"]
56+
addopts = "--cov=vies"
57+
DJANGO_SETTINGS_MODULE = "tests.testapp.settings"
58+
59+
[tool.coverage.run]
60+
source = ["."]
61+
omit = [
62+
"*/migrations/*",
63+
"*/tests/*",
64+
"*/test_*.py",
65+
".tox",
66+
]
67+
68+
[tool.coverage.report]
69+
show_missing = true
70+
71+
[tool.ruff]
72+
line-length = 88
73+
target-version = "py39"
74+
75+
[tool.ruff.lint]
76+
select = [
77+
"D", # pydocstyle
78+
"E", # pycodestyle errors
79+
"EXE", # flake8-executable
80+
"F", # pyflakes
81+
"I", # isort
82+
"S", # flake8-bandit
83+
"SIM", # flake8-simplify
84+
"UP", # pyupgrade
85+
"W", # pycodestyle warnings
86+
]
87+
ignore = ["D1", "PT004"]
88+
89+
[tool.ruff.lint.per-file-ignores]
90+
"tests/*.py" = ["S101", "S105", "PLR2004"]
91+
92+
[tool.ruff.lint.isort]
93+
known-first-party = ["measurement", "tests"]
94+

requirements.txt

-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +0,0 @@
1-
bandit==1.8.3
2-
black==25.1.0
3-
flake8==7.2.0
4-
isort==6.0.1
5-
msgcheck==4.1.0
6-
pydocstyle==6.3.0

0 commit comments

Comments
 (0)