Skip to content

Commit 8b474e4

Browse files
jpm-cbnaTheoLechemia
authored andcommitted
feat: mordernise setup.py with pyproject.toml
1 parent 138b319 commit 8b474e4

File tree

6 files changed

+64
-55
lines changed

6 files changed

+64
-55
lines changed

.github/workflows/test_install.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
check-requirements-install:
66
strategy:
77
matrix:
8-
python-version: [ "3.9", "3.12" ]
8+
python-version: [ "3.9", "3.11" ]
99

1010
runs-on: ubuntu-latest
1111
steps:

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM python:3.11.9-bookworm AS build
33
ENV PIP_ROOT_USER_ACTION=ignore
44

55
RUN --mount=type=cache,target=/root/.cache \
6-
pip install --upgrade pip setuptools wheel
6+
pip install --upgrade pip build
77

88
WORKDIR /build/
99

@@ -14,9 +14,9 @@ COPY /MANIFEST.in .
1414
COPY /pyproject.toml .
1515
COPY /README.rst .
1616
COPY /requirements.in .
17-
COPY /setup.py .
17+
COPY /pyproject.toml .
1818
COPY /VERSION .
19-
RUN python setup.py bdist_wheel
19+
RUN python -m build
2020

2121

2222
FROM node:alpine AS node
@@ -55,7 +55,7 @@ RUN --mount=type=cache,target=/root/.cache \
5555

5656
COPY --from=build /build/dist/*.whl .
5757
RUN --mount=type=cache,target=/root/.cache \
58-
pip install *.whl
58+
pip install --no-deps *.whl
5959

6060
WORKDIR /dist/
6161

pyproject.toml

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,37 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "geonature-atlas"
7+
description = "Atlas WEB dynamique Faune-Flore basé sur les données présentes dans la synthèse de GeoNature"
8+
readme = "README.rst"
9+
requires-python = ">=3"
10+
license = { text = "GNU General Public License v3" }
11+
maintainers = [
12+
{ name = "Parcs nationaux des Écrins et des Cévennes", email = "[email protected]" },
13+
]
14+
classifiers = [
15+
"Development Status :: 1 - Planning",
16+
"Intended Audience :: Developers",
17+
"Natural Language :: English",
18+
"Programming Language :: Python :: 3",
19+
"License :: OSI Approved :: GNU General Public License v3",
20+
"Operating System :: OS Independent",
21+
]
22+
dynamic = ["version", "dependencies"]
23+
24+
[project.urls]
25+
Homepage = "https://github.com/PnX-SI/GeoNature-Atlas"
26+
27+
[tool.setuptools.dynamic]
28+
version = { file = "VERSION" }
29+
dependencies = { file = "requirements.in" }
30+
31+
[tool.setuptools.packages.find]
32+
where = ["."]
33+
exclude = ["docs*", "tests*"]
34+
135
[tool.black]
236
line-length = 99
337
exclude ='''
@@ -17,5 +51,25 @@ exclude ='''
1751
| venv
1852
| dependencies
1953
)/
20-
)
2154
'''
55+
56+
[tool.tox]
57+
legacy_tox_ini = """
58+
[tox]
59+
envlist = clean,py39,py311
60+
61+
[testenv]
62+
description = Run tests with pytest
63+
deps =
64+
-r requirements.txt
65+
pytest
66+
pytest-cov
67+
pytest-flask
68+
commands =
69+
pytest --cov=atlas
70+
71+
[testenv:clean]
72+
deps = coverage
73+
skip_install = true
74+
commands = coverage erase
75+
"""

requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
#
55
# pip-compile requirements.in
66
#
7+
# Compile with the lowest Python version available to get the most compatible.
8+
# To update, use Docker with lowest Python version available. Ex. for Python 3.9:
9+
# docker run --rm -v "$(pwd)":/app -w /app python:3.9-slim sh -c "apt-get update && apt-get install -y libpq-dev build-essential && pip install pip-tools && pip-compile requirements.in"
10+
#
711
babel==2.17.0
812
# via flask-babel
913
backports-datetime-fromisoformat==2.0.3

setup.py

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

tox.ini

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

0 commit comments

Comments
 (0)