Modernize build to use Hatchling

Also adds a `requires-python` marker
This commit is contained in:
Aarni Koskela 2025-08-20 12:04:32 +03:00
parent 7cc1121b29
commit 2be8b03f66
4 changed files with 65 additions and 58 deletions

View file

@ -22,13 +22,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U setuptools wheel twine
python -m pip install -U build twine
- name: Build package
run: |
python setup.py --version
python setup.py sdist --format=gztar bdist_wheel
python -m build
twine check dist/*
- name: Upload packages to Jazzband

View file

@ -3,6 +3,8 @@ import os
import urllib.parse as urlparse
from typing import Any, Callable, Dict, List, Optional, TypedDict, Union
__version__ = "3.0.1"
DEFAULT_ENV = "DATABASE_URL"
ENGINE_SCHEMES: Dict[str, "Engine"] = {}

View file

@ -1,11 +1,68 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "dj-database-url"
dynamic = ["version"]
description = "Use Database URLs in your Django Application."
readme = "README.rst"
license = "BSD-3-Clause"
requires-python = ">=3.10"
authors = [
{ name = "Kenneth Reitz" },
{ name = "JazzBand Community" },
]
maintainers = [
{ name = "JazzBand Community" }
]
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",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"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",
]
dependencies = [
"Django>=4.2",
]
[project.urls]
GitHub = "https://github.com/jazzband/dj-database-url/"
Homepage = "https://github.com/jazzband/dj-database-url"
"Release log" = "https://github.com/jazzband/dj-database-url/blob/master/CHANGELOG.md"
[tool.hatch.version]
path = "dj_database_url/__init__.py"
[tool.hatch.build.targets.sdist]
include = [
"/dj_database_url",
"/tests",
]
[tool.black]
skip-string-normalization = 1
[tool.mypy]
show_error_codes=true
disallow_untyped_defs=true
disallow_untyped_calls=true
warn_redundant_casts=true
show_error_codes = true
disallow_untyped_defs = true
disallow_untyped_calls = true
warn_redundant_casts = true
[tool.pyright]
typeCheckingMode = "strict"

View file

@ -1,50 +0,0 @@
from pathlib import Path
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",
],
)