Upgrade dev dependencies;

upgrade to newer reusable Github workflow;
rename requirements files;
add `ruff` linting rules;
add `black` config for line length 80
This commit is contained in:
Daniil Fajnberg 2023-10-16 17:34:07 +02:00
parent acf4c06404
commit 1a293563d1
Signed by: daniil-berg
GPG Key ID: BE187C50903BEE97
5 changed files with 53 additions and 28 deletions

View File

@ -8,9 +8,9 @@ on:
jobs: jobs:
test: test:
name: Test name: Test
uses: daniil-berg/reusable-workflows/.github/workflows/python-test.yaml@v0.2.1 uses: daniil-berg/reusable-workflows/.github/workflows/python-test.yaml@v0.2.2
with: with:
versions: '["3.9", "3.10", "3.11"]' versions: '["3.9", "3.10", "3.11", "3.12"]'
unittest-command: 'scripts/test.sh' unittest-command: 'scripts/test.sh'
coverage-command: 'scripts/cov.sh' coverage-command: 'scripts/cov.sh'
unittest-requirements: "-e '.[dev]'" unittest-requirements: "-e '.[dev]'"
@ -24,7 +24,7 @@ jobs:
name: Release name: Release
if: ${{ github.ref_type == 'tag' }} if: ${{ github.ref_type == 'tag' }}
needs: test needs: test
uses: daniil-berg/reusable-workflows/.github/workflows/python-release.yaml@v0.2.1 uses: daniil-berg/reusable-workflows/.github/workflows/python-release.yaml@v0.2.2
with: with:
git-ref: ${{ github.ref_name }} git-ref: ${{ github.ref_name }}
secrets: secrets:

View File

@ -39,18 +39,16 @@ dynamic = [
] ]
[project.optional-dependencies] [project.optional-dependencies]
full = [ full = []
...
]
dev = [ dev = [
"black==23.7.0", "black==23.9.1",
"build==0.10.0", "build==1.0.3",
"coverage[toml]==7.2.7", "coverage[toml]==7.3.2",
"isort==5.12.0", "isort==5.12.0",
"mkdocs-material==9.1.18", "mkdocs-material==9.4.6",
"mkdocstrings[python]==0.22.0", "mkdocstrings[python]==0.23.0",
"mypy==1.4.1", "mypy==1.5.1",
"ruff==0.0.278", "ruff==0.0.292",
] ]
[project.urls] [project.urls]
@ -109,25 +107,44 @@ omit = [
[tool.ruff] [tool.ruff]
cache-dir = ".cache/ruff" cache-dir = ".cache/ruff"
select = [ select = [
"F", # pyflakes
"E", # pycodestyle errors "E", # pycodestyle errors
"W", # pycodestyle warnings "W", # pycodestyle warnings
"F", # pyflakes "N", # pep8-naming
"D", # pydocstyle "D", # pydocstyle
"C", # flake8-comprehensions "ANN", # flake8-annotations
"S", # flake8-bandit
"FBT", # flake8-boolean-trap
"B", # flake8-bugbear "B", # flake8-bugbear
"A", # flake8-builtins
"C", # flake8-comprehensions
"PIE", # flake8-pie
"T20", # flake8-print
"RET", # flake8-return
"SIM", # flake8-simplify
"TD", # flake8-todos
"TCH", # flake8-type-checking
"ARG", # flake8-unused-arguments
"PTH", # flake8-use-pathlib
"ERA", # eradicate
"PL", # pylint "PL", # pylint
"TRY", # tryceratops
"RUF", # ruff-specific "RUF", # ruff-specific
] ]
ignore = [ ignore = [
"E501", # Line too long -> handled by black "E501", # Line too long -> handled by black
"D203", # 1 blank line required before class docstring -> D211 is better "D203", # 1 blank line required before class docstring -> D211 is better
"D212", # Multi-line docstring summary should start at the first line -> ugly, D212 is better "D212", # Multi-line docstring summary should start at the first line -> ugly, D213 is better
"D401", # First line of docstring should be in imperative mood -> no, it shouldn't "D401", # First line of docstring should be in imperative mood -> no, it shouldn't
"D407", # Missing dashed underline after section -> different docstring style "D407", # Missing dashed underline after section -> different docstring style
"ANN101", # Missing type annotation for self in method -> unnecessary
"ANN102", # Missing type annotation for cls in classmethod -> unnecessary
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed -> we'll use it sparingly
] ]
[tool.ruff.per-file-ignores] [tool.ruff.per-file-ignores]
"src/**/__init__.py" = [ "src/**/__init__.py" = [
"A001", # Variable {name} is shadowing a Python builtin
"D104", # Missing docstring in public package "D104", # Missing docstring in public package
"F401", # {...} imported but unused "F401", # {...} imported but unused
] ]
@ -138,9 +155,16 @@ ignore = [
"D104", # Missing docstring in public package "D104", # Missing docstring in public package
] ]
####################
# Code formatting: #
[tool.black]
line_length = 80
################### ###################
# Import sorting: # # Import sorting: #
[tool.isort] [tool.isort]
profile = "black" profile = "black"
extra_standard_library = ["typing_extensions"] extra_standard_library = ["typing_extensions"]
line_length = 80

View File

@ -1,9 +1,9 @@
-r common.txt -r full.txt
black==23.7.0 black==23.9.1
build==0.10.0 build==1.0.3
coverage[toml]==7.2.7 coverage[toml]==7.3.2
isort==5.12.0 isort==5.12.0
mkdocs-material==9.1.18 mkdocs-material==9.4.6
mkdocstrings[python]==0.22.0 mkdocstrings[python]==0.23.0
mypy==1.4.1 mypy==1.5.1
ruff==0.0.278 ruff==0.0.292

1
requirements/full.txt Normal file
View File

@ -0,0 +1 @@
-r base.txt