Skip to content

Commit 63a151f

Browse files
author
Zoran Simic
committed
Use trusted publishing, modernized linter setup
1 parent bc8f1dd commit 63a151f

File tree

3 files changed

+14
-36
lines changed

3 files changed

+14
-36
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ jobs:
99
publish:
1010

1111
runs-on: ubuntu-latest
12+
environment: release
13+
permissions:
14+
id-token: write # mandatory for trusted publishing
1215

1316
steps:
1417
- uses: actions/checkout@v4
1518
- uses: actions/setup-python@v5
1619
with:
1720
python-version: "3.11"
1821

19-
- run: pip install -U pip setuptools wheel twine 'tox<4'
22+
- run: pip install -U pip setuptools wheel tox
2023
- run: tox -e py,docs,style
2124
- run: python setup.py sdist bdist_wheel
2225

23-
- name: Publish sdist and wheel
24-
env:
25-
TWINE_USERNAME: __token__
26-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
27-
run: twine upload --non-interactive dist/*
26+
- name: Publish to PyPI
27+
uses: pypa/gh-action-pypi-publish@release/v1

pyproject.toml

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[build-system]
22
requires = ["setuptools", "wheel"]
3+
build-backend = "setuptools.build_meta"
34

45
[tool.ruff]
56
cache-dir = ".tox/.ruff_cache"
@@ -9,7 +10,7 @@ src = ["src", "tests"]
910
[tool.ruff.lint]
1011
extend-select = [
1112
"A", # flake8-builtins
12-
# "ARG", # flake8-unused-arguments
13+
"ARG", # flake8-unused-arguments
1314
"B", # flake8-bugbear
1415
"C4", # flake8-comprehensions
1516
"C90", # mccabe
@@ -33,33 +34,16 @@ extend-select = [
3334
"RET", # flake8-return
3435
"RUF", # ruff-specific
3536
"S", # flake8-bandit
36-
# "SIM", # flake8-simplify
37+
"SIM", # flake8-simplify
3738
"SLF", # flake8-self
3839
"SLOT", # flake8-slots
3940
"T10", # flake8-debugger
4041
"TID", # flake8-tidy-imports
4142
"TCH", # flake8-type-checking
42-
# "TD", # flake8-todos
43+
"TD", # flake8-todos
4344
"TRY", # tryceratops
4445
"W", # pycodestyle warnings
4546
]
46-
ignore = [
47-
# TODO: gradually remove these (document all the things)
48-
"D100", # Missing docstring in public module
49-
"D101", # Missing docstring in public class
50-
"D102", # Missing docstring in public method
51-
"D103", # Missing docstring in public function
52-
"D104", # Missing docstring in public package
53-
"D105", # Missing docstring in magic method
54-
"D200", # One-line docstring should fit on one line with quotes
55-
"D205", # 1 blank line required between summary line and description
56-
"D400", # First line should end with a period
57-
# Not useful:
58-
"RET503", # Missing explicit `return` at the end of function able to return non-`None` value
59-
]
60-
61-
[tool.ruff.lint.flake8-builtins]
62-
builtins-ignorelist = ["bin", "compile"]
6347

6448
[tool.ruff.lint.isort]
6549
order-by-type = false
@@ -69,8 +53,3 @@ max-complexity = 14
6953

7054
[tool.ruff.lint.pydocstyle]
7155
convention = "numpy"
72-
73-
[tool.ruff.lint.per-file-ignores]
74-
"tests/*" = [
75-
"S", # No security checks for tests
76-
]

tox.ini

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ setenv = COVERAGE_FILE={toxworkdir}/.coverage.{envname}
77
usedevelop = True
88
deps = -rrequirements.txt
99
-rtests/requirements.txt
10-
commands = pytest {posargs:-vv --cov=src/ --cov-report=xml tests/}
10+
commands = pytest {posargs:-vv --cov=src/ --cov=tests/ --cov-report=xml tests/}
1111

1212
[testenv:coverage]
1313
setenv = COVERAGE_FILE={toxworkdir}/.coverage
@@ -21,15 +21,14 @@ commands = coverage combine
2121
[testenv:style]
2222
skip_install = True
2323
deps = ruff
24-
commands = ruff check --diff
25-
ruff check --output-format=full
24+
commands = ruff check
2625
ruff format --diff
2726

2827
[testenv:reformat]
2928
skip_install = True
3029
deps = ruff
31-
commands = ruff check --fix {posargs:}
32-
ruff format {posargs:}
30+
commands = ruff check --fix
31+
ruff format
3332

3433
[testenv:docs]
3534
skip_install = True

0 commit comments

Comments
 (0)