diff --git a/.stickler.yml b/.stickler.yml deleted file mode 100644 index 1f2f22c..0000000 --- a/.stickler.yml +++ /dev/null @@ -1,11 +0,0 @@ -linters: - shellcheck: - shell: bash - flake8: - max-line-length: 100 - max-complexity: 10 - ignore: 'W191,W391' - exclude: ['.git', '__pycache__', 'docs', '.tox', 'build'] - format: default -files: - ignore: ['*/*.pyc', '.tox/*', '*.pyc', '*~', '.git', '__pycache__', '*/__pycache__/*', '.git', 'tests'] diff --git a/.travis.yml b/.travis.yml index 2407e83..54c8ec1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ addons: # GitHub project metadata project: name: reactive-firewall/python-repo - version: 1.1.0 + version: 1.1.5 description: Python Repo Template # Commands to prepare for build_command # ** likely specific to your build ** diff --git a/README.md b/README.md index 94e47ff..bcd2966 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,14 @@ This repo is basically my template for new repos/projects # CI Template: -By default this template will assume that the Travis CI Service and Circle-CI Service are used for CI/CD +By default this template will assume that the GHA Service and Circle-CI Service are used for CI/CD # Status ### master: -[![status](https://travis-ci.org/reactive-firewall/python-repo.svg?branch=master)](https://travis-ci.org/reactive-firewall/python-repo) +[![CI](https://github.com/reactive-firewall/python-repo/actions/workflows/Tests.yml/badge.svg?branch=master)](https://github.com/reactive-firewall/python-repo/actions/workflows/Tests.yml) [![CircleCI](https://circleci.com/gh/reactive-firewall/python-repo/tree/master.svg?style=svg)](https://circleci.com/gh/reactive-firewall/python-repo/tree/master) +[![status](https://travis-ci.org/reactive-firewall/python-repo.svg?branch=master)](https://travis-ci.org/reactive-firewall/python-repo) [![Appveyor](https://ci.appveyor.com/api/projects/status/6gggp1wpbnnjokm4/branch/master?svg=true)](https://ci.appveyor.com/project/reactive-firewall/python-repo/branch/master) [![Python 3](https://pyup.io/repos/github/reactive-firewall/python-repo/python-3-shield.svg)](https://pyup.io/repos/github/reactive-firewall/PiAP-python-tools/) [![Updates](https://pyup.io/repos/github/reactive-firewall/python-repo/shield.svg)](https://pyup.io/repos/github/reactive-firewall/python-repo/) @@ -24,8 +25,9 @@ By default this template will assume that the Travis CI Service and Circle-CI Se ![commits-since](https://img.shields.io/github/commits-since/reactive-firewall/python-repo/stable.svg?maxAge=9000) ### Stable: -[![status](https://travis-ci.org/reactive-firewall/python-repo.svg?branch=stable)](https://travis-ci.org/reactive-firewall/python-repo) +[![CI](https://github.com/reactive-firewall/python-repo/actions/workflows/Tests.yml/badge.svg?branch=stable&event=pull_request)](https://github.com/reactive-firewall/python-repo/actions/workflows/Tests.yml) [![CircleCI](https://circleci.com/gh/reactive-firewall/python-repo/tree/stable.svg?style=svg)](https://circleci.com/gh/reactive-firewall/python-repo/tree/stable) +[![status](https://travis-ci.org/reactive-firewall/python-repo.svg?branch=stable)](https://travis-ci.org/reactive-firewall/python-repo) [![Appveyor](https://ci.appveyor.com/api/projects/status/6gggp1wpbnnjokm4/branch/stable?svg=true)](https://ci.appveyor.com/project/reactive-firewall/python-repo/branch/stable) [![code coverage](https://codecov.io/gh/reactive-firewall/python-repo/branch/stable/graph/badge.svg)](https://codecov.io/gh/reactive-firewall/python-repo/branch/stable/) [![code coverage](https://codecov.io/gh/reactive-firewall/python-repo/branch/stable/graph/badge.svg)](https://codecov.io/gh/reactive-firewall/python-repo/branch/stable/) @@ -71,7 +73,7 @@ make clean ; # cleans up for next test # Next steps: Like automation? Then integrate away, this template can take it! -(hint: @travis-ci, @houndci-bot, @pyup-bot, @stickler-ci, @circleci, @codecov-io, @lemurheavy, @coverallsapp, @codeclimate) +(hint: @coderabbitai, @travis-ci, @houndci-bot, @pyup-bot, @circleci, @codecov-io, @lemurheavy, @coverallsapp, @codeclimate) Not in a rush? Then be sure to edit the badges in the README. (hint: `sed -e 's/python-repo/MY-NEW-REPO' ./README.md`) diff --git a/pythonrepo/__init__.py b/pythonrepo/__init__.py index 30f5295..b24afa4 100644 --- a/pythonrepo/__init__.py +++ b/pythonrepo/__init__.py @@ -23,8 +23,8 @@ """This is pythonrepo module Template.""" -__version__ = """1.1.4""" -"""This is version 1.1.4 of pythonrepo Template""" +__version__ = """1.1.5""" +"""This is version 1.1.5 of pythonrepo Template""" try: diff --git a/setup.cfg b/setup.cfg index 621fe9a..437606e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,30 +1,45 @@ [metadata] name = pythonrepo -version = 1.1.4 +version = 1.1.5 author = Mr. Walls -author-email = reactive-firewall@users.noreply.github.com -summary = python-repo template -description = file: README.md -home-page = https://github.com/reactive-firewall/python-repo -download-url = https://github.com/reactive-firewall/python-repo.git -license = file: LICENSE.md +author_email = reactive-firewall@users.noreply.github.com +description = python-repo template +long_description = file:README.md +long_description_content_type = text/markdown +url = https://github.com/reactive-firewall/python-repo +download_url = https://github.com/reactive-firewall/python-repo.git classifiers = - Development Status :: 4 - Beta - Operating System :: POSIX :: Linux - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.12 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.5 - Programming Language :: Python :: 3.4 - Programming Language :: Python :: 3.3 - Programming Language :: Python :: 2.7 - Topic :: Security + Development Status :: 4 - Beta + Operating System :: MacOS :: MacOS X + Operating System :: POSIX :: Linux + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.14 + Programming Language :: Python :: 3.13 + Programming Language :: Python :: 3.12 + Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.4 + Programming Language :: Python :: 3.3 + Programming Language :: Python :: 2.7 + Topic :: Software Development :: Libraries :: Python Modules + Topic :: Security +license = MIT +license_files = + LICENSE[.md]* + +platform = any +project_urls = + Bug Tracker = https://github.com/reactive-firewall/python-repo/issues + License = https://github.com/reactive-firewall/python-repo/LICENSE.md + +[bdist_rpm] +url = https://github.com/reactive-firewall/python-repo.git [bdist_wheel] universal=1 @@ -33,9 +48,42 @@ universal=1 packages = pythonrepo [options] +zip_safe = true +py_modules = pythonrepo +test_suite = tests +python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.* !=3.15.* +setup_requires = + setuptools>=45.0.0 + wheel>=0.37.0 + build>=1.1.1 + packages = find: + [options.packages.find] +where = + pythonrepo/ + tests/ + *.py +include = + pythonrepo exclude = - docs - tests + docs + tests + +[options.extras_require] +testing = + # upstream + pytest >= 7 + pytest-checkdocs >= 2.4 + pytest-flake8 + coverage >= 6.3 + pytest-cov >= 4.0.0; \ + # coverage seems to make PyPy extremely slow + python_implementation != "PyPy" + pytest-enabler >= 1.0.1 + # local + flake8 >= 5.0 + virtualenv >= 15.0.1 + wheel >= 0.37.0 + pip >= 21.0 diff --git a/setup.py b/setup.py index ec81270..e852299 100755 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ # Python Repo Template # .................................. -# Copyright (c) 2017-2020, Kendrick Walls +# Copyright (c) 2017-2024, Kendrick Walls # .................................. # Licensed under MIT (the "License"); # you may not use this file except in compliance with the License. @@ -17,46 +17,133 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Sets up the package. + +Minimal Acceptance Testing: + + Testcase 0: Just setup test fixtures by importing pythonrepo. + + >>> import pythonrepo + >>> + >>> pythonrepo.__package__ is not None + True + >>> + +""" try: + import os + import warnings + warnings.simplefilter("default") # Change the filter in this process + os.environ["PYTHONWARNINGS"] = "default" # Also affect subprocesses from setuptools import setup from setuptools import find_packages + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + try: + from setuptools.config import read_configuration + except Exception: + from setuptools.config.setupcfg import read_configuration except Exception: - raise ImportError("""Not Implemented.""") + raise NotImplementedError("""[CWE-440] Not Implemented.""") def readFile(filename): - """Helper Function to read files""" + """Will attempt to read the file at with the given filename or path. + + Used as a helper function to read files and return strings with the content. + + Testing: + + First setup test fixtures by importing pythonrepo. + + >>> import pythonrepo + >>> + + Testcase 0: Should have Function readFile() WHEN loading setup.py. + + >>> pythonrepo.readFile is not None + True + >>> type(pythonrepo.readFile) is type(1) + False + >>> + + """ theResult = None - if filename in ("""README.md""", """LICENSE.md"""): - try: - with open(str("""./{}""").format(str(filename))) as file: - theResult = file.read() - except Exception: - theResult = str( - """See https://github.com/reactive-firewall/python-repo/{}""" - ).format(filename) - return theResult + try: + if str("""E.md""") not in filename: + raise NotImplementedError("""[CWE-440] Not Implemented.""") + with open(str("""./{}""").format(str(filename))) as f: + theResult = f.read() + except Exception: + theResult = str( + """See https://github.com/reactive-firewall/python-repo/{}""" + ).format(filename) + return str(theResult) try: - with open("""./requirements.txt""") as f: - requirements = f.read().splitlines() + with open("""./requirements.txt""") as rfile: + requirements = rfile.read().splitlines() except Exception: requirements = None + +conf_dict = None + + +with warnings.catch_warnings(): + warnings.simplefilter("ignore") + conf_dict = read_configuration("""setup.cfg""", ignore_option_errors=True) + + readme = readFile("""README.md""") +"""The multi-line description and/or summary of this program.""" + SLA = readFile("""LICENSE.md""") +"""The "Software License Agreement" of this program.""" + +try: + class_tags = [ + str("""Development Status :: 4 - Beta"""), + str("""Environment :: Console"""), + str("""Intended Audience :: Developers"""), + str("""Operating System :: MacOS :: MacOS X"""), + str("""Operating System :: POSIX :: Linux"""), + str("""License :: OSI Approved :: MIT License"""), + str("""Programming Language :: Python :: 3"""), + str("""Programming Language :: Python :: 3 :: Only"""), + str("""Programming Language :: Python :: 3.14"""), + str("""Programming Language :: Python :: 3.13"""), + str("""Programming Language :: Python :: 3.12"""), + str("""Programming Language :: Python :: 3.11"""), + str("""Programming Language :: Python :: 3.10"""), + str("""Programming Language :: Python :: 3.9"""), + str("""Programming Language :: Python :: 3.8"""), + str("""Programming Language :: Python :: 3.7"""), + str("""Programming Language :: Python :: 3.6"""), + str("""Programming Language :: Python :: 3.5"""), + str("""Programming Language :: Python :: 3.4"""), + str("""Programming Language :: Python :: 2.7"""), + str("""Topic :: Software Development :: Libraries :: Python Modules""") + ] +except Exception: + class_tags = str("""Development Status :: 4 - Beta""") setup( - name="""pythonrepo""", - version="""1.1.4""", - description="""Python Repo""", + name=conf_dict["""metadata"""]["""name"""], + version=conf_dict["""metadata"""]["""version"""], + description=conf_dict["""metadata"""]["""description"""], long_description=readme, + long_description_content_type="""text/markdown""", + zip_safe=True, + include_package_data=True, install_requires=requirements, - author="""reactive-firewall""", - author_email="""reactive-firewall@users.noreply.github.com""", - url="""https://github.com/reactive-firewall/python-repo.git""", + author=conf_dict["""metadata"""]["""author"""], + author_email=conf_dict["""metadata"""]["""author_email"""], + classifiers=class_tags, + url=conf_dict["""metadata"""]["""url"""], + download_url=conf_dict["""metadata"""]["""download_url"""], license=SLA, packages=find_packages(exclude=("""tests""", """docs""")), ) diff --git a/tox.ini b/tox.ini index 07f70d7..36d0e4b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{27,33,34,35,36,37,38}, py{35,36,37,38}-travis, docs, flake +envlist = py{27,33,34,35,36,37,38,39,310,311,312,313,314}, py{35,36,37,38,39,310,311,312,313,314}-travis, docs, flake skip_missing_interpreters=True @@ -18,7 +18,7 @@ passenv = deps = -r{toxinidir}/requirements.txt -[testenv:py{27,33,34,35,36,37,38}] +[testenv:py{27,33,34,35,36,37,38,39,310,311,312,313,314}] sitepackages = False recreate = True alwayscopy = True @@ -32,6 +32,12 @@ basepython = py36: /usr/bin/python3.6 py37: python3.7 py38: python3.8 + py39: python3.9 + py310: python3.10 + py311: python3.11 + py312: python3.12 + py313: python3.13 + py314: python3.14 deps = coverage>=4.4 codecov>=2.0.9 @@ -44,6 +50,12 @@ commands = py36: python3.6 -m coverage run -p --source=pythonrepo -m unittest discover --verbose -t ./ py37: python3.7 -m coverage run -p --source=pythonrepo -m unittest discover --verbose -t ./ py38: python3.8 -m coverage run -p --source=pythonrepo -m unittest discover --verbose -t ./ + py39: python3.9 -m coverage run -p --source=pythonrepo -m unittest discover --verbose -t ./ + py310: python3.10 -m coverage run -p --source=pythonrepo -m unittest discover --verbose -t ./ + py311: python3.11 -m coverage run -p --source=pythonrepo -m unittest discover --verbose -t ./ + py312: python3.12 -m coverage run -p --source=pythonrepo -m unittest discover --verbose -t ./ + py313: python3.13 -m coverage run -p --source=pythonrepo -m unittest discover --verbose -t ./ + py314: python3.14 -m coverage run -p --source=pythonrepo -m unittest discover --verbose -t ./ [testenv:py27] @@ -275,6 +287,263 @@ commands = - coverage report --include=pythonrepo* - codecov +[testenv:py39] +sitepackages = False +recreate = True +alwayscopy = True +passenv = + TRAVIS_PYTHON_VERSION="3.9" + {[base]passenv} +basepython = python3.9 +deps = + coverage>=5.0 + codecov>=2.0.15 + {[base]deps} +commands = + coverage erase + python3.9 -m coverage run -p --source=pythonrepo -m unittest discover --verbose -t ./ + - coverage combine + - coverage report --include=pythonrepo* + - codecov + + + +[testenv:py39-travis] +description = Python 3.9 Tests +sitepackages = False +recreate = True +alwayscopy = True +passenv = + TRAVIS_PYTHON_VERSION="3.9" + {[base]passenv} +basepython = /home/travis/virtualenv/python3.9/bin/python3.9 +envdir = {toxworkdir}/py39 +deps = + coverage>=5.0 + codecov>=2.0.15 + {[base]deps} +commands = + coverage erase + python3.9 -m coverage run -p --source=pythonrepo -m unittest discover --verbose -t ./ + - coverage combine + - coverage report --include=pythonrepo* + - codecov + + +[testenv:py310] +sitepackages = False +recreate = True +alwayscopy = True +passenv = + TRAVIS_PYTHON_VERSION="3.10" + {[base]passenv} +basepython = python3.10 +deps = + coverage>=5.0 + codecov>=2.0.15 + {[base]deps} +commands = + coverage erase + python3.10 -m coverage run -p --source=pythonrepo -m unittest discover --verbose -t ./ + - coverage combine + - coverage report --include=pythonrepo* + - codecov + + + +[testenv:py310-travis] +description = Python 3.10 Tests +sitepackages = False +recreate = True +alwayscopy = True +passenv = + TRAVIS_PYTHON_VERSION="3.10" + {[base]passenv} +basepython = /home/travis/virtualenv/python3.10/bin/python3.10 +envdir = {toxworkdir}/py310 +deps = + coverage>=5.0 + codecov>=2.0.15 + {[base]deps} +commands = + coverage erase + python3.10 -m coverage run -p --source=pythonrepo -m unittest discover --verbose -t ./ + - coverage combine + - coverage report --include=pythonrepo* + - codecov + + +[testenv:py311] +sitepackages = False +recreate = True +alwayscopy = True +passenv = + TRAVIS_PYTHON_VERSION="3.11" + {[base]passenv} +basepython = python3.11 +deps = + coverage>=5.0 + codecov>=2.0.15 + {[base]deps} +commands = + coverage erase + python3.11 -m coverage run -p --source=pythonrepo -m unittest discover --verbose -t ./ + - coverage combine + - coverage report --include=pythonrepo* + - codecov + + + +[testenv:py311-travis] +description = Python 3.11 Tests +sitepackages = False +recreate = True +alwayscopy = True +passenv = + TRAVIS_PYTHON_VERSION="3.11" + {[base]passenv} +basepython = /home/travis/virtualenv/python3.11/bin/python3.11 +envdir = {toxworkdir}/py311 +deps = + coverage>=5.0 + codecov>=2.0.15 + {[base]deps} +commands = + coverage erase + python3.11 -m coverage run -p --source=pythonrepo -m unittest discover --verbose -t ./ + - coverage combine + - coverage report --include=pythonrepo* + - codecov + + +[testenv:py312] +sitepackages = False +recreate = True +alwayscopy = True +passenv = + TRAVIS_PYTHON_VERSION="3.12" + {[base]passenv} +basepython = python3.12 +deps = + coverage>=5.0 + codecov>=2.0.15 + {[base]deps} +commands = + coverage erase + python3.12 -m coverage run -p --source=pythonrepo -m unittest discover --verbose -t ./ + - coverage combine + - coverage report --include=pythonrepo* + - codecov + + + +[testenv:py312-travis] +description = Python 3.8 Tests +sitepackages = False +recreate = True +alwayscopy = True +passenv = + TRAVIS_PYTHON_VERSION="3.12" + {[base]passenv} +basepython = /home/travis/virtualenv/python3.12/bin/python3.12 +envdir = {toxworkdir}/py312 +deps = + coverage>=5.0 + codecov>=2.0.15 + {[base]deps} +commands = + coverage erase + python3.12 -m coverage run -p --source=pythonrepo -m unittest discover --verbose -t ./ + - coverage combine + - coverage report --include=pythonrepo* + - codecov + + +[testenv:py313] +sitepackages = False +recreate = True +alwayscopy = True +passenv = + TRAVIS_PYTHON_VERSION="3.13" + {[base]passenv} +basepython = python3.13 +deps = + coverage>=5.0 + codecov>=2.0.15 + {[base]deps} +commands = + coverage erase + python3.13 -m coverage run -p --source=pythonrepo -m unittest discover --verbose -t ./ + - coverage combine + - coverage report --include=pythonrepo* + - codecov + + + +[testenv:py313-travis] +description = Python 3.13 Tests +sitepackages = False +recreate = True +alwayscopy = True +passenv = + TRAVIS_PYTHON_VERSION="3.13" + {[base]passenv} +basepython = /home/travis/virtualenv/python3.13/bin/python3.13 +envdir = {toxworkdir}/py313 +deps = + coverage>=5.0 + codecov>=2.0.15 + {[base]deps} +commands = + coverage erase + python3.13 -m coverage run -p --source=pythonrepo -m unittest discover --verbose -t ./ + - coverage combine + - coverage report --include=pythonrepo* + - codecov + + +[testenv:py314] +sitepackages = False +recreate = True +alwayscopy = True +passenv = + TRAVIS_PYTHON_VERSION="3.14" + {[base]passenv} +basepython = python3.14 +deps = + coverage>=5.0 + codecov>=2.0.15 + {[base]deps} +commands = + coverage erase + python3.14 -m coverage run -p --source=pythonrepo -m unittest discover --verbose -t ./ + - coverage combine + - coverage report --include=pythonrepo* + - codecov + + + +[testenv:py314-travis] +description = Python 3.14 Tests +sitepackages = False +recreate = True +alwayscopy = True +passenv = + TRAVIS_PYTHON_VERSION="3.14" + {[base]passenv} +basepython = /home/travis/virtualenv/python3.14/bin/python3.14 +envdir = {toxworkdir}/py314 +deps = + coverage>=5.0 + codecov>=2.0.15 + {[base]deps} +commands = + coverage erase + python3.14 -m coverage run -p --source=pythonrepo -m unittest discover --verbose -t ./ + - coverage combine + - coverage report --include=pythonrepo* + - codecov + [testenv:flake] basepython =