Skip to content

Commit 6806b53

Browse files
committed
Template upgrade
1 parent 70f740b commit 6806b53

File tree

8 files changed

+68
-44
lines changed

8 files changed

+68
-44
lines changed

.github/workflows/autofix.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Auto-fix
2+
on:
3+
push:
4+
pull_request:
5+
jobs:
6+
style:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Download source
10+
uses: actions/checkout@v4
11+
- name: Install Python
12+
uses: actions/setup-python@v5
13+
with:
14+
python-version: '3.12'
15+
- name: Install Hatch
16+
run: |
17+
pip install hatch
18+
- name: Install dependencies
19+
run: |
20+
hatch run style:pip freeze
21+
- name: Fix code style
22+
run: |
23+
hatch run style:fix --fix-only
24+
- name: Check if any edits are necessary
25+
run: |
26+
git diff --color --exit-code
27+
- name: Apply automatic fixes using pre-commit-ci-lite
28+
if: failure() && github.event_name == 'pull_request'
29+
uses: pre-commit-ci/[email protected]

.github/workflows/ci.yml

+3-7
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Download source
3434
uses: actions/checkout@v4
3535
- name: Install Python
36-
uses: actions/setup-python@v4
36+
uses: actions/setup-python@v5
3737
with:
3838
python-version: ${{matrix.python}}
3939
- name: Pin to lowest versions
@@ -55,7 +55,7 @@ jobs:
5555
- name: Download source
5656
uses: actions/checkout@v4
5757
- name: Install Python
58-
uses: actions/setup-python@v4
58+
uses: actions/setup-python@v5
5959
with:
6060
python-version: '3.12'
6161
- name: Install Hatch
@@ -68,11 +68,7 @@ jobs:
6868
- name: Check style
6969
if: always()
7070
run: |
71-
hatch run style:fix
72-
- name: Check formatting
73-
if: always()
74-
run: |
75-
git diff --color --exit-code
71+
hatch run style:check
7672
- name: Check types
7773
if: always()
7874
run: |

.github/workflows/deploy-docs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- name: Download source
1212
uses: actions/checkout@v4
1313
- name: Install Python
14-
uses: actions/setup-python@v4
14+
uses: actions/setup-python@v5
1515
with:
1616
python-version: '3.11'
1717
- name: Install dependencies

.github/workflows/deploy-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v4
1313
- name: Setup Python
14-
uses: actions/setup-python@v4
14+
uses: actions/setup-python@v5
1515
with:
1616
python-version: '3.12'
1717
- name: Install dependencies

.tools/copier-answers.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
_commit: 8ebfc313a
1+
_commit: 0903da199
22
_src_path: gh:oprypin/py-project-template
33
copyright_date: '2020'
44
mkdocs: true

pyproject.toml

+25-21
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ include = ["/mkdocstrings_handlers", "/tests"]
5757
[tool.hatch.env]
5858
requires = [
5959
"hatch-mkdocs",
60-
"hatch-pip-compile",
60+
"hatch-pip-compile >=1.7.0",
6161
]
6262

6363
[tool.hatch.build.targets.wheel]
@@ -77,7 +77,7 @@ dependencies = [
7777
]
7878
[tool.hatch.envs.test.scripts]
7979
test = [
80-
"pytest -q",
80+
"pytest -q {args}",
8181
]
8282

8383
[tool.hatch.envs.types]
@@ -86,49 +86,53 @@ dependencies = [
8686
"types-Markdown >=3.4.2",
8787
]
8888
[tool.hatch.envs.types.scripts]
89-
check = [
90-
"mypy mkdocstrings_handlers"
91-
]
89+
check = "mypy {args} mkdocstrings_handlers"
9290

9391
[tool.hatch.envs.style]
94-
skip-install = true
92+
type = "pip-compile"
93+
detached = true
9594
dependencies = [
9695
"ruff",
9796
]
9897
[tool.hatch.envs.style.scripts]
98+
check = "ruff check mkdocstrings_handlers tests {args}"
99+
format = "ruff format -q mkdocstrings_handlers tests"
99100
fix = [
100-
"ruff check --fix mkdocstrings_handlers tests",
101+
"check --fix --unsafe-fixes",
101102
"format",
102103
]
103-
format = [
104-
"ruff format -q mkdocstrings_handlers tests",
105-
]
106104

107105
[tool.hatch.env.collectors.mkdocs.docs]
108106
[tool.hatch.envs.docs]
109107
type = "pip-compile"
110-
pip-compile-hashes = false
111108

112109
[tool.ruff]
113110
line-length = 100
111+
[tool.ruff.lint]
112+
preview = true
114113
select = [
115-
"F", "W", "E", "I", "UP", "YTT", "C4", "DTZ", "T10", "FA", "ISC", "PIE", "T20", "RSE", "TCH",
114+
"F", "E", "W", "I", "UP", "YTT", "C4", "DTZ", "T10", "FA", "ISC", "PIE", "T20", "RSE", "TCH",
116115
"N803", "N804", "N805", "N806", "N807", "N815", "N816", "N999",
117-
"B002", "B003", "B005", "B007", "B008", "B009", "B010", "B011", "B012", "B013", "B014", "B015", "B016", "B017", "B018", "B020", "B021", "B022", "B023", "B025", "B026", "B029", "B030", "B031", "B032", "B033", "B034", "B905",
116+
"B002", "B003", "B005", "B007", "B008", "B009", "B010", "B011", "B012", "B013", "B014", "B015", "B016", "B017", "B018", "B020", "B021", "B022", "B023", "B025", "B026", "B029", "B030", "B031", "B032", "B033", "B034", "B035", "B905",
118117
"COM818",
119118
"G001", "G010", "G202",
120-
"RET502",
121-
"SIM101", "SIM103", "SIM105", "SIM107", "SIM118", "SIM201", "SIM202", "SIM208", "SIM210", "SIM211", "SIM212", "SIM220", "SIM221", "SIM222", "SIM223", "SIM300", "SIM401", "SIM910",
122-
"PGH002", "PGH003", "PGH004", "PGH005",
123-
"PLC", "PLE",
124-
"PLR0124", "PLR0133", "PLR0206", "PLR0402", "PLR1701", "PLR1722", "PLW0120", "PLW0127", "PLW0129", "PLW0131", "PLW0406", "PLW0602", "PLW0603", "PLW0711", "PLW1508", "PLW3301",
119+
"Q004",
120+
"RET502", "RET504",
121+
"SIM101", "SIM103", "SIM105", "SIM107", "SIM118", "SIM201", "SIM202", "SIM208", "SIM210", "SIM211", "SIM212", "SIM220", "SIM221", "SIM222", "SIM223", "SIM300", "SIM401", "SIM910", "SIM911",
122+
"PGH003", "PGH004", "PGH005",
123+
"PLC0105", "PLC0131", "PLC0132", "PLC0205", "PLC0208", "PLC0414", "PLC2401", "PLC2403", "PLC2701", "PLC2801", "PLC3002",
124+
"PLE0100", "PLE0101", "PLE0116", "PLE0117", "PLE0118", "PLE0241", "PLE0302", "PLE0307", "PLE0604", "PLE0605", "PLE0704", "PLE1132", "PLE1142", "PLE1205", "PLE1206", "PLE1300", "PLE1307", "PLE1310", "PLE1507", "PLE1700", "PLE2502", "PLE2510", "PLE2512", "PLE2513", "PLE2514", "PLE2515",
125+
"PLR0124", "PLR0133", "PLR0206", "PLR0402", "PLR1701", "PLR1722", "PLR1733", "PLR1736",
126+
"PLW0108", "PLW0120", "PLW0127", "PLW0129", "PLW0131", "PLW0245", "PLW0406", "PLW0602", "PLW0603", "PLW0604", "PLW0711", "PLW1501", "PLW1508", "PLW1514", "PLW2101", "PLW3301",
125127
"TRY302", "TRY401",
126128
"FLY002",
127-
"PERF101", "PERF102", "PERF402",
128-
"RUF001", "RUF005", "RUF007", "RUF008", "RUF009", "RUF010", "RUF011", "RUF013", "RUF015", "RUF016", "RUF100", "RUF200",
129+
"PERF101", "PERF102", "PERF402", "PERF403",
130+
"FURB105", "FURB118", "FURB131", "FURB132", "FURB148", "FURB163", "FURB167", "FURB168", "FURB169",
131+
"LOG001", "LOG009",
132+
"RUF001", "RUF005", "RUF007", "RUF008", "RUF009", "RUF010", "RUF013", "RUF015", "RUF016", "RUF017", "RUF018", "RUF019", "RUF020", "RUF021", "RUF022", "RUF100", "RUF200",
129133
]
130134
ignore = ["E501", "E731"]
131-
[tool.ruff.flake8-comprehensions]
135+
[tool.ruff.lint.flake8-comprehensions]
132136
allow-dict-calls-with-keyword-arguments = true
133137

134138
[tool.mypy]

requirements/requirements-style.txt

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#
2+
# This file is autogenerated by hatch-pip-compile with Python 3.11
3+
#
4+
# - ruff
5+
#
6+
7+
ruff==0.2.0
8+
# via hatch.envs.style

setup.py

-13
This file was deleted.

0 commit comments

Comments
 (0)