Skip to content

Commit c013cb0

Browse files
committed
Template upgrade
1 parent 0c5a98b commit c013cb0

File tree

8 files changed

+76
-30
lines changed

8 files changed

+76
-30
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/lite-action@v1.0.1

.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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
_commit: 7d6f4ceea
1+
_commit: ed37f1413
22
_src_path: gh:oprypin/py-project-template
33
copyright_date: '2020'
44
mkdocs: false
@@ -10,3 +10,4 @@ python_distribution_name: mkdocs-click
1010
python_source_path: mkdocs_click
1111
repository_name: mkdocs/mkdocs-redirects
1212
script_test: true
13+

mkdocs_click/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
from ._exceptions import MkDocsClickException
66
from ._extension import MKClickExtension, makeExtension
77

8-
__all__ = ["__version__", "MKClickExtension", "MkDocsClickException", "makeExtension"]
8+
__all__ = ["MKClickExtension", "MkDocsClickException", "__version__", "makeExtension"]

pyproject.toml

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ path = "mkdocs_click/__version__.py"
5050
[tool.hatch.build.targets.sdist]
5151
include = ["/mkdocs_click", "/CHANGELOG.md", "/tests"]
5252

53+
[tool.hatch.env]
54+
requires = ["hatch-pip-compile >=1.7.0"]
55+
5356
[tool.hatch.envs.default.scripts]
5457
all = [
5558
"hatch run style:fix",
@@ -66,8 +69,8 @@ dependencies = [
6669
]
6770
[tool.hatch.envs.test.scripts]
6871
test = [
69-
"pytest -q",
70-
"bash .tools/test.sh",
72+
"pytest -q {args}",
73+
"bash .tools/test.sh {args}",
7174
]
7275

7376
[tool.hatch.envs.types]
@@ -76,40 +79,49 @@ dependencies = [
7679
"types-Markdown >=3.4.2",
7780
]
7881
[tool.hatch.envs.types.scripts]
79-
check = [
80-
"mypy mkdocs_click"
81-
]
82+
check = "mypy {args} mkdocs_click"
8283

8384
[tool.hatch.envs.style]
84-
skip-install = true
85+
type = "pip-compile"
86+
detached = true
8587
dependencies = [
8688
"ruff",
8789
]
8890
[tool.hatch.envs.style.scripts]
91+
check = "ruff check mkdocs_click tests {args}"
92+
format = "ruff format -q mkdocs_click tests"
8993
fix = [
90-
"ruff check --fix mkdocs_click tests",
94+
"check --fix --unsafe-fixes",
9195
"format",
9296
]
93-
format = [
94-
"ruff format -q mkdocs_click tests",
95-
]
9697

9798
[tool.ruff]
9899
line-length = 100
100+
[tool.ruff.lint]
101+
preview = true
99102
select = [
100-
"I",
101-
"F", "W", "E", "UP", "YTT", "C4", "DTZ", "FA", "ISC", "PIE", "T20", "RSE", "TCH",
102-
"B002", "B003", "B005", "B007", "B009", "B012", "B013", "B014", "B015", "B018", "B020", "B021", "B023", "B026", "B033", "B034", "B905",
103+
"F", "E", "W", "I", "UP", "YTT", "C4", "DTZ", "T10", "FA", "ISC", "PIE", "T20", "RSE", "TCH",
104+
"N803", "N804", "N805", "N806", "N807", "N815", "N816", "N999",
105+
"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",
103106
"COM818",
104-
"PERF101",
105-
"PGH002", "PGH004", "PGH005",
107+
"G001", "G010", "G202",
108+
"Q004",
109+
"RET502", "RET504",
110+
"SIM101", "SIM103", "SIM105", "SIM107", "SIM118", "SIM201", "SIM202", "SIM208", "SIM210", "SIM211", "SIM212", "SIM220", "SIM221", "SIM222", "SIM223", "SIM300", "SIM401", "SIM910", "SIM911",
111+
"PGH003", "PGH004", "PGH005",
112+
"PLC0105", "PLC0131", "PLC0132", "PLC0205", "PLC0208", "PLC0414", "PLC2401", "PLC2403", "PLC2801", "PLC3002",
113+
"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",
114+
"PLR0124", "PLR0133", "PLR0206", "PLR0402", "PLR1701", "PLR1722", "PLR1733", "PLR1736",
115+
"PLW0108", "PLW0120", "PLW0127", "PLW0129", "PLW0131", "PLW0245", "PLW0406", "PLW0602", "PLW0603", "PLW0604", "PLW0711", "PLW1501", "PLW1508", "PLW1514", "PLW2101", "PLW3301",
116+
"TRY302", "TRY401",
106117
"FLY002",
107-
"PLC", "PLE", "PLR0124", "PLR0133", "PLR0206", "PLR0402", "PLR1701", "PLR1722", "PLW0120", "PLW0127", "PLW0129", "PLW0131", "PLW0406", "PLW0602", "PLW0603", "PLW0711",
108-
"RUF001", "RUF005", "RUF007", "RUF010", "RUF013", "RUF100", "RUF200",
109-
"SIM101", "SIM107", "SIM201", "SIM202", "SIM208", "SIM210", "SIM211", "SIM300", "SIM401", "SIM910",
118+
"PERF101", "PERF102", "PERF402", "PERF403",
119+
"FURB105", "FURB118", "FURB131", "FURB132", "FURB148", "FURB163", "FURB167", "FURB168", "FURB169",
120+
"LOG001", "LOG009",
121+
"RUF001", "RUF005", "RUF007", "RUF008", "RUF009", "RUF010", "RUF013", "RUF015", "RUF016", "RUF017", "RUF018", "RUF019", "RUF020", "RUF021", "RUF022", "RUF100", "RUF200",
110122
]
111123
ignore = ["E501", "E731"]
112-
[tool.ruff.flake8-comprehensions]
124+
[tool.ruff.lint.flake8-comprehensions]
113125
allow-dict-calls-with-keyword-arguments = true
114126

115127
[tool.mypy]
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

tests/test_loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
],
2222
)
2323
def test_load_command(module: str, command: str, exc):
24-
with pytest.raises(exc) if exc is not None else nullcontext(): # type: ignore
24+
with pytest.raises(exc) if exc is not None else nullcontext():
2525
load_command(module, command)

0 commit comments

Comments
 (0)