build: switch to pyproject.toml for package building

Use the pyproject.toml configuration instead of setup.py for building
the package. This modernizes the build process, ensures better
compatibility with PEP tools, and simplifies dependency
management.
This commit is contained in:
Gabriel Barrantes 2025-09-04 14:59:47 -06:00
parent 7cc1121b29
commit e8fe5666b2
4 changed files with 57 additions and 54 deletions

View file

@ -3,7 +3,7 @@ name: Release
on:
push:
tags:
- '*'
- "*"
jobs:
build:
@ -22,13 +22,12 @@ jobs:
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U setuptools wheel twine
python -m pip install --upgrade pip
python -m pip install --upgrade build twine setuptools wheel
- name: Build package
run: |
python setup.py --version
python setup.py sdist --format=gztar bdist_wheel
python -m build --sdist --wheel --outdir dist
twine check dist/*
- name: Upload packages to Jazzband

View file

@ -31,6 +31,7 @@ jobs:
- name: Install dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
pip install "Django~=${{ matrix.django-version }}.0" .

View file

@ -1,3 +1,52 @@
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "dj-database-url"
version = "3.0.1"
description = "Use Database URLs in your Django Application."
readme = "README.rst"
requires-python = ">=3.9, <3.15"
license = { text = "BSD-3-Clause" }
authors = [
{ name = "Original Author: Kenneth Reitz, Maintained by: JazzBand Community" }
]
dependencies = [
"Django>=4.2"
]
classifiers = [
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Framework :: Django :: 5.1",
"Framework :: Django :: 5.2",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Software Development :: Libraries :: Python Modules"
]
[project.urls]
"GitHub" = "https://github.com/jazzband/dj-database-url/"
"Release log" = "https://github.com/jazzband/dj-database-url/blob/master/CHANGELOG.md"
[tool.setuptools.packages.find]
where = ["."]
include = ["dj_database_url*"]
[tool.setuptools.package-data]
"dj_database_url" = ["py.typed"]
[tool.black]
skip-string-normalization = 1

View file

@ -1,50 +1,4 @@
from pathlib import Path
from setuptools import setup
from setuptools import setup # pyright: ignore[reportUnknownVariableType]
readme = Path("README.rst").read_text()
setup(
name="dj-database-url",
version="3.0.1",
url="https://github.com/jazzband/dj-database-url",
license="BSD",
author="Original Author: Kenneth Reitz, Maintained by: JazzBand Community",
description="Use Database URLs in your Django Application.",
long_description=readme,
long_description_content_type="text/x-rst",
packages=["dj_database_url"],
install_requires=["Django>=4.2"],
include_package_data=True,
package_data={
"dj_database_url": ["py.typed"],
},
platforms="any",
project_urls={
"GitHub": "https://github.com/jazzband/dj-database-url/",
"Release log": (
"https://github.com/jazzband/dj-database-url/blob/master/CHANGELOG.md"
),
},
classifiers=[
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Framework :: Django :: 5.1",
"Framework :: Django :: 5.2",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Software Development :: Libraries :: Python Modules",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
],
)
if __name__ == "__main__":
setup()