Skip to content

Commit 9e100dd

Browse files
committed
Replace setup.py with pyproject.toml | #41346
1 parent ce0cd9e commit 9e100dd

File tree

6 files changed

+88
-103
lines changed

6 files changed

+88
-103
lines changed

Makefile

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,24 @@ shell:
4848
test:
4949
${DOCKER_COMPOSE} run -e CI=1 -e DOCKER_TEST=1 -e "PYTEST_ARGS=${PYTEST_ARGS}" --rm --name ${TMP_DOCKER_CT} ${DOCKER_IMG} make test_local
5050

51-
test_local:PYTEST_ARGS := $(or ${PYTEST_ARGS},--cov=django_web_utils --cov-report html --cov-report term tests/testapp/tests)
51+
test_local:PYTEST_ARGS := $(or ${PYTEST_ARGS},--cov --cov-report html --cov-report term tests/testapp/tests)
5252
test_local:
5353
pytest --reuse-db ${PYTEST_ARGS}
5454

55+
test_install:
56+
docker run --rm -it --name ${TMP_DOCKER_CT} --user root --entrypoint /usr/bin/make -v ${CURDIR}:/opt/src ${DOCKER_IMG} test_install_local
57+
58+
test_install_local:
59+
# List files that will be installed
60+
sudo make clean
61+
sudo rm /opt/venv/lib/python3.11/site-packages/django_web_utils
62+
sudo cp -a /opt/src /tmp/src
63+
cd /tmp/src && sudo /opt/venv/bin/pip install .
64+
cd /tmp/src && sudo /opt/venv/bin/pip show -f django-web-utils
65+
5566
generate_po:
5667
# Generate po files from source
57-
docker run --rm -it -e DOCKER_TEST=1 -v ${CURDIR}:/opt/src ${DOCKER_IMG} make generate_po_local
68+
docker run --rm -it -e DOCKER_TEST=1 --name ${TMP_DOCKER_CT} -v ${CURDIR}:/opt/src ${DOCKER_IMG} make generate_po_local
5869

5970
generate_po_local:
6071
cd django_web_utils \
@@ -68,7 +79,7 @@ generate_po_local:
6879

6980
generate_mo:
7081
# Generate mo files from po files
71-
docker run --rm -it -e DOCKER_TEST=1 -v ${CURDIR}:/opt/src ${DOCKER_IMG} make generate_mo_local
82+
docker run --rm -it -e DOCKER_TEST=1 --name ${TMP_DOCKER_CT} -v ${CURDIR}:/opt/src ${DOCKER_IMG} make generate_mo_local
7283

7384
generate_mo_local:
7485
cd django_web_utils \
@@ -97,5 +108,6 @@ translate:
97108

98109
clean:
99110
# Remove compiled Python files
111+
rm -rf build django_web_utils.egg-info
100112
find . -name '*.pyc' -delete
101113
find . -name __pycache__ -type d -delete

django_web_utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '21.1'
1+
__version__ = '22.0'

docker/Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ RUN apt-get -q update && apt-get -qy install --no-install-recommends \
1919
# Python venv
2020
RUN python3 -m venv /opt/venv --system-site-packages
2121
ENV PATH="/opt/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
22-
RUN pip install --upgrade pip setuptools wheel packaging
23-
COPY setup.py setup.py
24-
RUN pip install --no-cache-dir -e '.[dev]'
25-
RUN rm setup.py
22+
RUN pip install --upgrade pip setuptools wheel packaging uv
23+
# Install dependencies from pyproject.toml file using uv
24+
# (see issue https://github.com/pypa/pip/issues/11440)
25+
COPY pyproject.toml pyproject.toml
26+
RUN uv pip install -r pyproject.toml --extra dev
27+
RUN rm pyproject.toml
2628
RUN ln -sf /opt/src/django_web_utils /opt/venv/lib/python3.11/site-packages/django_web_utils
2729

2830
RUN mkdir -p /opt/src

pyproject.toml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
[build-system]
2+
build-backend = "setuptools.build_meta"
3+
requires = ["setuptools>=77.0"]
4+
5+
[project]
6+
name = "django-web-utils"
7+
description = "A collection of utilities for web projects based on Django."
8+
authors = [{name = "UbiCastTeam"}]
9+
dynamic = ["version"]
10+
license = "LGPL-3.0"
11+
license-files = ["LICENSE"]
12+
readme = "README.md"
13+
classifiers = [
14+
"Development Status :: 5 - Production/Stable",
15+
"Environment :: Web Environment",
16+
"Intended Audience :: Developers",
17+
"Operating System :: OS Independent",
18+
"Programming Language :: Python",
19+
"Programming Language :: Python :: 3 :: Only",
20+
"Topic :: Internet :: WWW/HTTP",
21+
]
22+
requires-python = ">=3.11"
23+
dependencies = [
24+
"bleach[css] >= 6.0, < 7.0",
25+
"pillow >= 11",
26+
]
27+
28+
[project.optional-dependencies]
29+
dev = [
30+
"django >= 4.2",
31+
"flake8",
32+
"psycopg[binary] >= 3.2",
33+
"pytest",
34+
"pytest-cov",
35+
"pytest-django",
36+
"vulture",
37+
]
38+
39+
[project.urls]
40+
Repository = "https://github.com/UbiCastTeam/django-web-utils"
41+
42+
[tool.setuptools]
43+
44+
[tool.setuptools.dynamic]
45+
version = {attr = "django_web_utils.__version__"}
46+
47+
[tool.setuptools.packages.find]
48+
include = ["django_web_utils*"]
49+
50+
[tool.setuptools.package-data]
51+
"*" = ["**/*"]
52+
53+
[tool.setuptools.exclude-package-data]
54+
"*" = ["*.pyc", "*.po"]
55+
56+
[tool.pytest.ini_options]
57+
addopts = "--verbose --tb=native --color=yes --durations=10"
58+
django_find_project = "false"
59+
log_date_format = "%H:%M:%S"
60+
log_format = "%(asctime)s.%(msecs)03d %(name)s %(levelname)s %(message)s"
61+
log_level = "DEBUG"
62+
norecursedirs = ".git submodules"
63+
testpaths = ["tests/"]
64+
65+
[tool.coverage.run]
66+
source_dirs = ["django_web_utils"]

pytest.ini

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

setup.py

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

0 commit comments

Comments
 (0)