Skip to content

Commit 14c4659

Browse files
authored
Replace the setup.py/setup.cfg by pyproject.toml (#329)
Signed-off-by: tdruez <[email protected]>
1 parent 8d842a9 commit 14c4659

File tree

12 files changed

+213
-228
lines changed

12 files changed

+213
-228
lines changed

.github/workflows/find-vulnerabilities.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- uses: actions/checkout@v4
1111
with:
1212
path: scancode-inputs
13-
sparse-checkout: setup.cfg
13+
sparse-checkout: pyproject.toml
1414
sparse-checkout-cone-mode: false
1515

1616
- uses: aboutcode-org/scancode-action@main

CHANGELOG.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ Release notes
77
https://github.com/aboutcode-org/dejacode/pull/315
88
https://github.com/aboutcode-org/dejacode/pull/312
99

10+
- Replace the setup.py/setup.cfg by pyproject.toml file.
11+
https://github.com/aboutcode-org/dejacode/pull/329
12+
1013
- Replace the hardcoded ``/var/www/html`` by a ``webroot`` named volume in
1114
``docker-compose.yml``.
1215
In the Docker compose ``nginx`` service, the hardcoded ``/var/www/html`` was declared

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ RUN python -m venv $VENV_LOCATION
6262
ENV PATH=$VENV_LOCATION/bin:$PATH
6363

6464
# Install the dependencies before the codebase COPY for proper Docker layer caching
65-
COPY --chown=$APP_USER:$APP_USER setup.cfg setup.py $APP_DIR/
65+
COPY --chown=$APP_USER:$APP_USER pyproject.toml $APP_DIR/
6666
COPY --chown=$APP_USER:$APP_USER ./thirdparty/dist/ $APP_DIR/thirdparty/dist/
6767
RUN pip install --find-links=$APP_DIR/thirdparty/dist/ --no-index --no-cache-dir .
6868

RELEASE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
- Create a new `release-x.x.x` branch
66
- Update the version in:
7-
- `setup.cfg`
7+
- `pyproject.toml`
88
- `dejacode/__init__.py`
99
- `CHANGELOG.rst` (set date)
1010
- Commit and push this branch

dejacode_toolkit/download.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# See https://aboutcode.org for more information about AboutCode FOSS projects.
77
#
88

9-
import socket
109
from pathlib import Path
1110
from urllib.parse import unquote
1211
from urllib.parse import urlparse
@@ -31,7 +30,7 @@ class DataCollectionException(Exception):
3130
def collect_package_data(url):
3231
try:
3332
response = requests.get(url, timeout=5, stream=True)
34-
except (requests.RequestException, socket.timeout) as e:
33+
except (TimeoutError, requests.RequestException) as e:
3534
raise DataCollectionException(e)
3635

3736
if response.status_code != 200:

dje/outputs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
import json
1010
import re
11+
from datetime import UTC
1112
from datetime import datetime
12-
from datetime import timezone
1313

1414
from django.http import FileResponse
1515
from django.http import Http404
@@ -223,7 +223,7 @@ def get_cyclonedx_filename(instance, extension="cdx"):
223223

224224
def get_csaf_document(product):
225225
"""Return a csaf.Document object using the provided `product` context."""
226-
now = datetime.now(timezone.utc).isoformat(timespec="seconds")
226+
now = datetime.now(UTC).isoformat(timespec="seconds")
227227
publisher = csaf.Publisher(
228228
category="vendor",
229229
name=product.dataspace.name,

dje/tests/test_outputs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
#
88

99
import json
10+
from datetime import UTC
1011
from datetime import datetime
11-
from datetime import timezone
1212
from pathlib import Path
1313
from unittest import mock
1414

@@ -187,7 +187,7 @@ def test_outputs_get_csaf_security_advisory(self):
187187
detail="Need an update",
188188
)
189189

190-
mock_now = datetime(2024, 12, 19, 12, 0, 0, tzinfo=timezone.utc)
190+
mock_now = datetime(2024, 12, 19, 12, 0, 0, tzinfo=UTC)
191191
with mock.patch("dje.outputs.datetime") as mock_datetime:
192192
mock_datetime.now.return_value = mock_now
193193
mock_datetime.side_effect = lambda *args, **kwargs: datetime(*args, **kwargs)

license_library/tests/test_admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,7 @@ def test_short_and_long_descriptions(self):
13501350
def test_history_list_filter(self):
13511351
with patch("dje.filters.timezone.now") as mock_timezone:
13521352
fake_now = datetime.datetime(year=2012, month=8, day=1)
1353-
fake_now = fake_now.astimezone(datetime.timezone.utc)
1353+
fake_now = fake_now.astimezone(datetime.UTC)
13541354
# patch timezone.now() so that it Return a consistent date
13551355
mock_timezone.return_value = fake_now
13561356

organization/tests/test_filters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def setUp(self):
6464
# time *anytime* the model is saved, so to set a custom value for
6565
# action_time we use QuerySet.update()
6666
fake_now = datetime.datetime(year=2012, month=8, day=1)
67-
self.fake_now = fake_now.astimezone(datetime.timezone.utc)
67+
self.fake_now = fake_now.astimezone(datetime.UTC)
6868

6969
# create LogEntry objects for the owners
7070

pyproject.toml

Lines changed: 200 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,200 @@
1+
[build-system]
2+
requires = ["setuptools", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "dejacode"
7+
version = "5.3.1-dev"
8+
description = "Automate open source license compliance and ensure supply chain integrity"
9+
readme = "README.rst"
10+
requires-python = ">=3.13,<3.14"
11+
license = "AGPL-3.0-only"
12+
license-files = ["LICENSE", "NOTICE"]
13+
authors = [
14+
{ name = "nexB Inc.", email = "[email protected]" }
15+
]
16+
keywords = [
17+
"open source", "scan", "license", "package", "dependency",
18+
"copyright", "filetype", "author", "extract", "licensing",
19+
"scancode", "scanpipe", "docker", "rootfs", "vm",
20+
"virtual machine", "pipeline", "code analysis", "container"
21+
]
22+
classifiers = [
23+
"Development Status :: 5 - Production/Stable",
24+
"Intended Audience :: Developers",
25+
"Intended Audience :: Information Technology",
26+
"Intended Audience :: Legal Industry",
27+
"Programming Language :: Python",
28+
"Programming Language :: Python :: 3 :: Only",
29+
"Programming Language :: Python :: 3.13",
30+
"Topic :: Utilities"
31+
]
32+
dependencies = [
33+
# Base configuration tools
34+
"setuptools==80.9.0",
35+
"wheel==0.45.1",
36+
"pip==25.1.1",
37+
# Django
38+
"Django==5.2.3",
39+
"asgiref==3.8.1",
40+
"typing_extensions==4.14.0",
41+
"sqlparse==0.5.3",
42+
# Django apps
43+
"django-crispy-forms==2.4",
44+
"crispy_bootstrap5==2025.6",
45+
"django-grappelli==4.0.2",
46+
"django-filter==25.1",
47+
"django-registration==3.4",
48+
"confusable_homoglyphs==3.3.1",
49+
"django-guardian==3.0.0",
50+
"django-environ==0.12.0",
51+
"django-debug-toolbar==5.2.0",
52+
# CAPTCHA
53+
"altcha==0.2.0",
54+
"django_altcha==0.2.0",
55+
# REST API
56+
"djangorestframework==3.16.0",
57+
# API documentation
58+
"drf-yasg==1.21.10",
59+
"uritemplate==4.1.1",
60+
"inflection==0.5.1",
61+
"pytz==2025.2",
62+
# Track failed login attempts
63+
"django-axes==8.0.0",
64+
# Multi-factor authentication
65+
"django-otp==1.6.0",
66+
"qrcode==8.2",
67+
"pypng==0.20220715.0",
68+
# Database
69+
"psycopg==3.2.9",
70+
# Cache
71+
"redis==6.2.0",
72+
# redis dependencies:
73+
"packaging==25.0",
74+
"pyparsing==3.2.3",
75+
"async-timeout==5.0.1",
76+
"Deprecated==1.2.18",
77+
"wrapt==1.17.2",
78+
# Antivirus
79+
"clamd==1.0.2",
80+
# Testing
81+
"model_bakery==1.10.1",
82+
# Task queue
83+
"rq==2.3.3",
84+
"django-rq==3.0.1",
85+
"fakeredis==2.29.0",
86+
# Scheduler
87+
"rq-scheduler==0.14.0",
88+
"crontab==1.0.4",
89+
"freezegun==1.5.2",
90+
# Libs
91+
"certifi==2025.4.26",
92+
"urllib3==2.4.0",
93+
"python-dateutil==2.9.0.post0",
94+
"python-mimeparse==2.0.0",
95+
"PyJWT==2.10.1",
96+
"natsort==8.4.0",
97+
"six==1.17.0",
98+
"requests==2.32.4",
99+
"idna==3.10",
100+
"charset-normalizer==3.4.2",
101+
"PyYAML==6.0.2",
102+
"cython==3.1.1",
103+
"zipp==3.22.0",
104+
"XlsxWriter==3.2.3",
105+
# Markdown
106+
"markdown==3.8",
107+
"bleach==6.2.0",
108+
"bleach_allowlist==1.0.3",
109+
"webencodings==0.5.1",
110+
# Authentication
111+
"oauthlib==3.2.2",
112+
"python3-openid==3.2.0",
113+
"requests-oauthlib==2.0.0",
114+
"defusedxml==0.7.1",
115+
# LDAP Auth
116+
"python-ldap==3.4.4",
117+
"pyasn1==0.6.1",
118+
"pyasn1-modules==0.4.2",
119+
"django-auth-ldap==5.2.0",
120+
# LDAP Testing
121+
"mockldap==0.3.0.post1",
122+
"funcparserlib==0.3.6",
123+
# license expressions
124+
"boolean.py==5.0",
125+
"license-expression==30.4.1",
126+
# Webhooks
127+
"django-rest-hooks==1.6.1",
128+
# django-notifications
129+
"django_notifications_patched==2.0.0",
130+
"jsonfield==3.1.0",
131+
"swapper==1.4.0",
132+
# AboutCode Toolkit
133+
"aboutcode_toolkit==11.1.1",
134+
"click==8.2.1",
135+
"Jinja2==3.1.6",
136+
"MarkupSafe==3.0.2",
137+
"saneyaml==0.6.1",
138+
"openpyxl==3.1.5",
139+
"et-xmlfile==2.0.0",
140+
# PackageURL
141+
"packageurl-python==0.17.1",
142+
# Gunicorn
143+
"gunicorn==23.0.0",
144+
# SPDX validation
145+
"jsonschema==4.24.0",
146+
"jsonschema-specifications==2025.4.1",
147+
"referencing==0.36.2",
148+
"rpds-py==0.25.1",
149+
"attrs==25.3.0",
150+
"pyrsistent==0.20.0",
151+
# CycloneDX
152+
"cyclonedx-python-lib==10.2.0",
153+
"sortedcontainers==2.4.0",
154+
"toml==0.10.2",
155+
"py-serializable==2.0.0",
156+
# Git
157+
"GitPython==3.1.44",
158+
"gitdb==4.0.12",
159+
"smmap==5.0.2",
160+
# CSAF
161+
"pydantic==2.11.5",
162+
"pydantic-core==2.33.2",
163+
"typing-inspection==0.4.1",
164+
"maturin==1.8.6",
165+
"setuptools-rust==1.11.1",
166+
"annotated-types==0.7.0",
167+
"semantic-version==2.10.0"
168+
]
169+
170+
[project.optional-dependencies]
171+
dev = [
172+
# Linter and Validation
173+
"ruff==0.11.12",
174+
# Documentation
175+
"doc8==1.1.2",
176+
"stevedore==5.4.1",
177+
"Pygments==2.19.1",
178+
"docutils==0.21.2",
179+
"restructuredtext-lint==1.4.0",
180+
"pbr==6.1.1",
181+
# Parallel testing
182+
"tblib==3.1.0"
183+
]
184+
185+
[project.urls]
186+
Homepage = "https://github.com/aboutcode-org/dejacode"
187+
Documentation = "https://dejacode.readthedocs.io/"
188+
Repository = "https://github.com/aboutcode-org/dejacode.git"
189+
Issues = "https://github.com/aboutcode-org/dejacode/issues"
190+
Changelog = "https://github.com/aboutcode-org/dejacode/blob/main/CHANGELOG.rst"
191+
192+
[project.scripts]
193+
dejacode = "dejacode:command_line"
194+
195+
[tool.setuptools.packages.find]
196+
where = ["."]
197+
1198
[tool.ruff]
2199
line-length = 100
3200
exclude = [
@@ -25,7 +222,7 @@ select = [
25222
"I", # isort
26223
"C9", # McCabe complexity
27224
]
28-
ignore = ["UP032", "D1", "D203", "D205", "D212", "D400", "D415", "S308"]
225+
ignore = ["UP032", "UP038", "D1", "D203", "D205", "D212", "D400", "D415", "S308"]
29226

30227
[tool.ruff.lint.isort]
31228
force-single-line = true
@@ -40,10 +237,11 @@ section-order = [
40237
]
41238

42239
[tool.ruff.lint.mccabe]
43-
max-complexity = 17
240+
max-complexity = 16
44241

45242
[tool.ruff.lint.per-file-ignores]
46243
# Do not run bandit on test files.
47244
"**/tests/*" = ["S"]
48245
"dejacode_toolkit/csaf/*" = ["D", "UP", "E501", "F401"]
49246
"dejacode_toolkit/spdx.py" = ["UP"]
247+
"component_catalog/models.py" = ["C901"]

0 commit comments

Comments
 (0)