From 85efc14a2edac532df1a9ad4dd9b6d4a4dcf583e Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Thu, 7 Nov 2019 15:53:30 +0100 Subject: [PATCH] Fixed #30948 -- Changed packaging to use declarative config in setup.cfg. Co-authored-by: Nick Pope --- docs/internals/howto-release-django.txt | 2 +- docs/topics/auth/passwords.txt | 4 +- setup.cfg | 52 +++++++++++++++++++++ setup.py | 61 +------------------------ 4 files changed, 57 insertions(+), 62 deletions(-) diff --git a/docs/internals/howto-release-django.txt b/docs/internals/howto-release-django.txt index 00264ab2fa..8ada93b0ec 100644 --- a/docs/internals/howto-release-django.txt +++ b/docs/internals/howto-release-django.txt @@ -206,7 +206,7 @@ OK, this is the fun part, where we actually push out a release! on ``VERSION``. #. If this is a pre-release package, update the "Development Status" trove - classifier in ``setup.py`` to reflect this. Otherwise, make sure the + classifier in ``setup.cfg`` to reflect this. Otherwise, make sure the classifier is set to ``Development Status :: 5 - Production/Stable``. #. Tag the release using ``git tag``. For example:: diff --git a/docs/topics/auth/passwords.txt b/docs/topics/auth/passwords.txt index 44e80911ba..134ef14583 100644 --- a/docs/topics/auth/passwords.txt +++ b/docs/topics/auth/passwords.txt @@ -89,7 +89,7 @@ To use Argon2 as your default storage algorithm, do the following: #. Install the `argon2-cffi library`_. This can be done by running ``python -m pip install django[argon2]``, which is equivalent to ``python -m pip install argon2-cffi`` (along with any version requirement - from Django's ``setup.py``). + from Django's ``setup.cfg``). #. Modify :setting:`PASSWORD_HASHERS` to list ``Argon2PasswordHasher`` first. That is, in your settings file, you'd put:: @@ -119,7 +119,7 @@ To use Bcrypt as your default storage algorithm, do the following: #. Install the `bcrypt library`_. This can be done by running ``python -m pip install django[bcrypt]``, which is equivalent to ``python -m pip install bcrypt`` (along with any version requirement from - Django's ``setup.py``). + Django's ``setup.cfg``). #. Modify :setting:`PASSWORD_HASHERS` to list ``BCryptSHA256PasswordHasher`` first. That is, in your settings file, you'd put:: diff --git a/setup.cfg b/setup.cfg index 5dad034561..a14553e818 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,55 @@ +[metadata] +name = Django +version = attr: django.__version__ +url = https://www.djangoproject.com/ +author = Django Software Foundation +author_email = foundation@djangoproject.com +description = A high-level Python Web framework that encourages rapid development and clean, pragmatic design. +long_description = file: README.rst +license = BSD-3-Clause +classifiers = + Development Status :: 2 - Pre-Alpha + Environment :: Web Environment + Framework :: Django + 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.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Topic :: Internet :: WWW/HTTP + Topic :: Internet :: WWW/HTTP :: Dynamic Content + Topic :: Internet :: WWW/HTTP :: WSGI + Topic :: Software Development :: Libraries :: Application Frameworks + Topic :: Software Development :: Libraries :: Python Modules +project_urls = + Documentation = https://docs.djangoproject.com/ + Funding = https://www.djangoproject.com/fundraising/ + Source = https://github.com/django/django + Tracker = https://code.djangoproject.com/ + +[options] +python_requires = >=3.6 +packages = find: +scripts = django/bin/django-admin.py +include_package_data = true +zip_safe = false +install_requires = + asgiref + pytz + sqlparse >= 0.2.2 + +[options.entry_points] +console_scripts = + django-admin = django.core.management:execute_from_command_line + +[options.extras_require] +argon2 = argon2-cffi >= 16.1.0 +bcrypt = bcrypt + [bdist_rpm] doc_files = docs extras AUTHORS INSTALL LICENSE README.rst install-script = scripts/rpm-install.sh diff --git a/setup.py b/setup.py index 684a87f691..4afdf8a79a 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ import os import sys from distutils.sysconfig import get_python_lib -from setuptools import find_packages, setup +from setuptools import setup CURRENT_PYTHON = sys.version_info[:2] REQUIRED_PYTHON = (3, 6) @@ -52,64 +52,7 @@ if "install" in sys.argv: break -# Dynamically calculate the version based on django.VERSION. -version = __import__('django').get_version() - - -def read(fname): - with open(os.path.join(os.path.dirname(__file__), fname)) as f: - return f.read() - - -setup( - name='Django', - version=version, - python_requires='>={}.{}'.format(*REQUIRED_PYTHON), - url='https://www.djangoproject.com/', - author='Django Software Foundation', - author_email='foundation@djangoproject.com', - description=('A high-level Python Web framework that encourages ' - 'rapid development and clean, pragmatic design.'), - long_description=read('README.rst'), - license='BSD-3-Clause', - packages=find_packages(), - include_package_data=True, - scripts=['django/bin/django-admin.py'], - entry_points={'console_scripts': [ - 'django-admin = django.core.management:execute_from_command_line', - ]}, - install_requires=['pytz', 'sqlparse >= 0.2.2', 'asgiref'], - extras_require={ - "bcrypt": ["bcrypt"], - "argon2": ["argon2-cffi >= 16.1.0"], - }, - zip_safe=False, - classifiers=[ - 'Development Status :: 2 - Pre-Alpha', - 'Environment :: Web Environment', - 'Framework :: Django', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3 :: Only', - 'Topic :: Internet :: WWW/HTTP', - 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', - 'Topic :: Internet :: WWW/HTTP :: WSGI', - 'Topic :: Software Development :: Libraries :: Application Frameworks', - 'Topic :: Software Development :: Libraries :: Python Modules', - ], - project_urls={ - 'Documentation': 'https://docs.djangoproject.com/', - 'Funding': 'https://www.djangoproject.com/fundraising/', - 'Source': 'https://github.com/django/django', - 'Tracker': 'https://code.djangoproject.com/', - }, -) +setup() if overlay_warning: