Skip to content

Commit

Permalink
Switch to using setup.cfg and add test checks for black/isort
Browse files Browse the repository at this point in the history
  • Loading branch information
markpeek committed Mar 27, 2021
1 parent 9d7fb62 commit f4b00ca
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 86 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ PYDIRS=setup.py examples scripts tests troposphere
test:
flake8 ${PYDIRS}
TROPO_REAL_BOOL=true python setup.py test
black --check ${PYDIRS}
isort --check ${PYDIRS}

spec:
curl -O https://d1uauaxba7bl26.cloudfront.net/latest/CloudFormationResourceSpecification.zip
Expand Down
57 changes: 57 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[metadata]
name = troposphere
version = attr: troposphere.__version__
url = https://github.com/cloudtools/troposphere
author = Mark Peek
author_email = [email protected]
description = AWS CloudFormation creation library
long_description = file: README.rst
long_description_content_type = text/x-rst
license = New BSD license
classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
project_urls =
Changelog = https://github.com/cloudtools/troposphere/blob/master/CHANGELOG.md
Source = https://github.com/cloudtools/troposphere
Tracker = https://github.com/cloudtools/troposphere/issues

[options]
test_suite = tests
tests_require = awacs>=0.8
include_package_data = true
install_requires =
typing-extensions >= 3.7.4.3; python_version < "3.8"
packages =
troposphere
troposphere.openstack
troposphere.helpers
scripts =
scripts/cfn
scripts/cfn2py
# typing.Any and typing.NoReturn were added in 3.6.2
python_requires = >=3.6.2
zip_safe = false

[options.extras_require]
policy = awacs>=0.8

[flake8]
max-line-length = 88
extend-ignore = E203, W503, E501

[pycodestyle]
max-line-length = 88
ignore = E203,W503,E501

[isort]
profile = black
87 changes: 1 addition & 86 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,88 +1,3 @@
"""
Setup
-----
Install troposphere in the current python environment.
"""
# ----------------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------------


# ---- System
import os
from setuptools import setup

# ----------------------------------------------------------------------------
# Helper Functions
# ----------------------------------------------------------------------------


def file_contents(file_name):
"""Given a file name to a valid file returns the file object."""
curr_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(curr_dir, file_name)) as the_file:
contents = the_file.read()
return contents


def get_version():
curr_dir = os.path.abspath(os.path.dirname(__file__))
with open(curr_dir + "/troposphere/__init__.py", "r") as init_version:
for line in init_version:
if "__version__" in line:
return str(line.split("=")[-1].strip(" ")[1:-2])

# ----------------------------------------------------------------------------
# Setup
# ----------------------------------------------------------------------------


setup(
name='troposphere',
version=get_version(),
description="AWS CloudFormation creation library",
long_description=file_contents("README.rst"),
long_description_content_type='text/x-rst',

author="Mark Peek",
author_email="[email protected]",
license="New BSD license",
url="https://github.com/cloudtools/troposphere",

classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",

"License :: OSI Approved :: BSD License",

"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: BSD",
"Operating System :: POSIX :: Linux",

"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.6",
],

packages=[
'troposphere',
'troposphere.openstack',
'troposphere.helpers'
],
scripts=[
'scripts/cfn',
'scripts/cfn2py'
],

python_requires=">=3.6",
install_requires=file_contents("requirements.txt"),
test_suite="tests",
tests_require=["awacs>=0.8"],
extras_require={'policy': ['awacs>=0.8']},
)
setup()

0 comments on commit f4b00ca

Please sign in to comment.