From e06af9a694ad04ff224354264818b6693a61de37 Mon Sep 17 00:00:00 2001 From: Victorien <65306057+Viicos@users.noreply.github.com> Date: Tue, 28 May 2024 14:14:53 +0200 Subject: [PATCH] Use `pyproject.toml` to specify package metadata (#134) --- .gitignore | 1 + pyproject.toml | 42 ++++++++++++++++++++++++++++++++++++ setup.py | 58 -------------------------------------------------- 3 files changed, 43 insertions(+), 58 deletions(-) delete mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 0bc5cc3..33aa965 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,6 @@ __pycache__ venv dist files +.mypy_cache .DS_STORE diff --git a/pyproject.toml b/pyproject.toml index e6bfd45..a9bdbb9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,45 @@ +[build-system] +requires = ["setuptools>=61.0.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "django-solo" +description = "Django Solo helps working with singletons" +authors = [{name = "lazybird"}] +maintainers = [ + {name = "John Hagen", email = "johnthagen@gmail.com"} +] +readme = "README.md" +requires-python = ">=3.8" +classifiers = [ + "Framework :: Django :: 3.2", + "Framework :: Django :: 4.2", + "Framework :: Django :: 5.0", + "Intended Audience :: Developers", + "Operating System :: OS Independent", + "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", +] +dependencies = [ + "django>=3.2", + "typing-extensions>=4.0.1; python_version < '3.11'", +] +license = {text = "Creative Commons Attribution 3.0 Unported"} +dynamic = ["version"] + +[tool.setuptools.dynamic] +version = {attr = "solo.__version__"} + +[project.urls] +Homepage = "https://github.com/lazybird/django-solo/" +Source = "https://github.com/lazybird/django-solo/" +Changelog = "https://github.com/lazybird/django-solo/blob/master/CHANGES" + [tool.mypy] ignore_missing_imports = true strict = true diff --git a/setup.py b/setup.py deleted file mode 100644 index 1577cb5..0000000 --- a/setup.py +++ /dev/null @@ -1,58 +0,0 @@ -import os -import re - -from setuptools import setup, find_packages - -README = os.path.join(os.path.dirname(__file__), 'README.md') - -# When running tests using tox, README.md is not found -try: - with open(README) as file: - long_description = file.read() -except Exception: - long_description = '' - - -def get_version(package): - """ - Return package version as listed in `__version__` in `__init__.py`. - """ - with open(os.path.join(package, '__init__.py')) as file: - init_py = file.read() - return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1) - - -version = get_version('solo') - -setup( - name='django-solo', - version=version, - description='Django Solo helps working with singletons', - python_requires='>=3.8', - install_requires=[ - 'django>=3.2', - 'typing-extensions>=4.0.1; python_version < "3.11"', - ], - packages=find_packages(), - url='https://github.com/lazybird/django-solo/', - author='lazybird', - long_description=open('README.md').read(), - long_description_content_type='text/markdown', - include_package_data=True, - zip_safe=False, - license='Creative Commons Attribution 3.0 Unported', - classifiers=[ - 'Framework :: Django :: 3.2', - 'Framework :: Django :: 4.2', - 'Framework :: Django :: 5.0', - 'Intended Audience :: Developers', - 'Operating System :: OS Independent', - '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', - ] -)