From b1dd37ed0ca5d38907812a795b81d64a36d36b6f Mon Sep 17 00:00:00 2001 From: Hanne Moa Date: Thu, 22 Feb 2024 23:06:32 +0100 Subject: [PATCH] Tomlify setup.py (#216) * Move setup.py stuff to setup.cfg * Run ini2toml on setup.cfg .. fix casing of DJANGO_SETTINGS_MODULE --- pyproject.toml | 63 +++++++++++++++++++++++++++++++++++ setup.cfg | 4 --- setup.py | 90 -------------------------------------------------- tox.ini | 1 + 4 files changed, 64 insertions(+), 94 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..c3a9866 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,63 @@ +[build-system] +requires = ["setuptools>=61.2"] +build-backend = "setuptools.build_meta" + +[project] +name = "django_csp" +version = "3.8rc" +description = "Django Content Security Policy support." +readme = "README.rst" +authors = [{name = "James Socol", email = "me@jamessocol.com"}] +maintainers = [{name = "Mozilla MEAO team", email = "meao-backend@mozilla.com"}] +license = {text = "BSD"} +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "Environment :: Web Environment :: Mozilla", + "Programming Language :: Python", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Intended Audience :: Developers", + "Topic :: Software Development :: Libraries :: Python Modules", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: Implementation :: PyPy", + "Programming Language :: Python :: Implementation :: CPython", + "Framework :: Django :: 3.2", + "Framework :: Django :: 4.2", + "Framework :: Django :: 5.0", +] +dependencies = ["Django>=3.2"] + +[project.urls] +Homepage = "http://github.com/mozilla/django-csp" +Documentation = "http://django-csp.readthedocs.org/" +Changelog = "https://github.com/mozilla/django-csp/blob/main/CHANGES" +"Bug Tracker" = "https://github.com/mozilla/django-csp/issues" +"Source Code" = "https://github.com/mozilla/django-csp" + +[project.optional-dependencies] +tests = [ + "pytest", + "pytest-cov", + "pytest-django", + "pytest-ruff", + "jinja2>=2.9.6", +] +jinja2 = ["jinja2>=2.9.6"] + +[tool.setuptools] +zip-safe = false +include-package-data = true + +[tool.setuptools.packages] +find = {namespaces = false} + +[tool.pytest.ini_options] +addopts = "-vs --tb=short --ruff --ruff-format" +DJANGO_SETTINGS_MODULE = "csp.tests.settings" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 6476415..0000000 --- a/setup.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[tool:pytest] -addopts = -vs --tb=short --ruff --ruff-format - -DJANGO_SETTINGS_MODULE = csp.tests.settings diff --git a/setup.py b/setup.py deleted file mode 100644 index 704a18c..0000000 --- a/setup.py +++ /dev/null @@ -1,90 +0,0 @@ -import codecs -import os -import sys - -from setuptools import find_packages, setup - -version = "3.8rc" - - -if sys.argv[-1] == "publish": - os.system("python setup.py sdist upload") - os.system("python setup.py bdist_wheel upload") - print("You probably want to also tag the version now:") - print(f' git tag -a {version} -m "version {version}"') - print(" git push --tags") - sys.exit() - - -def read(*parts): - filename = os.path.join(os.path.dirname(__file__), *parts) - with codecs.open(filename, encoding="utf-8") as fp: - return fp.read() - - -install_requires = [ - "Django>=3.2", -] - -jinja2_requires = [ - "jinja2>=2.9.6", -] - -test_requires = [ - "pytest", - "pytest-cov", - "pytest-django", - "pytest-ruff", -] - -test_requires += jinja2_requires - - -setup( - name="django_csp", - version=version, - description="Django Content Security Policy support.", - long_description=read("README.rst"), - author="James Socol", - author_email="me@jamessocol.com", - maintainer="Mozilla MEAO team", - maintainer_email="meao-backend@mozilla.com", - url="http://github.com/mozilla/django-csp", - license="BSD", - packages=find_packages(), - project_urls={ - "Documentation": "http://django-csp.readthedocs.org/", - "Changelog": "https://github.com/mozilla/django-csp/blob/main/CHANGES", - "Bug Tracker": "https://github.com/mozilla/django-csp/issues", - "Source Code": "https://github.com/mozilla/django-csp", - }, - install_requires=install_requires, - extras_require={ - "tests": test_requires, - "jinja2": jinja2_requires, - }, - include_package_data=True, - zip_safe=False, - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Environment :: Web Environment", - "Environment :: Web Environment :: Mozilla", - "Programming Language :: Python", - "License :: OSI Approved :: BSD License", - "Operating System :: OS Independent", - "Intended Audience :: Developers", - "Topic :: Software Development :: Libraries :: Python Modules", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: Implementation :: PyPy", - "Programming Language :: Python :: Implementation :: CPython", - "Framework :: Django :: 3.2", - "Framework :: Django :: 4.2", - "Framework :: Django :: 5.0", - ], -) diff --git a/tox.ini b/tox.ini index 4f82062..2390c44 100644 --- a/tox.ini +++ b/tox.ini @@ -1,4 +1,5 @@ [tox] +isolated_build = True envlist = {3.10,3.11,3.12,pypy310}-main {3.10,3.11,3.12,pypy310}-5.0.x