Skip to content

Commit e330ad1

Browse files
committed
Template upgrade
1 parent b26b32f commit e330ad1

File tree

7 files changed

+69
-41
lines changed

7 files changed

+69
-41
lines changed

.github/workflows/autofix.yml

Lines changed: 29 additions & 0 deletions
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

Lines changed: 3 additions & 7 deletions
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-release.yml

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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: '2019'
44
mkdocs: false

pyproject.toml

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ path = "mkdocs_redirects/__init__.py"
5252
[tool.hatch.build.targets.sdist]
5353
include = ["/mkdocs_redirects", "/tests"]
5454

55+
[tool.hatch.env]
56+
requires = ["hatch-pip-compile >=1.7.0"]
57+
5558
[tool.hatch.envs.default.scripts]
5659
all = [
5760
"hatch run style:fix",
@@ -65,52 +68,57 @@ dependencies = [
6568
]
6669
[tool.hatch.envs.test.scripts]
6770
test = [
68-
"pytest -q",
71+
"pytest -q {args}",
6972
]
7073

7174
[tool.hatch.envs.types]
7275
dependencies = [
7376
"mypy",
7477
]
7578
[tool.hatch.envs.types.scripts]
76-
check = [
77-
"mypy mkdocs_redirects"
78-
]
79+
check = "mypy {args} mkdocs_redirects"
7980

8081
[tool.hatch.envs.style]
81-
skip-install = true
82+
type = "pip-compile"
83+
detached = true
8284
dependencies = [
8385
"ruff",
8486
]
8587
[tool.hatch.envs.style.scripts]
88+
check = "ruff check mkdocs_redirects tests {args}"
89+
format = "ruff format -q mkdocs_redirects tests"
8690
fix = [
87-
"ruff check --fix mkdocs_redirects tests",
91+
"check --fix --unsafe-fixes",
8892
"format",
8993
]
90-
format = [
91-
"ruff format -q mkdocs_redirects tests",
92-
]
9394

9495
[tool.ruff]
9596
line-length = 100
97+
[tool.ruff.lint]
98+
preview = true
9699
select = [
97-
"F", "W", "E", "I", "UP", "YTT", "C4", "DTZ", "T10", "FA", "ISC", "PIE", "T20", "RSE", "TCH",
100+
"F", "E", "W", "I", "UP", "YTT", "C4", "DTZ", "T10", "FA", "ISC", "PIE", "T20", "RSE", "TCH",
98101
"N803", "N804", "N805", "N806", "N807", "N815", "N816", "N999",
99-
"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",
102+
"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",
100103
"COM818",
101104
"G001", "G010", "G202",
102-
"RET502",
103-
"SIM101", "SIM103", "SIM105", "SIM107", "SIM118", "SIM201", "SIM202", "SIM208", "SIM210", "SIM211", "SIM212", "SIM220", "SIM221", "SIM222", "SIM223", "SIM300", "SIM401", "SIM910",
104-
"PGH002", "PGH003", "PGH004", "PGH005",
105-
"PLC", "PLE",
106-
"PLR0124", "PLR0133", "PLR0206", "PLR0402", "PLR1701", "PLR1722", "PLW0120", "PLW0127", "PLW0129", "PLW0131", "PLW0406", "PLW0602", "PLW0603", "PLW0711", "PLW1508", "PLW3301",
105+
"Q004",
106+
"RET502", "RET504",
107+
"SIM101", "SIM103", "SIM105", "SIM107", "SIM118", "SIM201", "SIM202", "SIM208", "SIM210", "SIM211", "SIM212", "SIM220", "SIM221", "SIM222", "SIM223", "SIM300", "SIM401", "SIM910", "SIM911",
108+
"PGH003", "PGH004", "PGH005",
109+
"PLC0105", "PLC0131", "PLC0132", "PLC0205", "PLC0208", "PLC0414", "PLC2401", "PLC2403", "PLC2701", "PLC2801", "PLC3002",
110+
"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",
111+
"PLR0124", "PLR0133", "PLR0206", "PLR0402", "PLR1701", "PLR1722", "PLR1733", "PLR1736",
112+
"PLW0108", "PLW0120", "PLW0127", "PLW0129", "PLW0131", "PLW0245", "PLW0406", "PLW0602", "PLW0603", "PLW0604", "PLW0711", "PLW1501", "PLW1508", "PLW1514", "PLW2101", "PLW3301",
107113
"TRY302", "TRY401",
108114
"FLY002",
109-
"PERF101", "PERF102", "PERF402",
110-
"RUF001", "RUF005", "RUF007", "RUF008", "RUF009", "RUF010", "RUF011", "RUF013", "RUF015", "RUF016", "RUF100", "RUF200",
115+
"PERF101", "PERF102", "PERF402", "PERF403",
116+
"FURB105", "FURB118", "FURB131", "FURB132", "FURB148", "FURB163", "FURB167", "FURB168", "FURB169",
117+
"LOG001", "LOG009",
118+
"RUF001", "RUF005", "RUF007", "RUF008", "RUF009", "RUF010", "RUF013", "RUF015", "RUF016", "RUF017", "RUF018", "RUF019", "RUF020", "RUF021", "RUF022", "RUF100", "RUF200",
111119
]
112120
ignore = ["E501", "E731"]
113-
[tool.ruff.flake8-comprehensions]
121+
[tool.ruff.lint.flake8-comprehensions]
114122
allow-dict-calls-with-keyword-arguments = true
115123

116124
[tool.mypy]

requirements/requirements-style.txt

Lines changed: 8 additions & 0 deletions
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

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)