From 1f520fcac0a9172ad269474a53d9c74678234de7 Mon Sep 17 00:00:00 2001 From: Timo Brembeck Date: Thu, 16 Nov 2023 14:08:38 +0100 Subject: [PATCH] Migrate from setup.py to pyproject.toml --- AUTHORS | 6 ---- MANIFEST.in | 1 - README.rst | 11 +++++++ linkcheck/build_meta.py | 23 +++++++++++++++ pyproject.toml | 63 +++++++++++++++++++++++++++++++++++++++++ setup.py | 50 -------------------------------- 6 files changed, 97 insertions(+), 57 deletions(-) delete mode 100644 AUTHORS create mode 100644 linkcheck/build_meta.py create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 1432766..0000000 --- a/AUTHORS +++ /dev/null @@ -1,6 +0,0 @@ -Andy Baker -Fruits Chen -Tim Graves -Jannis Leidel -Claude Paroz -Timo Ludwig diff --git a/MANIFEST.in b/MANIFEST.in index 65d92bd..b979465 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,3 @@ -include AUTHORS include LICENSE include CHANGELOG include README.rst diff --git a/README.rst b/README.rst index 4fe3e0c..7da35fd 100644 --- a/README.rst +++ b/README.rst @@ -281,3 +281,14 @@ If you want to contribute translations for ``LOCALE``, run: django-admin makemessages --locale LOCALE and edit the corresponding file in ``linkcheck/locale/LOCALE/LC_MESSAGES/django.po``. + +Create new release +~~~~~~~~~~~~~~~~~~ + +1. Bump version in `pyproject.toml <./pyproject.toml>`_ +2. Update `CHANGELOG <./CHANGELOG>`_ +3. Create release commit: ``git commit --message "Release vX.Y.Z"`` +4. Create git tag: ``git tag -a "X.Y.Z" -m "Release vX.Y.Z"`` +5. Push the commit and tag to the repository: ``git push && git push --tags`` +6. Build the source distribution: ``python -m build`` +7. Publish the package to PyPI: ``twine upload dist/django-linkcheck-X.Y.Z*`` diff --git a/linkcheck/build_meta.py b/linkcheck/build_meta.py new file mode 100644 index 0000000..435f55d --- /dev/null +++ b/linkcheck/build_meta.py @@ -0,0 +1,23 @@ +import subprocess + +from setuptools import build_meta as default +from setuptools.build_meta import * # noqa: F401, F403 + + +def compile_translation_files(): + print("Compile translation files") + subprocess.run(["django-admin", "compilemessages"], cwd="linkcheck") + + +def build_sdist(sdist_directory, config_settings=None): + compile_translation_files() + return default.build_sdist(sdist_directory, config_settings) + + +def build_wheel(wheel_directory, config_settings=None, metadata_directory=None): + compile_translation_files() + return default.build_wheel( + wheel_directory, + config_settings=config_settings, + metadata_directory=metadata_directory, + ) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..760d33a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,63 @@ +[build-system] +requires = ["setuptools>=61.2"] +build-backend = "build_meta" +backend-path = ["linkcheck"] + +[project] +name = "django-linkcheck" +version = "2.2.1" +authors = [ + {name = "Andy Baker", email = "andy@andybak.net"}, + {name = "Fruits Chen", email = "fruitschen@gmail.com"}, + {name = "Tim Graves", email = "gravesit@gmail.com"}, + {name = "Jannis Leidel", email = "jannis@leidel.info"}, + {name = "Claude Paroz", email = "claude@2xlibre.net"}, + {name = "Timo Brembeck", email = "opensource@timo.brembeck.email"} +] +description = "A Django app that will analyze and report on links in any model that you register with it." +readme = "README.rst" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "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", + "Framework :: Django", + "Framework :: Django :: 3.2", + "Framework :: Django :: 4.1", + "Framework :: Django :: 4.2", +] +license = {text = "BSD-3-Clause"} +requires-python = ">=3.8" +dependencies = [ + "django>=3.2", + "requests", +] + +[project.urls] +Homepage = "https://github.com/DjangoAdminHackers/django-linkcheck" +Issues = "https://github.com/DjangoAdminHackers/django-linkcheck/issues" +Changelog = "https://github.com/DjangoAdminHackers/django-linkcheck/blob/master/CHANGELOG" + +[project.optional-dependencies] +dev = [ + "build", + "flake8", + "isort", + "pre-commit", +] + +[tool.setuptools] +include-package-data = true +license-files = ["LICENSE"] + +[tool.setuptools.packages.find] +include = ["linkcheck*"] diff --git a/setup.py b/setup.py deleted file mode 100644 index b53f5a4..0000000 --- a/setup.py +++ /dev/null @@ -1,50 +0,0 @@ -import os -import subprocess -import sys - -from setuptools import find_packages, setup - - -def read(fname): - return open(os.path.join(os.path.dirname(__file__), fname)).read() - - -if 'sdist' in sys.argv[1:]: - subprocess.run(["django-admin", "compilemessages"], cwd="linkcheck") - -setup( - name='django-linkcheck', - version='2.2.1', - description="A Django app that will analyze and report on links in any " - "model that you register with it.", - long_description=read('README.rst'), - author='Andy Baker', - author_email='andy@andybak.net', - license='BSD', - url='https://github.com/DjangoAdminHackers/django-linkcheck', - packages=find_packages(), - include_package_data=True, - install_requires=['django>=3.2', 'requests'], - extras_require={ - "dev": ["flake8", "isort", "pre-commit"], - }, - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Web Environment', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3 :: Only', - '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', - 'Framework :: Django', - "Framework :: Django :: 3.2", - "Framework :: Django :: 4.1", - "Framework :: Django :: 4.2", - ], -)