Skip to content

Commit a31bdff

Browse files
committed
fixes typing
1 parent bbbb44a commit a31bdff

File tree

14 files changed

+871
-876
lines changed

14 files changed

+871
-876
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,13 @@ jobs:
8686
if: ${{ always() }}
8787

8888
- name: Upload coverage to Codecov
89-
uses: codecov/codecov-action@v4
89+
uses: codecov/codecov-action@v5
9090
if: matrix.python == 3.12
9191
continue-on-error: true
9292
with:
9393
env_vars: OS,PYTHON
9494
fail_ci_if_error: true
95+
slug: saxix/django-smart-admin
9596
flags: unittests
9697
files: ./coverage.xml
9798
verbose: false

.pre-commit-config.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ repos:
2424
- id: ruff-format
2525
- id: ruff
2626
args: [ "--fix", "--unsafe-fixes", "--exit-non-zero-on-fix" ]
27-
# - repo: https://github.com/adamchainz/djade-pre-commit
28-
# rev: "1.3.2"
29-
# hooks:
30-
# - id: djade
31-
# args: [ --check, --target-version, "5.1" ]
3227
- repo: meta
3328
hooks:
3429
- id: check-hooks-apply

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ include MANIFEST.in
66
recursive-include docs *
77
recursive-include src/admin_extra_buttons *
88
recursive-include tests *
9+
10+
exclude ~*
11+
recursive-exclude . ~*

Makefile

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

mypy.ini

Lines changed: 9 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,15 @@
1-
# Regular configuration file (can be used as base in other projects, runs in CI)
2-
31
[mypy]
4-
# Modified in `tests.yml`
5-
incremental = true
6-
mypy_path = tests/demoapp
7-
;
8-
;# Strictness:
9-
;allow_redefinition = true
10-
;check_untyped_defs = true
11-
;# TODO: add type args to all generics
12-
;disallow_any_generics = false
13-
;# TODO: fix `Any` subclassing in `typeshed/builtins.pyi`
14-
;disallow_subclassing_any = false
15-
;ignore_missing_imports = false
2+
files = src/admin_extra_buttons
3+
mypy_path = $MYPY_CONFIG_FILE_DIR/src/:$MYPY_CONFIG_FILE_DIR/tests/demoapp
4+
;enable_error_code =
5+
; deprecated,
6+
; ignore-without-code
7+
plugins =
8+
mypy_django_plugin.main
9+
1610
strict = true
17-
;local_partial_types = true
18-
;warn_unreachable = true
19-
;
20-
;# TODO: update our output assertions to match a new syntax
21-
;force_uppercase_builtins = true
22-
;force_union_syntax = true
23-
;
24-
;disable_error_code = empty-body
25-
enable_error_code =
26-
deprecated,
27-
ignore-without-code
2811

2912

30-
show_traceback = true
31-
;
32-
plugins =
33-
mypy_django_plugin.main,
34-
mypy.plugins.proper_plugin
35-
;
36-
;# Ignore incomplete hints in 3rd party stubs:
37-
;[mypy-yaml.*]
38-
;disallow_untyped_defs = false
39-
;disallow_incomplete_defs = false
40-
;
41-
;[mypy-cryptography.*]
42-
;ignore_errors = true
43-
;
44-
;# Our settings:
13+
4514
[mypy.plugins.django-stubs]
4615
django_settings_module = demo.settings

pyproject.toml

Lines changed: 3 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ dynamic = [
3232
"version",
3333
]
3434
dependencies = [
35-
"django-stubs>=5.1.3",
35+
"django-stubs",
3636
]
3737

3838
urls.Documentation = "https://saxix.github.io/django-admin-extra-buttons/"
@@ -45,6 +45,7 @@ dev = [
4545
"django-webtest>=1.9.13",
4646
"factory-boy>=3.3.1",
4747
"pdbpp>=0.10.3",
48+
"pre-commit>=4.2",
4849
"pyquery>=2.0.1",
4950
"pytest>=8.3.3",
5051
"pytest-cov>=5",
@@ -78,7 +79,7 @@ dj = [
7879
]
7980

8081
type-check = [
81-
"mypy<1.15",
82+
"mypy",
8283
]
8384

8485
[tool.hatch]
@@ -95,126 +96,8 @@ include = [
9596
[tool.hatch.build.targets.wheel]
9697
packages = [ "src/admin_extra_buttons" ]
9798

98-
[tool.ruff]
99-
target-version = "py39"
100-
line-length = 120
101-
exclude = [
102-
"docs",
103-
"manage.py",
104-
"tests",
105-
]
106-
format.preview = true
107-
format.docstring-code-line-length = 120
108-
format.docstring-code-format = true
109-
lint.select = [
110-
"ALL",
111-
]
112-
lint.ignore = [
113-
"ANN401", # Dynamically typed expressions
114-
"COM812",
115-
"CPY", # Missing copyright notice
116-
"D", # docstring
117-
"DOC", # docstring
118-
"E731", # Do not assign a `lambda` expression,
119-
"EM101", # Exception must not use a string literal, assign to variable first
120-
"EM102", # Exception must not use a f-string literal, assign to variable first
121-
"FBT001", # Boolean-typed positional argument in function definition
122-
"FBT002", # Boolean default positional argument in function definition
123-
"N806", # Variable `...` in function should be lowercase
124-
"S308", # Use of `mark_safe` may expose cross-site scripting vulnerabilities
125-
"SLF001", # Private member accessed: `...`
126-
"TRY003", # Avoid specifying long messages outside the exception class
127-
"TRY301", # Abstract `raise` to an inner function
128-
"TRY401", # Redundant exception object included in `logging.exception` call
129-
"UP037", #
130-
]
131-
lint.per-file-ignores."docs/conf.py" = [
132-
"A001", #
133-
"D100", #
134-
"ERA001", #
135-
"INP001", #
136-
]
137-
lint.per-file-ignores."src/**/version.py" = [
138-
"ALL",
139-
]
140-
lint.per-file-ignores."tests/**/*.py" = [
141-
"A",
142-
"ANN",
143-
"ARG",
144-
"B",
145-
"BLE",
146-
"D",
147-
"DJ",
148-
"DTZ",
149-
"ERA",
150-
"F",
151-
"FBT",
152-
"FURB",
153-
"INP",
154-
"N",
155-
"PGH",
156-
"PLC",
157-
"PLR",
158-
"PLW",
159-
"PT",
160-
"PTH",
161-
"PYI",
162-
"RUF",
163-
"S",
164-
"SIM",
165-
"TC",
166-
"UP",
167-
]
168-
lint.isort = { known-first-party = [ "admin_extra_buttons" ] }
169-
lint.pylint.max-args = 7
170-
lint.pylint.max-branches = 14
171-
lint.pylint.max-nested-blocks = 8
172-
lint.preview = true
173-
17499
[tool.pyproject-fmt]
175100
max_supported_python = "3.13"
176101

177-
[tool.pytest.ini_options]
178-
django_find_project = false
179-
norecursedirs = [ "demoapp", ".tox" ]
180-
addopts = "--doctest-modules --echo-attr=django.conf.settings.DATABASES.default.ENGINE --tb=short --reuse-db --capture=no --doctest-glob=admin_extra_buttons/*.py"
181-
python_files = "tests/test_*.py tests/**/test_*.py src/*.py"
182-
markers = [
183-
"functional: mark a test as functional",
184-
"selenium: selenium test",
185-
"skip: skip test",
186-
]
187-
testpaths = [
188-
"src",
189-
"tests",
190-
]
191-
192-
[tool.coverage]
193-
run.source = [
194-
"admin_extra_buttons",
195-
]
196-
run.dynamic_context = "test_function"
197-
run.branch = true
198-
run.parallel = true
199-
200-
run.plugins = [
201-
"covdefaults",
202-
]
203-
report.fail_under = 80
204-
report.show_missing = true
205-
report.exclude_lines = [
206-
"pragma: no cover",
207-
]
208-
html.show_contexts = true
209-
html.skip_covered = false
210-
paths.source = [
211-
"src",
212-
".tox*/*/lib/python*/site-packages",
213-
".tox*/pypy*/site-packages",
214-
".tox*\\*\\Lib\\site-packages",
215-
"*/src",
216-
"*\\src",
217-
]
218-
219102
[tool.uv]
220103
package = true

pytest.ini

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[pytest]
2+
django_find_project = false
3+
pythonpath = ./tests/demoapp/ ./src
4+
DJANGO_SETTINGS_MODULE = demo.settings
5+
norecursedirs = "demo", ".tox"
6+
addopts =
7+
--tb=short
8+
--capture=no
9+
--echo-version=django
10+
--echo-attr=django.conf.settings.DATABASES.default.ENGINE
11+
--cov=admin_sync
12+
--cov-report=html
13+
--cov-report=xml
14+
--cov-config=tests/.coveragerc
15+
16+
;python_files = "tests/test_*.py tests/**/test_*.py src/*.py"
17+
markers =
18+
functional: mark a test as functional
19+
selenium: selenium test
20+
skip: skip test
21+
22+
;
23+
;[tool.coverage]
24+
;run.source = [
25+
; "admin_sync",
26+
;]
27+
;run.dynamic_context = "test_function"
28+
;run.branch = true
29+
;run.parallel = true
30+
;run.omit = [
31+
; "**/create_extra_permissions.py",
32+
;]
33+
;run.plugins = [
34+
; "covdefaults",
35+
;]
36+
;report.fail_under = 80
37+
;report.show_missing = true
38+
;report.exclude_lines = [
39+
; "pragma: no cover",
40+
;]
41+
;html.show_contexts = true
42+
;html.skip_covered = false
43+
;paths.source = [
44+
; "src",
45+
; ".tox*/*/lib/python*/site-packages",
46+
; ".tox*/pypy*/site-packages",
47+
; ".tox*\\*\\Lib\\site-packages",
48+
; "*/src",
49+
; "*\\src",
50+
;]

0 commit comments

Comments
 (0)