Skip to content

Commit

Permalink
Convert setup.py metadata to setup.cfg (#457)
Browse files Browse the repository at this point in the history
Use [setup-py-upgrade](https://pypi.org/project/setup-py-upgrade/) plus some manual editing to move to the declarative metadata format.
  • Loading branch information
adamchainz committed Oct 20, 2019
1 parent f6611cb commit a6df4ed
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 70 deletions.
6 changes: 6 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ Pending

.. Insert new release notes below this line
* Converted setuptools metadata to configuration file. This meant removing the
``__version__`` attribute from the package. If you want to inspect the
installed version, use
``pkg_resources.get_distribution("django-cors-headers").version``
(`docs <https://setuptools.readthedocs.io/en/latest/pkg_resources.html#getting-or-creating-distributions>`__).

3.1.1 (2019-09-30)
------------------

Expand Down
2 changes: 0 additions & 2 deletions corsheaders/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
from corsheaders.checks import check_settings # noqa: F401

__version__ = "3.1.1"
54 changes: 48 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
[metadata]
name = django-cors-headers
version = 3.1.1
description = django-cors-headers is a Django application for handling the server headers required for Cross-Origin Resource Sharing (CORS).
long_description = file: README.rst, HISTORY.rst
long_description_content_type = text/x-rst
author = Otto Yiu
author_email = otto@live.ca
maintainer = Adam Johnson
maintainer_email = me@adamj.eu
url = https://github.com/adamchainz/django-cors-headers
project_urls =
Changelog = https://github.com/adamchainz/django-cors-headers/blob/master/HISTORY.rst
license = MIT License
keywords =
django
cors
middleware
rest
api
classifiers =
Development Status :: 5 - Production/Stable
Environment :: Web Environment
Framework :: Django
Framework :: Django :: 1.11
Framework :: Django :: 2.0
Framework :: Django :: 2.1
Framework :: Django :: 2.2
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Topic :: Software Development :: Libraries :: Application Frameworks
Topic :: Software Development :: Libraries :: Python Modules
license_file = LICENSE

[options]
packages = corsheaders
install_requires = Django>=1.11
python_requires = >=3.5

[flake8]
max-line-length = 80
select = C,E,F,W,B,B950
Expand All @@ -12,11 +57,8 @@ line_length = 88
multi_line_output = 3
use_parentheses = True

[metadata]
license_file = LICENSE

[tool:multilint]
paths = corsheaders
runtests.py
tests
setup.py
runtests.py
tests
setup.py
63 changes: 1 addition & 62 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,64 +1,3 @@
import os
import re

from setuptools import setup


def get_version(filename):
with open(filename, "r") as fp:
contents = fp.read()
return re.search(r"__version__ = ['\"]([^'\"]+)['\"]", contents).group(1)


version = get_version(os.path.join("corsheaders", "__init__.py"))

with open("README.rst", "r") as readme_file:
readme = readme_file.read()

with open("HISTORY.rst", "r") as history_file:
history = history_file.read()

setup(
name="django-cors-headers",
version=version,
description=(
"django-cors-headers is a Django application for handling the server "
"headers required for Cross-Origin Resource Sharing (CORS)."
),
long_description=readme + "\n\n" + history,
author="Otto Yiu",
author_email="otto@live.ca",
maintainer="Adam Johnson",
maintainer_email="me@adamj.eu",
url="https://github.com/adamchainz/django-cors-headers",
project_urls={
"Changelog": (
"https://github.com/adamchainz/django-cors-headers"
+ "/blob/master/HISTORY.rst"
)
},
packages=["corsheaders"],
license="MIT License",
keywords=["django", "cors", "middleware", "rest", "api"],
install_requires=["Django>=1.11"],
python_requires=">=3.5",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 1.11",
"Framework :: Django :: 2.0",
"Framework :: Django :: 2.1",
"Framework :: Django :: 2.2",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Software Development :: Libraries :: Application Frameworks",
"Topic :: Software Development :: Libraries :: Python Modules",
],
)
setup()

0 comments on commit a6df4ed

Please sign in to comment.