Skip to content

Commit 2b6b891

Browse files
committed
new pyproject.toml
1 parent fb4b62f commit 2b6b891

File tree

9 files changed

+154
-131
lines changed

9 files changed

+154
-131
lines changed

.bumpversion.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ tag = False
77
allow_dirty = True
88

99
[bumpversion:file:src/admin_extra_buttons/__init__.py]
10+
11+
[bumpversion:file:pyproject.toml]

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ pytest.xml
1515
*.sqlite
1616
dist/*
1717
docs/site
18-
stubs/
18+
stubs/
19+
uv.lock

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
1.6.0
22
-----
3+
* moves to pyproject.toml (removes `setup.py`)
4+
* starts using `uv`
35
* removes constraint to use `button` as @link() argument
46
* drop official support for Django < 3.x
57

pyproject.toml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
[project]
2+
name = "django-admin-extra-buttons"
3+
version = "1.6.0"
4+
description = "Django mixin to easily add buttons to any ModelAdmin"
5+
readme = "README.md"
6+
requires-python = ">=3.11"
7+
classifiers=[
8+
'Environment :: Web Environment',
9+
'Operating System :: OS Independent',
10+
'Framework :: Django',
11+
'Framework :: Django :: 4.2',
12+
'Framework :: Django :: 5.0',
13+
'Framework :: Django :: 5.1',
14+
'License :: OSI Approved :: BSD License',
15+
'Programming Language :: Python :: 3.11',
16+
'Programming Language :: Python :: 3.12',
17+
'Topic :: Software Development :: Libraries :: Application Frameworks',
18+
'Topic :: Software Development :: Libraries :: Python Modules',
19+
'Intended Audience :: Developers'
20+
]
21+
22+
dependencies = [
23+
24+
]
25+
[project.urls]
26+
Homepage = "https://github.com/saxix/django-admin-extra-buttonst"
27+
Documentation = "https://github.com/saxix/django-admin-extra-buttons"
28+
29+
[project.optional-dependencies]
30+
docs = [
31+
"mkdocs>=1.6.1",
32+
"markdown-include",
33+
"mkdocs-material>=9.5.36",
34+
"mkdocs-awesome-pages-plugin>=2.9.3",
35+
"mkdocstrings-python",
36+
"mdx_gh_links",
37+
]
38+
39+
[tool.uv]
40+
dev-dependencies = [
41+
# "black>=24.8.0",
42+
# "celery[pytest]>=5.4.0",
43+
# "django-webtest>=1.9.12",
44+
# "factory-boy>=3.3.1",
45+
# "flake8>=7.1.1",
46+
# "flower>=2.0.1",
47+
# "ipython>=8.18.1",
48+
# "isort>=5.13.2",
49+
# "mypy>=1.11.2",
50+
# "pdbpp>=0.10.3",
51+
# "psycopg-binary>=3.2.2",
52+
# "psycopg>=2.9.9",
53+
# "pyquery>=2.0.1",
54+
# "pytest-cov>=5.0.0",
55+
# "pytest-django>=4.9.0",
56+
# "pytest-echo>=1.7.3",
57+
"django-webtest>=1.9.12",
58+
# "black>=24.8.0",
59+
# "celery[pytest]>=5.4.0",
60+
# "django-webtest>=1.9.12",
61+
# "factory-boy>=3.3.1",
62+
# "flake8>=7.1.1",
63+
# "flower>=2.0.1",
64+
# "ipython>=8.18.1",
65+
# "isort>=5.13.2",
66+
# "mypy>=1.11.2",
67+
# "pdbpp>=0.10.3",
68+
# "psycopg-binary>=3.2.2",
69+
# "psycopg>=2.9.9",
70+
# "pyquery>=2.0.1",
71+
# "pytest-cov>=5.0.0",
72+
# "pytest-django>=4.9.0",
73+
# "pytest-echo>=1.7.3",
74+
"pytest>=8.3.3",
75+
"tox>=4.20.0",
76+
]

pytest.ini

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[pytest]
2+
norecursedirs = data .tox _plugin_template .idea node_modules ~*
3+
log_format = %(asctime)s %(levelname)s %(message)s
4+
log_level = CRITICAL
5+
django_find_project = false
6+
log_cli = False
7+
log_date_format = %Y-%m-%d %H:%M:%S
8+
junit_family=xunit1
9+
pythonpath=src
10+
testpaths=tests
11+
tmp_path_retention_policy=all
12+
tmp_path_retention_count=0
13+
addopts =
14+
-rs
15+
--tb=short
16+
--capture=sys
17+
--echo-version django
18+
--cov-config=tests/.coveragerc
19+
--cov-report html
20+
--cov-report xml:coverage.xml
21+
22+
23+
markers =
24+
admin
25+
eager
26+
27+
python_files=test_*.py

setup.py

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

tests/conftest.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
import os
2+
import sys
3+
from pathlib import Path
24

35
import django_webtest
46
import pytest
5-
from demo.models import DemoModel1, DemoModel2, DemoModel5
7+
8+
here = Path(__file__).parent
9+
DEMOAPP_PATH = here / "demoapp"
10+
sys.path.insert(0, str(here / "../src"))
11+
sys.path.insert(0, str(DEMOAPP_PATH))
612

713

814
def pytest_configure(config):
915
os.environ['DEBUG'] = "False"
16+
os.environ.update(DJANGO_SETTINGS_MODULE="demo.settings")
17+
18+
import django
19+
20+
django.setup()
1021

1122

1223
@pytest.fixture(autouse=True)
@@ -25,22 +36,24 @@ def app(request):
2536

2637
@pytest.fixture
2738
def demomodel2():
39+
from demo.models import DemoModel1, DemoModel2, DemoModel5
2840
return DemoModel2.objects.get_or_create(name='name1')[0]
2941

3042

3143
@pytest.fixture
3244
def demomodel1():
45+
from demo.models import DemoModel1, DemoModel2, DemoModel5
3346
return DemoModel1.objects.get_or_create(name='name1')[0]
3447

3548

3649
@pytest.fixture
3750
def demomodel5():
51+
from demo.models import DemoModel1, DemoModel2, DemoModel5
3852
return DemoModel5.objects.get_or_create(name='name1')[0]
3953

4054

4155
@pytest.fixture(scope='function')
4256
def staff_user(request, django_user_model, django_username_field):
43-
4457
user, _ = django_user_model._default_manager.get_or_create(**{django_username_field: 'username',
4558
'is_staff': True})
4659
user.set_password('password')

tests/test_visibility.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ def v(btn):
1414

1515
def test_link_visibility():
1616
def v(btn):
17-
assert btn.original
1817
return isinstance(btn, LinkButton)
1918

2019
h = LinkHandler(MagicMock(__name__="a"), visible=v)

tox.ini

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,42 @@
11
[tox]
22
envlist = d{42,51}-py{311,312}
3-
4-
[pytest]
5-
pythonpath=./tests/demoapp/
6-
django_find_project = false
7-
DJANGO_SETTINGS_MODULE=demo.settings
8-
norecursedirs = .tox docs ./tests/demoapp/
9-
python_files=tests/test_*.py
10-
addopts =
11-
-v
12-
--cov=admin_extra_buttons
13-
--cov-report=html
14-
--cov-config=./tests/.coveragerc
15-
--reuse-db
16-
--tb=short
17-
--capture=no
18-
--echo-version django
19-
20-
markers =
21-
functional: mark a test as functional
3+
skip_missing_interpreters = true
4+
;skipsdist = true
225

236
[testenv]
7+
;install_command=pip install {opts} {packages}
8+
passenv =
9+
PYTHONDONTWRITEBYTECODE
10+
PGHOST
11+
PGPORT
12+
13+
allowlist_externals =
14+
sh
2415

16+
changedir={toxinidir}
2517
setenv =
26-
PYTHONDONTWRITEBYTECODE=true
27-
DISPLAY=:0.0
18+
d42: DJANGO = django>=4,<5
19+
d51: DJANGO = django>=5,<6
20+
d42: LOCK = "uv4.lock"
21+
d51: LOCK = "uv5.lock"
2822

29-
extras = test
30-
deps=
31-
d32: django==3.2.*
32-
d42: django==4.0.*
33-
d50: django==5.0.*
34-
dev: git+git://github.com/django/django.git#egg=django
23+
deps =
24+
uv
25+
26+
commands =
27+
sh -c "echo '{env:DJANGO}' > {work_dir}/overrides.txt"
28+
uv export -q --no-hashes -o {work_dir}/requirements.txt
29+
uv pip install -r {work_dir}/requirements.txt --override {work_dir}/overrides.txt
30+
pytest tests
3531

32+
33+
[testenv:lint]
34+
envdir={toxworkdir}/d42-py312/
35+
skip_install = true
3636
commands =
37-
py.test tests --create-db {posargs}
37+
pip install flake8 isort
38+
flake8 src tests
39+
isort -c src tests
3840

3941

4042
[testenv:package]
@@ -50,11 +52,3 @@ commands =
5052
python -c "import shutil; shutil.rmtree('dist', ignore_errors=True)"
5153
python -m build
5254
python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
53-
54-
55-
[testenv:docs]
56-
extras=
57-
docs
58-
59-
commands =
60-
mkdocs build

0 commit comments

Comments
 (0)