Port most of setup.py to setup.cfg (#6239)

* try porting over setup.py config

* reduce duplication

* flake

* move long_description, remove more lines from setup.py
This commit is contained in:
Paul Kehrer 2021-08-29 16:38:34 -05:00 committed by GitHub
parent 4b2a3d630c
commit e703fb9f3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 84 additions and 117 deletions

View file

@ -1,6 +1,88 @@
[metadata]
name = cryptography
version = attr: cryptography.__version__
description = cryptography is a package which provides cryptographic recipes and primitives to Python developers.
long_description = file: README.rst
long_description_content_type = text/x-rst
license = BSD or Apache License, Version 2.0
url = https://github.com/pyca/cryptography
author = The Python Cryptographic Authority and individual contributors
author_email = cryptography-dev@python.org
project_urls =
Documentation=https://cryptography.io/
Source=https://github.com/pyca/cryptography/
Issues=https://github.com/pyca/cryptography/issues
Changelog=https://cryptography.io/en/latest/changelog/
classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
License :: OSI Approved :: Apache Software License
License :: OSI Approved :: BSD License
Natural Language :: English
Operating System :: MacOS :: MacOS X
Operating System :: POSIX
Operating System :: POSIX :: BSD
Operating System :: POSIX :: Linux
Operating System :: Microsoft :: Windows
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
Programming Language :: Python :: 3.9
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
Topic :: Security :: Cryptography
[options]
python_requires = >=3.6
include_package_data = True
zip_safe = False
package_dir =
=src
packages = find:
ext_package = cryptography.hazmat.bindings
# `install_requires` and `setup_requires` must be kept in sync with
# `pyproject.toml`
install_requires =
cffi >=1.12
setup_requires =
cffi >=1.12
setuptools_rust >= 0.11.4
[options.packages.find]
where = src
exclude =
_cffi_src
_cffi_src.*
[options.extras_require]
test =
pytest>=6.2.0
pytest-cov
pytest-subtests
pytest-xdist
pretend
iso8601
pytz
hypothesis>=1.11.4,!=3.79.2
docs =
sphinx >= 1.6.5,!=1.8.0,!=3.1.0,!=3.1.1
sphinx_rtd_theme
docstest =
doc8
pyenchant >= 1.6.11
twine >= 1.12.0
sphinxcontrib-spelling >= 4.0.1
sdist =
setuptools_rust >= 0.11.4
pep8test =
black
flake8
flake8-import-order
pep8-naming
# This extra is for OpenSSH private keys that use bcrypt KDF
# Versions: v3.1.3 - ignore_few_rounds, v3.1.5 - abi3
ssh =
bcrypt >= 3.1.5

View file

@ -8,7 +8,7 @@ import os
import platform
import sys
from setuptools import find_packages, setup
from setuptools import setup
try:
from setuptools_rust import RustExtension
@ -34,99 +34,9 @@ src_dir = os.path.join(base_dir, "src")
# means that we need to add the src/ directory to the sys.path.
sys.path.insert(0, src_dir)
about = {}
with open(os.path.join(src_dir, "cryptography", "__about__.py")) as f:
exec(f.read(), about)
# `install_requirements` and `setup_requirements` must be kept in sync with
# `pyproject.toml`
setuptools_rust = "setuptools-rust>=0.11.4"
install_requirements = ["cffi>=1.12"]
setup_requirements = install_requirements + [setuptools_rust]
with open(os.path.join(base_dir, "README.rst")) as f:
long_description = f.read()
try:
# See setup.cfg for most of the config metadata.
setup(
name=about["__title__"],
version=about["__version__"],
description=about["__summary__"],
long_description=long_description,
long_description_content_type="text/x-rst",
license=about["__license__"],
url=about["__uri__"],
author=about["__author__"],
author_email=about["__email__"],
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX",
"Operating System :: POSIX :: BSD",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
"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",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Security :: Cryptography",
],
package_dir={"": "src"},
packages=find_packages(
where="src", exclude=["_cffi_src", "_cffi_src.*"]
),
include_package_data=True,
python_requires=">=3.6",
install_requires=install_requirements,
setup_requires=setup_requirements,
extras_require={
"test": [
"pytest>=6.2.0",
"pytest-cov",
"pytest-subtests",
"pytest-xdist",
"pretend",
"iso8601",
"pytz",
"hypothesis>=1.11.4,!=3.79.2",
],
"docs": [
"sphinx >= 1.6.5,!=1.8.0,!=3.1.0,!=3.1.1",
"sphinx_rtd_theme",
],
"docstest": [
"doc8",
"pyenchant >= 1.6.11",
"twine >= 1.12.0",
"sphinxcontrib-spelling >= 4.0.1",
],
"sdist": [
setuptools_rust,
],
"pep8test": [
"black",
"flake8",
"flake8-import-order",
"pep8-naming",
],
# This extra is for OpenSSH private keys that use bcrypt KDF
# Versions: v3.1.3 - ignore_few_rounds, v3.1.5 - abi3
"ssh": ["bcrypt >= 3.1.5"],
},
# for cffi
zip_safe=False,
ext_package="cryptography.hazmat.bindings",
cffi_modules=[
"src/_cffi_src/build_openssl.py:ffi",
],

View file

@ -4,27 +4,12 @@
__all__ = [
"__title__",
"__summary__",
"__uri__",
"__version__",
"__author__",
"__email__",
"__license__",
"__copyright__",
]
__title__ = "cryptography"
__summary__ = (
"cryptography is a package which provides cryptographic recipes"
" and primitives to Python developers."
)
__uri__ = "https://github.com/pyca/cryptography"
__version__ = "35.0.0.dev1"
__author__ = "The Python Cryptographic Authority and individual contributors"
__email__ = "cryptography-dev@python.org"
__license__ = "BSD or Apache License, Version 2.0"
__copyright__ = "Copyright 2013-2021 {}".format(__author__)

View file

@ -6,22 +6,12 @@
from cryptography.__about__ import (
__author__,
__copyright__,
__email__,
__license__,
__summary__,
__title__,
__uri__,
__version__,
)
__all__ = [
"__title__",
"__summary__",
"__uri__",
"__version__",
"__author__",
"__email__",
"__license__",
"__copyright__",
]