From 6401e1cfe6cb62c37f1bdbe322d3a216a4965e81 Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Sat, 18 Jan 2020 17:51:52 -0800 Subject: [PATCH 01/68] Another attempt at Build Config updates --- .travis.yml | 69 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index eeb5966..c970568 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,4 @@ language: python -sudo: false python: @@ -62,18 +61,27 @@ matrix: - os: linux python: "3.5-dev" # 3.5 development branch env: TRAVIS_PYTHON_VERSION="3.5" + dist: xenial - os: linux python: "3.6-dev" env: TRAVIS_PYTHON_VERSION="3.6" + dist: bionic - os: linux python: "3.7-dev" env: TRAVIS_PYTHON_VERSION="3.7" + dist: bionic - os: linux python: "3.7" env: TRAVIS_PYTHON_VERSION="3.7" + dist: bionic - os: linux python: "3.8-dev" env: TRAVIS_PYTHON_VERSION="3.8" + dist: bionic + - os: linux + python: "3.9-dev" + env: TRAVIS_PYTHON_VERSION="3.9" + dist: bionic - os: linux python: "pypy2.7-5.8.0" dist: xenial @@ -92,42 +100,47 @@ matrix: env: TRAVIS_PYTHON_VERSION="2.7" dist: xenial - os: linux - python: "nightly" # currently points to 3.8-dev - env: TRAVIS_PYTHON_VERSION="3.8-dev" + python: "nightly" # currently points to 3.9-dev + env: TRAVIS_PYTHON_VERSION="3.9-dev" - os: osx osx_image: xcode10 language: shell - os: osx - osx_image: xcode11 - language: shell - allow_failures: - - os: linux - python: "nightly" # currently points to 3.7-dev - env: TRAVIS_PYTHON_VERSION="3.7-dev" - - os: osx - osx_image: xcode6.4 + osx_image: xcode11.1 language: shell - os: osx - osx_image: xcode7.2 + osx_image: xcode11.2 language: shell - os: osx - osx_image: xcode7.3 + osx_image: xcode11.3 language: shell + allow_failures: + - os: linux + dist: xenial + - os: linux + dist: trusty + - os: linux + python: "3.9-dev" - os: linux python: "2.6" - os: linux python: "3.2" - env: TRAVIS_PYTHON_VERSION="3.2" + - os: linux + python: "3.3" + - os: linux + python: "3.4" + dist: xenial + - os: linux + python: "3.4" + dist: bionic - os: linux python: "3.7-dev" - env: TRAVIS_PYTHON_VERSION="3.7" - os: linux python: "3.8-dev" - env: TRAVIS_PYTHON_VERSION="3.8" - os: linux - python: "nightly" + python: "3.9-dev" - os: linux - python: "3.2" + python: "nightly" - os: linux python: "pypy" - os: linux @@ -138,15 +151,13 @@ matrix: python: "pypy2.7-5.8.0" - os: linux python: "pypy3.5-5.10.0" - env: TRAVIS_PYTHON_VERSION="3.5" - os: linux python: "pypy2.7-5.10.0" - env: TRAVIS_PYTHON_VERSION="2.7" - os: linux python: "pypy3.5-6.0" - - os: linux - python: "nightly" # currently points to 3.7-dev - env: TRAVIS_PYTHON_VERSION="3.7-dev" + - os: osx + osx_image: xcode6.4 + language: shell - os: osx osx_image: xcode7.2 language: shell @@ -171,6 +182,18 @@ matrix: - os: osx osx_image: xcode9.4 language: shell + - os: osx + osx_image: xcode10 + language: shell + - os: osx + osx_image: xcode10.1 + language: shell + - os: osx + osx_image: xcode11 + language: shell + - os: osx + osx_image: xcode11.1 + language: shell install: "make init" From 3430afe8a82a7b3122696cc49fb1e8cdbf37193d Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Mon, 23 Mar 2020 20:10:02 -0700 Subject: [PATCH 02/68] Adding deepsource.io to CI pipeline --- .deepsource.toml | 42 ++++++++++++++++++++++++++++++++++++++++++ .travis.yml | 13 ++++++++----- 2 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 .deepsource.toml diff --git a/.deepsource.toml b/.deepsource.toml new file mode 100644 index 0000000..182d2bd --- /dev/null +++ b/.deepsource.toml @@ -0,0 +1,42 @@ +version = 1 + +test_patterns = [ + "tests/**,", + "tests/*.py", + ".circleci/**", + "testcases/**" +] + +exclude_patterns = [ + "__pycache__/", + "*.pyc", + "*$py.class", + "*~", + "htmlcov/", + ".tox/", + ".coverage", + ".coverage.*", + ".cache", + "nosetests.xml", + "coverage.xml", + ".coveralls.yml", + "codecov_env", + "*,cover", + ".hypothesis/" +] + +[[analyzers]] +name = "python" +enabled = true +dependency_file_paths = [ + "requirements.txt", + "setup.py" +] + + [analyzers.meta] + runtime_version = "3.x.x" + max_line_length = 100 + +[[analyzers]] +name = "test-coverage" +enabled = true \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index c970568..2407e83 100644 --- a/.travis.yml +++ b/.travis.yml @@ -224,17 +224,17 @@ before_install: - if [ $TRAVIS_OS_NAME == osx ] ; then brew install coverage $INSTALL || true ; fi - if [ $TRAVIS_OS_NAME == osx ] ; then brew install codecov || true ; fi - if [ $TRAVIS_OS_NAME == osx ] ; then brew install pip || true ; fi - - if [ $TRAVIS_OS_NAME == osx ] ; then export VERSIONER_PYTHON_VERSION=${TRAVIS_PYTHON_VERSION:-3.6} || true ; fi + - if [ $TRAVIS_OS_NAME == osx ] ; then export VERSIONER_PYTHON_VERSION=${TRAVIS_PYTHON_VERSION:-3.7} || true ; fi - if [ $TRAVIS_OS_NAME == osx ] ; then defaults write com.apple.versioner.python Version $TRAVIS_PYTHON_VERSION || true ; fi - travis_retry pip install tox || pip install tox || true ; - travis_retry pip install coverage || true ; - travis_retry pip install codecov || true ; - travis_retry python -m pip install coverage || python -m pip install coverage || true ; - travis_retry python -m pip install codecov || python -m pip install codecov || true ; - - travis_retry python3 -m pip install tox || python3 -m pip install tox || true ; - - travis_retry python3 -m pip install coverage || python3 -m pip install coverage || true ; - - travis_retry python3 -m pip install codecov || python3 -m pip install codecov || true ; - - travis_retry python3 -m pip install -r requirements.txt || python3 -m pip install -r requirements.txt || true ; + - travis_retry python3 -m pip3 install tox || python3 -m pip install tox || true ; + - travis_retry python3 -m pip3 install coverage || python3 -m pip install coverage || true ; + - travis_retry python3 -m pip3 install codecov || python3 -m pip install codecov || true ; + - travis_retry python3 -m pip3 install -r requirements.txt || python3 -m pip install -r requirements.txt || true ; # The following is used to get coveralls working: add affter codecov # - travis_retry pip install python-coveralls 2>/dev/null || python3 -m pip install python-coveralls || true ; @@ -246,6 +246,7 @@ before_script: - if [ $TRAVIS_OS_NAME == osx ] ; then echo "SKIP code climate" ; else curl -L --url https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 -o ./cc-test-reporter 3>/dev/null 2>/dev/null || true ; fi ; - if [ $TRAVIS_OS_NAME == osx ] ; then echo "SKIP code climate" ; else chmod +x ./cc-test-reporter || true ; fi ; - if [ $TRAVIS_OS_NAME == osx ] ; then echo "SKIP code climate" ; else ./cc-test-reporter before-build || true ; fi ; + - if [ $TRAVIS_OS_NAME == osx ] ; then echo "SKIP deepsource" ; else (curl https://deepsource.io/cli | sh) || true ; fi ; script: - make clean ; @@ -261,6 +262,7 @@ after_failure: - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP coverage" ; else coverage combine 2>/dev/null || true ; fi ; - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP coverage xml" ; else coverage xml 2>/dev/null || true ; fi ; - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP codecov" ; else codecov 2>/dev/null || true ; fi ; + - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP deepsource" ; else ./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml 2>/dev/null || true ; fi ; - if [ $TRAVIS_OS_NAME == osx ] || [ $TRAVIS_PYTHON_VERSION == "3.2" ] || [ $TRAVIS_PYTHON_VERSION == "3.3" ] ; then echo "SKIP code climate" ; else ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT || true ; fi ; - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] || [ $TRAVIS_PYTHON_VERSION == "3.3" ] ; then echo "SKIP codecov" ; else codecov 2>/dev/null || true ; fi ; - make clean 2>/dev/null || true @@ -269,6 +271,7 @@ after_success: - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP coverage" ; else coverage combine 2>/dev/null || true ; fi ; - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP coverage xml" ; else coverage xml 2>/dev/null || true ; fi ; - if [ $TRAVIS_OS_NAME == osx ] || [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP code climate" ; else ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT || true ; fi ; + - if [ $TRAVIS_OS_NAME == osx ] || [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP deepsource" ; else ./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml 2>/dev/null || true ; fi ; - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP codecov" ; else codecov || true ; fi ; - travis_retry python3 -m pip install python-coveralls || python3 -m pip install python-coveralls || true ; - if [ $TRAVIS_PYTHON_VERSION == "3.2" ] ; then echo "SKIP codecov" ; else coveralls 2>/dev/null || true ; fi ; From 5e694d02cf2949a9c156e8a813d06152e8967ffb Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Mon, 23 Mar 2020 21:46:28 -0700 Subject: [PATCH 03/68] Style fixes and CI retest --- .coveragerc | 3 +-- .flake8.ini | 2 +- setup.cfg | 2 +- setup.py | 5 +++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.coveragerc b/.coveragerc index 9562565..59ae610 100644 --- a/.coveragerc +++ b/.coveragerc @@ -7,7 +7,6 @@ include = pythonrepo*,tests* exclude_lines = # Have to re-enable the standard pragma pragma: no cover - except Exception except BaseException: # Don't complain if tests don't hit defensive assertion code: @@ -19,7 +18,7 @@ exclude_lines = except OSError # Don't complain if non-runnable code isn't run: - if __name__ in '__main__': + if __name__ in '__main__': ignore_errors = True diff --git a/.flake8.ini b/.flake8.ini index cf7a3ff..a1b5142 100644 --- a/.flake8.ini +++ b/.flake8.ini @@ -1,5 +1,5 @@ [flake8] -ignore = W191,W391 +ignore = W191,W391,E117 max-line-length = 100 exclude = # No need to traverse our git directory diff --git a/setup.cfg b/setup.cfg index 1b4f34c..bacc4a3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = pythonrepo -version = 1.1.2 +version = 1.1.3 author = Mr. Walls author-email = reactive-firewall@users.noreply.github.com summary = python-repo template diff --git a/setup.py b/setup.py index 5b981d7..089eae8 100755 --- a/setup.py +++ b/setup.py @@ -25,7 +25,8 @@ raise ImportError("""Not Implemented.""") -def readFile(filename="""./README.md"""): +def readFile(filename): + """Helper Function to read files""" theResult = None try: with open(str("""./{}""").format(str(filename))) as f: @@ -48,7 +49,7 @@ def readFile(filename="""./README.md"""): setup( name="""pythonrepo""", - version="""1.1.2""", + version="""1.1.3""", description="""Python Repo""", long_description=readme, install_requires=requirements, From 3158d439e0386146d2c077d68e74114c23ad6041 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Fri, 14 Jan 2022 03:08:44 -0800 Subject: [PATCH 04/68] Create scorecards-analysis.yml --- .github/workflows/scorecards-analysis.yml | 53 +++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/scorecards-analysis.yml diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml new file mode 100644 index 0000000..98bfa4c --- /dev/null +++ b/.github/workflows/scorecards-analysis.yml @@ -0,0 +1,53 @@ +name: Scorecards supply-chain security +on: + # Only the default branch is supported. + branch_protection_rule: + schedule: + - cron: '18 9 * * 5' + push: + branches: [ master ] + +# Declare default permissions as read only. +permissions: read-all + +jobs: + analysis: + name: Scorecards analysis + runs-on: ubuntu-latest + permissions: + # Needed to upload the results to code-scanning dashboard. + security-events: write + + steps: + - name: "Checkout code" + uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0 + with: + persist-credentials: false + + - name: "Run analysis" + uses: ossf/scorecard-action@175f59783fa96e44dd6fa96619ab7bdacab56b5c # v0.0.1 + with: + results_file: results.sarif + results_format: sarif + # Read-only PAT token. To create it, + # follow the steps in https://github.com/ossf/scorecard-action#pat-token-creation. + repo_token: ${{ secrets.SCORECARD_TOKEN }} + # Publish the results to enable scorecard badges. For more details, see + # https://github.com/ossf/scorecard-action#publishing-results. + # If you are installing the action on a private repo, set it to `publish_results: false` + # or comment out the following line. + publish_results: true + + # Upload the results as artifacts (optional). + - name: "Upload artifact" + uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 # v2.3.1 + with: + name: SARIF file + path: results.sarif + retention-days: 5 + + # Upload the results to GitHub's code scanning dashboard. + - name: "Upload to code-scanning" + uses: github/codeql-action/upload-sarif@5f532563584d71fdef14ee64d17bafb34f751ce5 # v1.0.26 + with: + sarif_file: results.sarif From 035231f4191324bb13ba62fa9cf6d038b1b9dbdf Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Mon, 29 Aug 2022 19:42:41 -0700 Subject: [PATCH 05/68] xcode workspace renomalized with xml lint --- python-repo.xcworkspace/contents.xcworkspacedata | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/python-repo.xcworkspace/contents.xcworkspacedata b/python-repo.xcworkspace/contents.xcworkspacedata index ca3329e..dc6fdb0 100644 --- a/python-repo.xcworkspace/contents.xcworkspacedata +++ b/python-repo.xcworkspace/contents.xcworkspacedata @@ -1,7 +1,5 @@ - - + + From 83cfc31a029c93ef053d7ce356ab8bc331ff77ec Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Mon, 29 Aug 2022 19:53:44 -0700 Subject: [PATCH 06/68] workaround different flake support for del() vs del x --- pythonrepo/pythonrepo.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pythonrepo/pythonrepo.py b/pythonrepo/pythonrepo.py index bfb2846..f239ada 100644 --- a/pythonrepo/pythonrepo.py +++ b/pythonrepo/pythonrepo.py @@ -3,7 +3,7 @@ # Python Repo Template # .................................. -# Copyright (c) 2017-2019, Kendrick Walls +# Copyright (c) 2017-2022, Kendrick Walls # .................................. # Licensed under MIT (the "License"); # you may not use this file except in compliance with the License. @@ -29,7 +29,6 @@ print(str("")) # Clean up Error err = None - del(err) # Throw more relevant Error raise ImportError(str("Error Importing Python")) From ff308fccada3d9b3f30ea9f1fb3abc89b3fc88ad Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Fri, 23 Sep 2022 17:44:30 -0700 Subject: [PATCH 07/68] Version 1.1.4 supplemental update --- .appveyor.yml | 6 +++--- .circleci/config.yml | 8 ++++---- .gitignore | 1 + LICENSE.md | 2 +- Makefile | 3 ++- docs/conf.py | 4 ++-- docs/{index.rst => index.md} | 0 pythonrepo/__init__.py | 30 +++++++++++++++++---------- pythonrepo/pythonrepo.py | 39 +++++++++++++++++------------------- setup.cfg | 4 +++- tests/test_basic.py | 13 +++++++----- 11 files changed, 61 insertions(+), 49 deletions(-) rename docs/{index.rst => index.md} (100%) diff --git a/.appveyor.yml b/.appveyor.yml index 29fb998..1d35fa4 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,4 +1,4 @@ -version: 1.0.{build} +version: 1.1.{build} branches: only: - master @@ -6,8 +6,8 @@ branches: skip_tags: true max_jobs: 1 image: -- Visual Studio 2017 -- Visual Studio 2015 +- Visual Studio 2022 +- Visual Studio 2019 clone_depth: 50 init: - cmd: >- diff --git a/.circleci/config.yml b/.circleci/config.yml index 8471a30..c1ce0f4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,9 +2,9 @@ version: 2 jobs: build: docker: - - image: circleci/python:3.6.1 - image: circleci/python:3.7 - image: circleci/python:3.8 + - image: circleci/python:3.9 environment: CI: cicleci DEBIAN_FRONTEND: noninteractive @@ -41,9 +41,9 @@ jobs: test: docker: - - image: circleci/python:3.6.1 - image: circleci/python:3.7 - image: circleci/python:3.8 + - image: circleci/python:3.9 parallelism: 2 environment: CI: cicleci @@ -88,9 +88,9 @@ jobs: pytest: docker: - - image: circleci/python:3.6.1 - image: circleci/python:3.7 - image: circleci/python:3.8 + - image: circleci/python:3.9 parallelism: 2 environment: CI: cicleci @@ -147,7 +147,7 @@ jobs: lint: docker: - - image: circleci/python:3.6.1 + - image: circleci/python:3.8 environment: CI: cicleci DEBIAN_FRONTEND: noninteractive diff --git a/.gitignore b/.gitignore index 5d7e4e3..47b603a 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,7 @@ coverage.xml codecov_env *,cover .hypothesis/ +test-reports/* # Translations *.mo diff --git a/LICENSE.md b/LICENSE.md index a8f8ee4..3ee50db 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ License - MIT -Copyright (c) 2017-2020 Mr. Walls +Copyright (c) 2017-2022 Mr. Walls THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/Makefile b/Makefile index 1548c94..01ba15f 100644 --- a/Makefile +++ b/Makefile @@ -59,6 +59,7 @@ PHONY: must_be_root cleanup build: $(QUIET)$(ECHO) "No need to build. Try make -f Makefile install" + $(QUIET)$(MAKE) -s -C ./docs/ -f Makefile text 2>/dev/null || true init: $(QUIET)$(ECHO) "$@: Done." @@ -84,7 +85,7 @@ purge: clean uninstall test: cleanup $(QUIET)coverage run -p --source=pythonrepo -m unittest discover --verbose -s ./tests -t ./ || python3 -m unittest discover --verbose -s ./tests -t ./ || python -m unittest discover --verbose -s ./tests -t ./ || DO_FAIL=exit 2 ; $(QUIET)coverage combine 2>/dev/null || true - $(QUIET)coverage report --include=pythonrepo* 2>/dev/null || true + $(QUIET)coverage report -m --include=pythonrepo* 2>/dev/null || true $(QUIET)$(DO_FAIL); $(QUIET)$(ECHO) "$@: Done." diff --git a/docs/conf.py b/docs/conf.py index b8aaf7e..1437135 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -32,7 +32,7 @@ templates_path = ['_templates'] # The suffix of source filenames. -source_suffix = '.rst' +source_suffix = '.md' # The encoding of source files. # source_encoding = 'utf-8-sig' @@ -51,7 +51,7 @@ # The short X.Y version. version = 'v1.1' # The full version, including alpha/beta/rc tags. -release = 'v1.1.1' +release = 'v1.1.4' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/index.rst b/docs/index.md similarity index 100% rename from docs/index.rst rename to docs/index.md diff --git a/pythonrepo/__init__.py b/pythonrepo/__init__.py index 51b0c57..342988a 100644 --- a/pythonrepo/__init__.py +++ b/pythonrepo/__init__.py @@ -2,7 +2,7 @@ # Python Repo Template # .................................. -# Copyright (c) 2017-2019, Kendrick Walls +# Copyright (c) 2017-2022, Kendrick Walls # .................................. # Licensed under MIT (the "License"); # you may not use this file except in compliance with the License. @@ -17,25 +17,33 @@ # limitations under the License. -__version__ = """1.1.1""" -"""This is version 1.1.1 of pythonrepo Template""" +__package__ = """pythonrepo""" + + +__module__ = """pythonrepo""" + + +__name__ = """pythonrepo""" + + +__version__ = """1.1.4""" +"""This is version 1.1.4 of pythonrepo Template""" try: import sys import os - if 'pythonrepo' in __file__: + if str(__module__) in __file__: __parentPath = os.path.join( os.path.dirname(__file__), '..' ) sys.path.insert(0, os.path.abspath(__parentPath)) -except Exception as ImportErr: - print(str(type(ImportErr))) - print(str(ImportErr)) - print(str((ImportErr.args))) - ImportErr = None - del ImportErr - raise ImportError(str("pythonrepo Failed to Import")) +except Exception as err: + baton = ImportError(err, str("[CWE-758] Module failed completely.")) + baton.module = __module__ + baton.path = __file__ + baton.__cause__ = err + raise baton try: diff --git a/pythonrepo/pythonrepo.py b/pythonrepo/pythonrepo.py index f239ada..f01b25b 100644 --- a/pythonrepo/pythonrepo.py +++ b/pythonrepo/pythonrepo.py @@ -18,22 +18,26 @@ # limitations under the License. +__module__ = """pythonrepo""" + + +# __name__ = """pythonrepo""" + + try: import sys import argparse except Exception as err: - # Show Error Info - print(str(type(err))) - print(str(err)) - print(str(err.args)) - print(str("")) - # Clean up Error - err = None + # Collect Error Info + baton = ImportError(err, str("[CWE-758] Module failed completely.")) + baton.module = __module__ + baton.path = __file__ + baton.__cause__ = err # Throw more relevant Error - raise ImportError(str("Error Importing Python")) + raise baton -__prog__ = str("""pythonrepo""") +__prog__ = str(__module__) """The name of this program is PythonRepo""" @@ -49,7 +53,7 @@ """Contains the short epilog of the program CLI help text.""" -__version__ = """1.1.1""" +__version__ = """1.1.4""" """The version of this program.""" @@ -95,16 +99,9 @@ def parseArgs(arguments=None): return parser.parse_known_args(arguments) -def __checkToolArgs(args=None): - """Handles None case for arguments as a helper function.""" - if args is None: - args = [None] - return args - - -def useTool(tool, arguments=None): +def useTool(tool, *arguments): """Handler for launching the functions.""" - arguments = __checkToolArgs(arguments) + # arguments = __checkToolArgs(arguments) if (tool is not None) and (tool in TASK_OPTIONS.keys()): try: # print(str("launching: " + tool)) @@ -117,11 +114,11 @@ def useTool(tool, arguments=None): return None -def main(argv=None): +def main(*argv): """The Main Event.""" try: try: - args, extra = parseArgs(argv) + args, extra = parseArgs(*argv) service_cmd = args.some_task useTool(service_cmd, extra) except Exception: diff --git a/setup.cfg b/setup.cfg index bacc4a3..458a068 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = pythonrepo -version = 1.1.3 +version = 1.1.4 author = Mr. Walls author-email = reactive-firewall@users.noreply.github.com summary = python-repo template @@ -13,6 +13,8 @@ classifiers = Operating System :: POSIX :: Linux Programming Language :: Python Programming Language :: Python :: 3 + 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 diff --git a/tests/test_basic.py b/tests/test_basic.py index 0b290c8..ed0f053 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -68,16 +68,19 @@ def test_the_help_command(self): def test_corner_case_example(self): """Example Test case for bad input directly into function.""" - theResult = False + theResult = True try: from .context import pythonrepo if pythonrepo.__name__ is None: theResult = False - from pythonrepo import pythonrepo as pythonrepo - self.assertIsNone(pythonrepo.useTool(None)) - self.assertIsNone(pythonrepo.useTool("JunkInput")) - theResult = True + from pythonrepo import pythonrepo as _pythonrepo + self.assertIsNone(_pythonrepo.useTool(None, None), """None, None Failed""") + self.assertIsNone(_pythonrepo.useTool(None, []), """None, [] Failed""") + self.assertIsNone(_pythonrepo.useTool(tool=None), """None Failed""") + self.assertIsNone(_pythonrepo.useTool("JunkInput"), """junk Failed""") + self.assertTrue(theResult) except Exception: + self.fail("""Test Failed""") theResult = False assert theResult From 4a3bc678ea377e61b1cd15879ac674c4b8c2aa25 Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Fri, 23 Sep 2022 18:26:57 -0700 Subject: [PATCH 08/68] Regression fix for some anti-patterns --- pythonrepo/__init__.py | 15 +-------------- pythonrepo/pythonrepo.py | 11 ++++------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/pythonrepo/__init__.py b/pythonrepo/__init__.py index 342988a..eb4fe77 100644 --- a/pythonrepo/__init__.py +++ b/pythonrepo/__init__.py @@ -17,13 +17,8 @@ # limitations under the License. -__package__ = """pythonrepo""" - - __module__ = """pythonrepo""" - - -__name__ = """pythonrepo""" +"""This is pythonrepo __module Template""" __version__ = """1.1.4""" @@ -46,15 +41,7 @@ raise baton -try: - from . import pythonrepo as pythonrepo -except Exception as importErr: - del importErr - import pythonrepo.pythonrepo as pythonrepo - - if __name__ in '__main__': if pythonrepo.__name__ is None: raise ImportError(str("Failed to open pythonrepo")) pythonrepo.main(sys.argv[1:]) - exit(0) diff --git a/pythonrepo/pythonrepo.py b/pythonrepo/pythonrepo.py index f01b25b..0358a40 100644 --- a/pythonrepo/pythonrepo.py +++ b/pythonrepo/pythonrepo.py @@ -18,14 +18,11 @@ # limitations under the License. -__module__ = """pythonrepo""" - - -# __name__ = """pythonrepo""" +__module__ = """pythonrepo.pythonrepo""" try: - import sys + from . import sys import argparse except Exception as err: # Collect Error Info @@ -53,7 +50,8 @@ """Contains the short epilog of the program CLI help text.""" -__version__ = """1.1.4""" +from . import __version__ as __version__ +# __version__ = """1.1.4""" """The version of this program.""" @@ -101,7 +99,6 @@ def parseArgs(arguments=None): def useTool(tool, *arguments): """Handler for launching the functions.""" - # arguments = __checkToolArgs(arguments) if (tool is not None) and (tool in TASK_OPTIONS.keys()): try: # print(str("launching: " + tool)) From 9af5c27d0e841a3aeed636ce4623c0ac76b53dc5 Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Fri, 23 Sep 2022 18:36:04 -0700 Subject: [PATCH 09/68] Regression fix for code style. --- pythonrepo/__init__.py | 4 +--- pythonrepo/pythonrepo.py | 9 ++++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/pythonrepo/__init__.py b/pythonrepo/__init__.py index eb4fe77..29ed214 100644 --- a/pythonrepo/__init__.py +++ b/pythonrepo/__init__.py @@ -42,6 +42,4 @@ if __name__ in '__main__': - if pythonrepo.__name__ is None: - raise ImportError(str("Failed to open pythonrepo")) - pythonrepo.main(sys.argv[1:]) + pass diff --git a/pythonrepo/pythonrepo.py b/pythonrepo/pythonrepo.py index 0358a40..b597650 100644 --- a/pythonrepo/pythonrepo.py +++ b/pythonrepo/pythonrepo.py @@ -34,6 +34,10 @@ raise baton +from . import __version__ as __version__ +"""The version of this program.""" + + __prog__ = str(__module__) """The name of this program is PythonRepo""" @@ -50,11 +54,6 @@ """Contains the short epilog of the program CLI help text.""" -from . import __version__ as __version__ -# __version__ = """1.1.4""" -"""The version of this program.""" - - # Add your functions here From 8cb602fd15621f37416c6690a64d0d57dff6ebc7 Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Fri, 23 Sep 2022 18:41:41 -0700 Subject: [PATCH 10/68] Slight improvement to code style. --- pythonrepo/__init__.py | 2 -- pythonrepo/pythonrepo.py | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pythonrepo/__init__.py b/pythonrepo/__init__.py index 29ed214..28738c1 100644 --- a/pythonrepo/__init__.py +++ b/pythonrepo/__init__.py @@ -41,5 +41,3 @@ raise baton -if __name__ in '__main__': - pass diff --git a/pythonrepo/pythonrepo.py b/pythonrepo/pythonrepo.py index b597650..2dd5519 100644 --- a/pythonrepo/pythonrepo.py +++ b/pythonrepo/pythonrepo.py @@ -34,7 +34,7 @@ raise baton -from . import __version__ as __version__ +from . import __version__ """The version of this program.""" @@ -131,6 +131,6 @@ def main(*argv): exit(0) -if __name__ == '__main__': +if __name__ in '__main__': if (sys.argv is not None) and (len(sys.argv) >= 1): main(sys.argv[1:]) From 0751ed948b94d2238c25776e4ccb06055b5488b1 Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Fri, 23 Sep 2022 19:01:20 -0700 Subject: [PATCH 11/68] Less is More... --- pythonrepo/__init__.py | 3 +- pythonrepo/pythonrepo.py | 2 + tests/profiling.py | 127 +++++++++++++++++++++++++++++++-------- tests/test_usage.py | 16 ++--- 4 files changed, 112 insertions(+), 36 deletions(-) diff --git a/pythonrepo/__init__.py b/pythonrepo/__init__.py index 28738c1..4b93938 100644 --- a/pythonrepo/__init__.py +++ b/pythonrepo/__init__.py @@ -18,7 +18,7 @@ __module__ = """pythonrepo""" -"""This is pythonrepo __module Template""" +"""This is pythonrepo module Template.""" __version__ = """1.1.4""" @@ -40,4 +40,3 @@ baton.__cause__ = err raise baton - diff --git a/pythonrepo/pythonrepo.py b/pythonrepo/pythonrepo.py index 2dd5519..1e25716 100644 --- a/pythonrepo/pythonrepo.py +++ b/pythonrepo/pythonrepo.py @@ -19,6 +19,7 @@ __module__ = """pythonrepo.pythonrepo""" +"""This is pythonrepo component Template.""" try: @@ -132,5 +133,6 @@ def main(*argv): if __name__ in '__main__': + # deepsource overlooks the readability of "if main" type code here. (See PTC-W0048) if (sys.argv is not None) and (len(sys.argv) >= 1): main(sys.argv[1:]) diff --git a/tests/profiling.py b/tests/profiling.py index 3c56391..3c8c124 100644 --- a/tests/profiling.py +++ b/tests/profiling.py @@ -1,9 +1,9 @@ #! /usr/bin/env python # -*- coding: utf-8 -*- -# Python Repo Template +# Python Test Repo Template # .................................. -# Copyright (c) 2017-2019, Kendrick Walls +# Copyright (c) 2017-2022, Kendrick Walls # .................................. # Licensed under MIT (the "License"); # you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ # limitations under the License. -# Third-party Acknowlegement: +# Third-party Acknowledgement: # .......................................... # Some code (namely: class timewith, @do_cprofile, @do_line_profile) was modified/derived from: # https://github.com/zapier/profiling-python-like-a-boss/tree/1ab93a1154 @@ -30,26 +30,45 @@ try: - import os import sys + if sys.__name__ is None: # pragma: no branch + raise ImportError("[CWE-758] OMG! we could not import sys! ABORT. ABORT.") +except Exception as err: # pragma: no branch + raise ImportError(err) + + +try: + if 'os' not in sys.modules: + import os + else: # pragma: no branch + os = sys.modules["""os"""] +except Exception: # pragma: no branch + raise ImportError("[CWE-758] OS Failed to import.") + + +try: import time - import cProfile - for keyModule in [os, sys, time, cProfile]: - if keyModule.__name__ is None: - raise NotImplementedError( - str("OMG! We could not import the {}!").format( - str(keyModule) - ) - ) + if time.__name__ is None: # pragma: no branch + raise NotImplementedError("[CWE-440] We could not import time. Are we in the speed-force!") except Exception as err: raise ImportError(err) + exit(3) + + +try: + import cProfile + if cProfile.__name__ is None: # pragma: no branch + raise NotImplementedError("[CWE-440] We could not import cProfile. ABORT!") +except Exception as err: # pragma: no branch + raise ImportError(err) + exit(3) try: try: sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), str('..')))) sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), str('.')))) - except Exception as ImportErr: + except Exception as ImportErr: # pragma: no branch print(str('')) print(str(type(ImportErr))) print(str(ImportErr)) @@ -57,9 +76,9 @@ print(str('')) ImportErr = None del ImportErr - raise ImportError(str("Profile module failed completely.")) -except Exception: - raise ImportError("Failed to import test profiling") + raise ImportError(str("[CWE-758] Profile module failed completely.")) +except Exception: # pragma: no branch + raise ImportError("[CWE-440] Failed to import test profiling") class timewith(): @@ -86,15 +105,43 @@ def __enter__(self): def __exit__(self, type, value, traceback): self.checkpoint(str("finished")) + pass def do_time_profile(func, timer_name="time_profile"): - """Runs a function with a timer""" + """Run a function with a timer. + + Time Testing: + + First some test fixtures: + + >>> import tests.context as context + >>> from context import profiling as profiling + >>> + + Testcase 0: test the time_profile. + + >>> def doWork(): + ... \"""Does some work.\""" + ... for i in range(0, 42): + ... print(str("Do Task {}").format(int(i))) + >>> + >>> profiling.do_time_profile( + ... doWork, + ... timer_name=str("work time test") + ... )() #doctest: -DONT_ACCEPT_BLANKLINE, +ELLIPSIS + work...Start Timer... + ...Do Task... + work...Stop Timer... + work...took ... seconds + >>> + + """ import functools @functools.wraps(func) def timer_profile_func(*args, **kwargs): - """Wraps a function in timewith()""" + """Wraps a function in timewith() function.""" theOutput = None with timewith(timer_name) as timer: timer.checkpoint(str("Start Timer")) @@ -106,7 +153,36 @@ def timer_profile_func(*args, **kwargs): def do_cprofile(func): - """use built-in profiler to profile.""" + """Use built-in profiler to profile. + + Time Testing: + + First some test fixtures: + + >>> import tests.context as context + >>> from context import profiling as profiling + >>> + + Testcase 0: test the time_profile. + + >>> def doWork(): + ... \"""Does some work.\""" + ... for i in range(0, 42): + ... print(str("Do Task {}").format(int(i))) + >>> + >>> profiling.do_cprofile( + ... doWork + ... )() #doctest: -DONT_ACCEPT_BLANKLINE, +ELLIPSIS + Do Task 0...Do Task 10...Do Task 20...Do Task 30...Do Task 40... + ...function calls in ... seconds...Ordered by: standard name... + ...ncalls tottime percall cumtime percall filename:lineno(function)... + ...<...>:1(doWork)...{built-in method builtins.print}... + + + >>> + + + """ def profiled_func(*args, **kwargs): profile = cProfile.Profile() try: @@ -122,7 +198,7 @@ def profiled_func(*args, **kwargs): try: # noqa from line_profiler import LineProfiler - def do_profile(follow=None): + def do_profile(follow=None): # pragma: no cover if follow is None: follow = [] @@ -140,9 +216,9 @@ def profiled_func(*args, **kwargs): return profiled_func return inner -except ImportError: +except ImportError: # pragma: no cover def do_profile(follow=None): - "Helpful if you accidentally leave in production!" + """Helpful if you accidentally leave in production!""" if follow is None: follow = [] @@ -153,16 +229,15 @@ def nothing(*args, **kwargs): return inner -def main(argv=None): - """The Main Event makes no sense to remediation.""" +def main(argv=None): # pragma: no cover + """The Main Event makes no sense to profiling.""" raise NotImplementedError("CRITICAL - test profiling main() not implemented. yet?") -if __name__ in '__main__': +if __name__ in '__main__': # pragma: no cover exitcode = 3 try: exitcode = main(sys.argv[1:]) finally: exit(exitcode) - diff --git a/tests/test_usage.py b/tests/test_usage.py index 58481a1..8032010 100644 --- a/tests/test_usage.py +++ b/tests/test_usage.py @@ -52,7 +52,7 @@ def getPythonCommand(): def buildPythonCommand(args=None): - """Function for building backend subprocess command line""" + """Function for building backend subprocess command line.""" theArgs = args # you need to change this to the name of your project __project__ = str("pythonrepo") @@ -80,7 +80,7 @@ def buildPythonCommand(args=None): def checkPythonCommand(args=None, stderr=None): - """Function for backend subprocess check_output command like testing with coverage support""" + """Function for backend subprocess check_output command like testing with coverage support.""" theOutput = None try: taintArgs = buildPythonCommand(args) @@ -163,11 +163,11 @@ class BasicUsageTestSuite(unittest.TestCase): """Basic functional test cases.""" def test_absolute_truth_and_meaning(self): - """Insanity Test. if ( is true ) """ + """Insanity Test. if ( is true ) usage.""" assert True def test_syntax(self): - """Test case importing code. if ( import is not None ) """ + """Test case importing code. if ( import is not None ) usage.""" theResult = False try: from .context import pythonrepo @@ -181,7 +181,7 @@ def test_syntax(self): assert theResult def test_template_case(self): - """Test case template for: python -m pythonrepo.* --version """ + """Test case template for: python -m pythonrepo.* --version usage.""" theResult = False thepython = getPythonCommand() if (thepython is not None): @@ -220,7 +220,7 @@ def test_template_case(self): assert theResult def test_profile_template_case(self): - """Test case template for profiling""" + """Test case template for profiling.""" theResult = False thepython = getPythonCommand() if (thepython is not None): @@ -259,7 +259,7 @@ def test_profile_template_case(self): @unittest.expectedFailure def test_fail_template_case(self): - """Test case template for profiling""" + """Test case template for profiling.""" theResult = False thepython = getPythonCommand() if (thepython is not None): @@ -298,7 +298,7 @@ def test_fail_template_case(self): @unittest.expectedFailure def test_bad_template_case(self): - """Test case template for profiling""" + """Test case template for profiling.""" theResult = False thepython = getPythonCommand() if (thepython is not None): From 1b4734b01c022e8cd3934d69cd517047b3a64a11 Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Sun, 25 Sep 2022 10:04:54 -0700 Subject: [PATCH 12/68] Swap whitespace for docs to apese deepsource padantics. --- pythonrepo/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonrepo/__init__.py b/pythonrepo/__init__.py index 4b93938..d6b3976 100644 --- a/pythonrepo/__init__.py +++ b/pythonrepo/__init__.py @@ -16,6 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Python Repo.""" __module__ = """pythonrepo""" """This is pythonrepo module Template.""" @@ -39,4 +40,3 @@ baton.path = __file__ baton.__cause__ = err raise baton - From defb45e7a57abe947862840028abe97dd99b14ee Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Sun, 25 Sep 2022 10:11:01 -0700 Subject: [PATCH 13/68] tweak to apese deepsource padantics. --- tests/__init__.py | 13 ++++------- tests/context.py | 24 +++++++++---------- tests/profiling.py | 57 ++++++++++++++++++++++++++++------------------ 3 files changed, 52 insertions(+), 42 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index a0a4ea7..7556770 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -37,11 +37,8 @@ if test_basic.__name__ is None: raise ImportError(str("Test module failed to import even the basic tests.")) except Exception as badErr: - print(str('')) - print(str(type(badErr))) - print(str(badErr)) - print(str((badErr.args))) - print(str('')) - badErr = None - del badErr - exit(0) + baton = ImportError(badErr, str("[CWE-758] Test module failed completely.")) + baton.module = __module__ + baton.path = __file__ + baton.__cause__ = badErr + raise baton diff --git a/tests/context.py b/tests/context.py index eded610..797d0dc 100644 --- a/tests/context.py +++ b/tests/context.py @@ -22,21 +22,21 @@ import os if 'pythonrepo' in __file__: sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -except Exception as ImportErr: - print(str(type(ImportErr))) - print(str(ImportErr)) - print(str((ImportErr.args))) - ImportErr = None - del ImportErr - raise ImportError("Python Repo Failed to Import") +except Exception as badErr: + baton = ImportError(badErr, str("[CWE-758] Test module failed completely.")) + baton.module = __module__ + baton.path = __file__ + baton.__cause__ = badErr + raise baton try: import pythonrepo as pythonrepo if pythonrepo.__name__ is None: raise ImportError("Failed to import pythonrepo.") -except Exception as importErr: - importErr = None - del importErr - raise ImportError("Test module failed to load pythonrepo for test.") - exit(0) +except Exception as badErr: + baton = ImportError(badErr, str("[CWE-758] Test module failed to load pythonrepo for test.")) + baton.module = __module__ + baton.path = __file__ + baton.__cause__ = badErr + raise baton diff --git a/tests/profiling.py b/tests/profiling.py index 3c8c124..abe7508 100644 --- a/tests/profiling.py +++ b/tests/profiling.py @@ -33,8 +33,12 @@ import sys if sys.__name__ is None: # pragma: no branch raise ImportError("[CWE-758] OMG! we could not import sys! ABORT. ABORT.") -except Exception as err: # pragma: no branch - raise ImportError(err) +except Exception as badErr: # pragma: no branch + baton = ImportError(badErr, str("[CWE-758] Test module failed completely.")) + baton.module = __module__ + baton.path = __file__ + baton.__cause__ = badErr + raise baton try: @@ -42,26 +46,37 @@ import os else: # pragma: no branch os = sys.modules["""os"""] -except Exception: # pragma: no branch - raise ImportError("[CWE-758] OS Failed to import.") +except Exception as badErr: # pragma: no branch + baton = ImportError(badErr, str("[CWE-758] Test module failed completely.")) + baton.module = __module__ + baton.path = __file__ + baton.__cause__ = badErr + raise baton try: import time if time.__name__ is None: # pragma: no branch raise NotImplementedError("[CWE-440] We could not import time. Are we in the speed-force!") -except Exception as err: - raise ImportError(err) - exit(3) +except Exception as badErr: # pragma: no branch + baton = ImportError(badErr, str("[CWE-758] Test module failed completely.")) + baton.module = __module__ + baton.path = __file__ + baton.__cause__ = badErr + raise baton try: - import cProfile - if cProfile.__name__ is None: # pragma: no branch - raise NotImplementedError("[CWE-440] We could not import cProfile. ABORT!") -except Exception as err: # pragma: no branch - raise ImportError(err) - exit(3) + if 'cProfile' not in sys.modules: + import cProfile + else: # pragma: no branch + cProfile = sys.modules["""cProfile"""] +except Exception as badErr: # pragma: no branch + baton = ImportError(badErr, str("[CWE-758] Test module failed completely.")) + baton.module = __module__ + baton.path = __file__ + baton.__cause__ = badErr + raise baton try: @@ -69,16 +84,14 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), str('..')))) sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), str('.')))) except Exception as ImportErr: # pragma: no branch - print(str('')) - print(str(type(ImportErr))) - print(str(ImportErr)) - print(str((ImportErr.args))) - print(str('')) - ImportErr = None - del ImportErr + raise ImportError(str("[CWE-758] Profile module failed completely.")) -except Exception: # pragma: no branch - raise ImportError("[CWE-440] Failed to import test profiling") +except Exception as badErr: # pragma: no branch + baton = ImportError(badErr, str("[CWE-758] Test module failed completely.")) + baton.module = __module__ + baton.path = __file__ + baton.__cause__ = badErr + raise baton class timewith(): From c5ff889c76d5353770c94cd50fce4cc18f00c1eb Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Sun, 25 Sep 2022 10:22:59 -0700 Subject: [PATCH 14/68] tweak to apese deepsource padantics. Less than ideal. --- tests/__init__.py | 11 ++++++++++- tests/context.py | 6 +++++- tests/profiling.py | 23 ++++++++++++++++++++--- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index 7556770..6ad829e 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -2,7 +2,7 @@ # Python Repo Template # .................................. -# Copyright (c) 2017-2019, Kendrick Walls +# Copyright (c) 2017-2022, Kendrick Walls # .................................. # Licensed under MIT (the "License"); # you may not use this file except in compliance with the License. @@ -16,6 +16,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Python Repo Testing Module.""" + +__module__ = """tests""" +"""This is pythonrepo testing module Template.""" + + try: try: import sys @@ -30,6 +36,9 @@ ImportErr = None del ImportErr raise ImportError(str("Test module failed completely.")) + from tests import context as context + if context.__name__ is None: + raise ImportError(str("Test module failed to import even the context framework.")) from tests import profiling as profiling if profiling.__name__ is None: raise ImportError(str("Test module failed to import even the profiling framework.")) diff --git a/tests/context.py b/tests/context.py index 797d0dc..f8c79ac 100644 --- a/tests/context.py +++ b/tests/context.py @@ -2,7 +2,7 @@ # Python Repo Template # .................................. -# Copyright (c) 2017-2019, Kendrick Walls +# Copyright (c) 2017-2022, Kendrick Walls # .................................. # Licensed under MIT (the "License"); # you may not use this file except in compliance with the License. @@ -17,6 +17,10 @@ # limitations under the License. +__module__ = """tests.context""" +"""This is pythonrepo testing module Template.""" + + try: import sys import os diff --git a/tests/profiling.py b/tests/profiling.py index abe7508..8ae82e0 100644 --- a/tests/profiling.py +++ b/tests/profiling.py @@ -29,6 +29,10 @@ # NO ASSOCIATION +__module__ = """tests.profiling""" +"""This is pythonrepo testing module Template.""" + + try: import sys if sys.__name__ is None: # pragma: no branch @@ -54,6 +58,19 @@ raise baton +try: + if 'functools' not in sys.modules: + import functools + else: # pragma: no branch + functools = sys.modules["""functools"""] +except Exception as badErr: # pragma: no branch + baton = ImportError(badErr, str("[CWE-758] Test module failed completely.")) + baton.module = __module__ + baton.path = __file__ + baton.__cause__ = badErr + raise baton + + try: import time if time.__name__ is None: # pragma: no branch @@ -150,8 +167,6 @@ def do_time_profile(func, timer_name="time_profile"): >>> """ - import functools - @functools.wraps(func) def timer_profile_func(*args, **kwargs): """Wraps a function in timewith() function.""" @@ -196,7 +211,9 @@ def do_cprofile(func): """ + @functools.wraps(func) def profiled_func(*args, **kwargs): + """Wraps a function in profile.enable/disable() functions.""" profile = cProfile.Profile() try: profile.enable() @@ -242,7 +259,7 @@ def nothing(*args, **kwargs): return inner -def main(argv=None): # pragma: no cover +def main(*argv): # pragma: no cover """The Main Event makes no sense to profiling.""" raise NotImplementedError("CRITICAL - test profiling main() not implemented. yet?") From 6d10c4c5628e4021a867b1c05842dd98c41856b8 Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Sun, 25 Sep 2022 10:24:45 -0700 Subject: [PATCH 15/68] Fixed a typo. --- tests/profiling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/profiling.py b/tests/profiling.py index 8ae82e0..c0ded40 100644 --- a/tests/profiling.py +++ b/tests/profiling.py @@ -87,7 +87,7 @@ if 'cProfile' not in sys.modules: import cProfile else: # pragma: no branch - cProfile = sys.modules["""cProfile"""] + cProfile = sys.modules["""cProfile"""] except Exception as badErr: # pragma: no branch baton = ImportError(badErr, str("[CWE-758] Test module failed completely.")) baton.module = __module__ From ee2cf6363f732c6f884eb1106358c32a1d5a025e Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Sun, 25 Sep 2022 10:26:57 -0700 Subject: [PATCH 16/68] Fixed a typo. --- tests/profiling.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/profiling.py b/tests/profiling.py index c0ded40..08b0b87 100644 --- a/tests/profiling.py +++ b/tests/profiling.py @@ -101,8 +101,7 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), str('..')))) sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), str('.')))) except Exception as ImportErr: # pragma: no branch - - raise ImportError(str("[CWE-758] Profile module failed completely.")) + raise ImportError(ImportErr, str("[CWE-758] Profile module failed completely.")) except Exception as badErr: # pragma: no branch baton = ImportError(badErr, str("[CWE-758] Test module failed completely.")) baton.module = __module__ From 61b9815a4f9276b0ec97e3c18e9a4b287c6f0bf8 Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Sun, 25 Sep 2022 10:55:21 -0700 Subject: [PATCH 17/68] tweak to apese deepsource padantics. Less than ideal. --- tests/test_basic.py | 6 +++--- tests/test_usage.py | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/test_basic.py b/tests/test_basic.py index ed0f053..f76f54f 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -47,7 +47,7 @@ def test_syntax(self): print(str(type(impErr))) print(str(impErr)) theResult = False - assert theResult + self.assertTrue(theResult) def test_the_help_command(self): """Test case for backend library.""" @@ -64,7 +64,7 @@ def test_the_help_command(self): theResult = True except Exception: theResult = False - assert theResult + self.assertTrue(theResult) def test_corner_case_example(self): """Example Test case for bad input directly into function.""" @@ -82,7 +82,7 @@ def test_corner_case_example(self): except Exception: self.fail("""Test Failed""") theResult = False - assert theResult + self.assertTrue(theResult) def test_new_tests(self): """Try adding new tests.""" diff --git a/tests/test_usage.py b/tests/test_usage.py index 8032010..9dfe1eb 100644 --- a/tests/test_usage.py +++ b/tests/test_usage.py @@ -164,7 +164,7 @@ class BasicUsageTestSuite(unittest.TestCase): def test_absolute_truth_and_meaning(self): """Insanity Test. if ( is true ) usage.""" - assert True + self.assertTrue(True) def test_syntax(self): """Test case importing code. if ( import is not None ) usage.""" @@ -178,7 +178,7 @@ def test_syntax(self): print(str(type(impErr))) print(str(impErr)) theResult = False - assert theResult + self.assertTrue(theResult) def test_template_case(self): """Test case template for: python -m pythonrepo.* --version usage.""" @@ -217,7 +217,7 @@ def test_template_case(self): err = None del err theResult = False - assert theResult + self.assertTrue(theResult) def test_profile_template_case(self): """Test case template for profiling.""" @@ -255,7 +255,7 @@ def test_profile_template_case(self): err = None del err theResult = False - assert theResult + self.assertTrue(theResult) @unittest.expectedFailure def test_fail_template_case(self): @@ -294,7 +294,7 @@ def test_fail_template_case(self): err = None del err theResult = False - assert theResult + self.assertTrue(theResult) @unittest.expectedFailure def test_bad_template_case(self): @@ -333,7 +333,7 @@ def test_bad_template_case(self): err = None del err theResult = False - assert theResult + self.assertTrue(theResult) if __name__ == '__main__': From c13a5288bd452ff06a8d5a33b1467820538805d3 Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Sun, 25 Sep 2022 11:19:34 -0700 Subject: [PATCH 18/68] Removed trailing whitespace. ( Fix for #29 ) --- .github/workflows/scorecards-analysis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index 98bfa4c..ca875f7 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -1,5 +1,5 @@ name: Scorecards supply-chain security -on: +on: # Only the default branch is supported. branch_protection_rule: schedule: @@ -17,7 +17,7 @@ jobs: permissions: # Needed to upload the results to code-scanning dashboard. security-events: write - + steps: - name: "Checkout code" uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0 @@ -34,7 +34,7 @@ jobs: repo_token: ${{ secrets.SCORECARD_TOKEN }} # Publish the results to enable scorecard badges. For more details, see # https://github.com/ossf/scorecard-action#publishing-results. - # If you are installing the action on a private repo, set it to `publish_results: false` + # If you are installing the action on a private repo, set it to `publish_results: false` # or comment out the following line. publish_results: true @@ -45,7 +45,7 @@ jobs: name: SARIF file path: results.sarif retention-days: 5 - + # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" uses: github/codeql-action/upload-sarif@5f532563584d71fdef14ee64d17bafb34f751ce5 # v1.0.26 From 993e752220bb0f1b15273b671a4a3ff7ae490979 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Mon, 8 Jul 2024 19:43:13 -0700 Subject: [PATCH 19/68] Updated for 2024 + New github templates for issues and PRs etc. + Updated cc year + added template GH action examples (see first GH action tests) + updated circle-ci to use newer python versions --- .circleci/config.yml | 9 + .github/CODE_OF_CONDUCT.md | 76 ++++ .github/CONTRIBUTING.md | 149 +++++++ .github/ISSUE_TEMPLATE.md | 30 ++ .github/ISSUE_TEMPLATE/bug_report.md | 36 ++ .github/ISSUE_TEMPLATE/documentation-gap.md | 20 + .github/ISSUE_TEMPLATE/feature-suggestion.md | 20 + .../volunteer-to-help-on-github.md | 14 + .../volunteer-to-help-template.md | 14 + .github/PULL_REQUEST_TEMPLATE.md | 51 +++ .github/labeler.yml | 46 ++ .github/tool_shlock_helper.sh | 99 +++++ .github/workflows/Labeler.yml | 19 + .github/workflows/Tests.yml | 401 ++++++++++++++++++ .github/workflows/codeql-analysis.yml | 70 +++ LICENSE.md | 2 +- Makefile | 7 +- docs/conf.py | 4 +- pythonrepo/__init__.py | 2 +- pythonrepo/pythonrepo.py | 2 +- tests/__init__.py | 2 +- tests/context.py | 2 +- tests/profiling.py | 2 +- 23 files changed, 1068 insertions(+), 9 deletions(-) create mode 100644 .github/CODE_OF_CONDUCT.md create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/documentation-gap.md create mode 100644 .github/ISSUE_TEMPLATE/feature-suggestion.md create mode 100644 .github/ISSUE_TEMPLATE/volunteer-to-help-on-github.md create mode 100644 .github/ISSUE_TEMPLATE/volunteer-to-help-template.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/labeler.yml create mode 100755 .github/tool_shlock_helper.sh create mode 100644 .github/workflows/Labeler.yml create mode 100644 .github/workflows/Tests.yml create mode 100644 .github/workflows/codeql-analysis.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index c1ce0f4..95097b5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,6 +5,9 @@ jobs: - image: circleci/python:3.7 - image: circleci/python:3.8 - image: circleci/python:3.9 + - image: circleci/python:3.10 + - image: circleci/python:3.11 + - image: circleci/python:3.12 environment: CI: cicleci DEBIAN_FRONTEND: noninteractive @@ -44,6 +47,9 @@ jobs: - image: circleci/python:3.7 - image: circleci/python:3.8 - image: circleci/python:3.9 + - image: circleci/python:3.10 + - image: circleci/python:3.11 + - image: circleci/python:3.12 parallelism: 2 environment: CI: cicleci @@ -91,6 +97,9 @@ jobs: - image: circleci/python:3.7 - image: circleci/python:3.8 - image: circleci/python:3.9 + - image: circleci/python:3.10 + - image: circleci/python:3.11 + - image: circleci/python:3.12 parallelism: 2 environment: CI: cicleci diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..55f3e7d --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct for Python Template + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Unethical, malicious, or other 'Black-hat' hacking activity that harms the +overall security of the project +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at . All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..a93d9cb --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,149 @@ +## Contributing +You are here to help the Python Multicast Project? Awesome, feel welcome and read the following sections in order to know what and how to work on something. If you get stuck at any point you can create a ticket on GitHub. + +Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue, assessing changes, and helping you finalize your pull requests. + + +When reporting an issue, please list the version of Python Multicast Library you are using and any relevant information about your software environment (python version, OS type and version, etc). Also avoid vague language like "it doesn't work." Please describe as specifically as you can what behavior you are actually seeing (eg: an error message? a nil return value?). + + +For all contributions, please respect the following guidelines: + +Each pull request should implement ONE feature or bugfix. If you want to add or fix more than one thing, submit more than one pull request. +- Do not commit changes to files that are irrelevant to your feature or bugfix (eg: .gitignore). +- Do not add new external dependencies unless ABSOLUTELY necessary (these could cause Load Errors on certain systems). +- Add new tests for new code if able (otherwise add descriptive pseudo-tests as issues). +- Be willing to accept criticism and work on improving your code; care must be taken not to introduce bugs or vulnerabilities. + +#### Known Issues and Possible Improvements + +For Details on current issues: +- see [Issues](https://github.com/reactive-firewall/python-repo/issues) + +## Triaging tickets +Here is a brief explanation on how I triage incoming tickets to get a better sense of what needs to be done on what end. + +>>Note +>> +>>You will need Triage permission on the project in order to do this. You can ask one of the members of the Team to give you access. (Please join the beta first.) + +## Initial triage +When sitting down to do some triaging work, start with the list of untriaged tickets. Consider all tickets that do not have a label as untriaged. The first step is to categorize the ticket into one of the following categories and either close the ticket or assign an appropriate lable. The reported issue + + * is not valid +If you think the ticket is invalid comment why you think it is invalid, then close the ticket. Tickets might be invalid if they were already fixed in the past or it was decided that the proposed feature will not be implemented because it does not conform with the overall goal of Pocket-PiAI Project. Also if you happen to know that the problem was already reported, label the ticket with Status: duplicate, reference the other ticket that is already addressing the problem and close the duplicate. + +Examples: + +This is an issue. (A good starting point for first person to discover) + + + * does not provide enough information +Add the label question if the reported issue does not contain enough information to decide if it is valid or not and ask on the ticket for the required information to go forward. I will re-triage all tickets that have the label question assigned. If the original reporter left new information we can try to re-categorize the ticket. If the reporter did not come back to provide more required information after a long enough time, we will close the ticket (this should be roughly about two weeks). + +Examples: + +My builds stopped working. Please help! Ask for a link to the build log and for which project is affected. + + + * is a valid enhancement proposal +If the ticket contains an enhancement proposal that aligns with the goals of this repo, then add the label Enhancement. If the proposal seems valid but requires further discussion between core contributors because there might be different possibilities on how to implement the enhancement, then also add the label question. + +Examples: + +Improve documentation Examples in contribute docs. +Provide better integration with security feature XYZ +Refactor module X for better readability (see #48) +Achieve world domination (also needs the label question) + + + * is a valid problem within the code base: +If it’s a valid bug, then add the label Bug. Try to reference related issues if you come across any. + +Examples: + +Example Library fails to transmit the leter 'x' or 'y' (logs attached) + + + * is a question and needs answering: +If the ticket contains a question about the code, then move question to FAQ on wiki and add task to answer question on wiki to the issue (or close if already answered). + +Examples: + +My message was seen by two hosts. Why? +Why are my builds failing? + + +Helpful links for triaging +Here is a list of links for contributors that look for work: + +Untriaged tickets: Go and triage them! + + +# Reviewing: + +This is the checklist that I try to go through for every single pull request that I get. If you're wondering why it takes so long for me to accept pull requests, this is why. + +## General + +- [ ] Is this change useful to me, or something that I think will benefit others greatly? +- [ ] Check for overlap with other PRs. +- [ ] Think carefully about the long-term implications of the change. How will it affect existing projects that are dependent on this? How will it affect my projects? If this is complicated, do I really want to maintain it forever? Is there any way it could be implemented as a separate package, for better modularity and flexibility? + +## Check the Code + +- [ ] If it does too much, ask for it to be broken up into smaller PRs. +- [ ] Does it pass `make test-style` (flake8, etc.)? +- [ ] Is it consistent? +- [ ] Review the changes carefully, line by line. Make sure you understand every single part of every line. Learn whatever you do not know yet. +- [ ] Take the time to get things right. PRs almost always require additional improvements to meet the bar for quality. Be very strict about quality. This usually takes several commits on top of the original PR. + +## Check the Tests + +- [ ] Does it have tests? If not: + + - [ ] Comment on the PR "Can you please add tests for this code to `tests/test_blah.py`", or... + - [ ] Write the tests yourself. + +- [ ] Do the tests pass for all of the following? If not, write a note in the PR, or fix them yourself. + + - [ ] Python 3.8 - Mac + - [ ] Python 3.8 - Linux (OPTIONAL) + - [ ] Python 3.9 - Linux + - [ ] Python 3.9 (or Newer) - Mac + - [ ] Python 3.10 - Linux + - [ ] Python 3.11 - Linux + - [ ] Python 3.12 - Linux + - [ ] Python any - Windows (OPTIONAL) + +## Check the Docs + +- [ ] Does it have docs? If not: + + - [ ] Comment on the PR "Can you please add docs for this feature to the wiki", or... + - [ ] Write the docs yourself. + +- [ ] If any new functions/classes are added, do they contain docstrings? + +## Credit the Authors + +- [ ] Add name and URL to `README.md` for security fixes. +- [ ] Thank them for their hard work. + +## Check the copyright year: + +- [ ] reads: + +> Copyright (c) 2017-2024, Author + + +## Close Issues + +- [ ] Merge the PR branch. This will close the PR's issue. +- [ ] Close any duplicate or related issues that can now be closed. Write thoughtful comments explaining how the issues were resolved. + +## Release (optional) + +- [ ] Decide whether the changes in master make sense as a major, minor, or patch release. +- [ ] Look at the clock. If you're tired, release later when you have time to deal with release problems. +- [ ] Then follow all the steps in [EXAMPLE Release Checklist](https://github.com/reactive-firewall/python-repo/issues/) FIXME! diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..751474c --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,30 @@ +>> Your Issue may have already been reported! +>> Please check the [list of issues](../) before creating a new one. + +## Basic Info +>> When reporting an issue, please list the version of Python Multicast Library you are using and any relevant information about your software environment: + - Python version: + >> `python3 --version || python --version` + - OS type +>> `uname -a` + - [ ] linux + - [ ] MacOS (darwin) +- `multicast` version: +>> `python3 -m pythonrepo.pythonrepo --version` + + + +## Steps to Reproduce Issue: + +>> Avoid vague language like "it doesn't work." Please describe as specifically as you can what behavior you are actually seeing (eg: an error message? a nil return value?). +1. +2. +3. +4. + +## Logs (If Available): +>> Please attach any logs from pythonrepo relevant to the bug. + + +## Additional Information: +>> Anything else relevant to this issue. diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..a3a7bea --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,36 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: Bug, Failing +assignees: reactive-firewall + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Logs** _(optional)_ +If applicable, add logs here to help explain your problem. + +**Screenshots** _(optional)_ +If applicable, add screenshots to help explain your problem. + +**PiAP Device (please complete the following information):** + - OS: [e.g. macOS] + - OS Version: [e.g. 22] + - Python Version [e.g. 3.9] _(optional)_ + - Python Template Version: [e.g. v0.5.0] + +**Additional context** _(optional)_ +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/documentation-gap.md b/.github/ISSUE_TEMPLATE/documentation-gap.md new file mode 100644 index 0000000..9cfdc61 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation-gap.md @@ -0,0 +1,20 @@ +--- +name: Documentation gap +about: Create a question to help us improve our documentation +title: I have a question about +labels: Documentation, Github, question +assignees: '' + +--- + +**Describe the question** +A clear and concise question. + +**Expected answer form** +A clear and concise description of what you expected to find in the documentation. + +**Related Documentation** __(optional)__ +If applicable, add documentation references to help explain your question. + +**Additional context** +Add any other context about the question here. diff --git a/.github/ISSUE_TEMPLATE/feature-suggestion.md b/.github/ISSUE_TEMPLATE/feature-suggestion.md new file mode 100644 index 0000000..790ea04 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-suggestion.md @@ -0,0 +1,20 @@ +--- +name: Feature Suggestion +about: Suggest an idea for this project +title: Plea for awesome feature +labels: Design, Enhancement +assignees: reactive-firewall + +--- + +**Is your feature request related to a problem? Please describe.** _(optional)_ +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/volunteer-to-help-on-github.md b/.github/ISSUE_TEMPLATE/volunteer-to-help-on-github.md new file mode 100644 index 0000000..f2241b7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/volunteer-to-help-on-github.md @@ -0,0 +1,14 @@ +--- +name: Volunteer to help on Github +about: Offer to help with the project +title: Can I help out? +labels: Github, question, wontfix +assignees: '' + +--- + +**introduction (introduce yourself)** +[e.g. Hi I am a template robot.] + +**Motivation (why do you want to help)** +Please describe why you want to help, do you like testing or fixing or something else? diff --git a/.github/ISSUE_TEMPLATE/volunteer-to-help-template.md b/.github/ISSUE_TEMPLATE/volunteer-to-help-template.md new file mode 100644 index 0000000..913d621 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/volunteer-to-help-template.md @@ -0,0 +1,14 @@ +--- +name: Volunteer to help template +about: Offer to help with the project +title: Can I help out? +labels: question, wontfix +assignees: '' + +--- + +**introduction (introduce yourself)** +[e.g. Hi I am a template robot.] + +**Motivation (why do you want to help)** +Please describe why you want to help, do you like testing or fixing or something else? diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..93c6e9b --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,51 @@ +# Reviewing: + +This is the checklist that I try to go through for every single pull request that I get. If you're wondering why it takes so long for me to accept pull requests, this is why. + +## General + +- [ ] Is this change useful to me, or something that I think will benefit others greatly? +- [ ] Check for overlap with other PRs. +- [ ] Think carefully about the long-term implications of the change. How will it affect existing projects that are dependent on this? How will it affect my projects? If this is complicated, do I really want to maintain it forever? Is there any way it could be implemented as a separate package, for better modularity and flexibility? + +## Check the Code + +- [ ] If it does too much, ask for it to be broken up into smaller PRs. +- [ ] Does it pass `make test-style` (flake8, etc.)? +- [ ] Is it consistent? +- [ ] Review the changes carefully, line by line. Make sure you understand every single part of every line. Learn whatever you do not know yet. +- [ ] Take the time to get things right. PRs almost always require additional improvements to meet the bar for quality. Be very strict about quality. This usually takes several commits on top of the original PR. + +## Check the Tests + +- [ ] Does it have tests? If not: + +- [ ] Comment on the PR "Can you please add tests for this code to `tests/test_blah.py`", or... +- [ ] Write the tests yourself. + +- [ ] Do the tests pass for all of the CI tests? If not, write a note in the PR to fix CI, or fix them yourself. + +## Check the Docs + +- [ ] Does it have docs? If not: + +- [ ] Comment on the PR "Can you please add docs for this feature to the wiki", or... +- [ ] Write the docs yourself. + +- [ ] If any new functions/classes are added, do they contain docstrings? + +## Credit the Authors + +- [ ] Add name and URL to `README.md` for security fixes. +- [ ] Thank them for their hard work. + +## Close Issues + +- [ ] Merge the PR branch. This will close the PR's issue. +- [ ] Close any duplicate or related issues that can now be closed. Write thoughtful comments explaining how the issues were resolved. + +## Release (optional) + +- [ ] Decide whether the changes in master make sense as a major, minor, or patch release. +- [ ] Look at the clock. If you're tired, release later when you have time to deal with release problems. +- [ ] Then follow all the steps in [Release Checklist] diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..687aa86 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,46 @@ +# Add 'Multicast' label to any root file changes +Multicast: + - setup.py + - multicast/*.py + +# Add 'Lint' label to any lint file changes +Linter: + - .stickler.yml + - .hound.yml + - .yamllint.conf + - .flake8.ini + - .deepsource.toml + - tests/check_* + +# Add 'Lang' label to any python file changes +Python Lang: + - **/*.py + - *.py + +Configs: + - *.yml + - ./**/*.yml + - *.ini + - *.toml + - *.cfg + - requirements.txt + +# Add 'test' label +Testing: + - tests/**/*.py + - tests/* + - .circleci/* + +CI: + - tests/*.py + - .stickler.yml + - .hound.yml + - .travis.yml + - .appveyor.yml + - .github/workflows/* + - .circleci/* + +Github: + - .github/**/* + - .github/* + - README.md diff --git a/.github/tool_shlock_helper.sh b/.github/tool_shlock_helper.sh new file mode 100755 index 0000000..8c44114 --- /dev/null +++ b/.github/tool_shlock_helper.sh @@ -0,0 +1,99 @@ +#! /bin/bash +# Disclaimer of Warranties. +# A. YOU EXPRESSLY ACKNOWLEDGE AND AGREE THAT, TO THE EXTENT PERMITTED BY +# APPLICABLE LAW, USE OF THIS SHELL SCRIPT AND ANY SERVICES PERFORMED +# BY OR ACCESSED THROUGH THIS SHELL SCRIPT IS AT YOUR SOLE RISK AND +# THAT THE ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY AND +# EFFORT IS WITH YOU. +# +# B. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SHELL SCRIPT +# AND SERVICES ARE PROVIDED "AS IS" AND "AS AVAILABLE", WITH ALL FAULTS AND +# WITHOUT WARRANTY OF ANY KIND, AND THE AUTHOR OF THIS SHELL SCRIPT'S LICENSORS +# (COLLECTIVELY REFERRED TO AS "THE AUTHOR" FOR THE PURPOSES OF THIS DISCLAIMER) +# HEREBY DISCLAIM ALL WARRANTIES AND CONDITIONS WITH RESPECT TO THIS SHELL SCRIPT +# SOFTWARE AND SERVICES, EITHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF +# MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, +# ACCURACY, QUIET ENJOYMENT, AND NON-INFRINGEMENT OF THIRD PARTY RIGHTS. +# +# C. THE AUTHOR DOES NOT WARRANT AGAINST INTERFERENCE WITH YOUR ENJOYMENT OF THE +# THE AUTHOR's SOFTWARE AND SERVICES, THAT THE FUNCTIONS CONTAINED IN, OR +# SERVICES PERFORMED OR PROVIDED BY, THIS SHELL SCRIPT WILL MEET YOUR +# REQUIREMENTS, THAT THE OPERATION OF THIS SHELL SCRIPT OR SERVICES WILL +# BE UNINTERRUPTED OR ERROR-FREE, THAT ANY SERVICES WILL CONTINUE TO BE MADE +# AVAILABLE, THAT THIS SHELL SCRIPT OR SERVICES WILL BE COMPATIBLE OR +# WORK WITH ANY THIRD PARTY SOFTWARE, APPLICATIONS OR THIRD PARTY SERVICES, +# OR THAT DEFECTS IN THIS SHELL SCRIPT OR SERVICES WILL BE CORRECTED. +# INSTALLATION OF THIS THE AUTHOR SOFTWARE MAY AFFECT THE USABILITY OF THIRD +# PARTY SOFTWARE, APPLICATIONS OR THIRD PARTY SERVICES. +# +# D. YOU FURTHER ACKNOWLEDGE THAT THIS SHELL SCRIPT AND SERVICES ARE NOT +# INTENDED OR SUITABLE FOR USE IN SITUATIONS OR ENVIRONMENTS WHERE THE FAILURE +# OR TIME DELAYS OF, OR ERRORS OR INACCURACIES IN, THE CONTENT, DATA OR +# INFORMATION PROVIDED BY THIS SHELL SCRIPT OR SERVICES COULD LEAD TO +# DEATH, PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE, +# INCLUDING WITHOUT LIMITATION THE OPERATION OF NUCLEAR FACILITIES, AIRCRAFT +# NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, LIFE SUPPORT OR +# WEAPONS SYSTEMS. +# +# E. NO ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY THE AUTHOR +# SHALL CREATE A WARRANTY. SHOULD THIS SHELL SCRIPT OR SERVICES PROVE DEFECTIVE, +# YOU ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. +# +# Limitation of Liability. +# F. TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, IN NO EVENT SHALL THE AUTHOR +# BE LIABLE FOR PERSONAL INJURY, OR ANY INCIDENTAL, SPECIAL, INDIRECT OR +# CONSEQUENTIAL DAMAGES WHATSOEVER, INCLUDING, WITHOUT LIMITATION, DAMAGES +# FOR LOSS OF PROFITS, CORRUPTION OR LOSS OF DATA, FAILURE TO TRANSMIT OR +# RECEIVE ANY DATA OR INFORMATION, BUSINESS INTERRUPTION OR ANY OTHER +# COMMERCIAL DAMAGES OR LOSSES, ARISING OUT OF OR RELATED TO YOUR USE OR +# INABILITY TO USE THIS SHELL SCRIPT OR SERVICES OR ANY THIRD PARTY +# SOFTWARE OR APPLICATIONS IN CONJUNCTION WITH THIS SHELL SCRIPT OR +# SERVICES, HOWEVER CAUSED, REGARDLESS OF THE THEORY OF LIABILITY (CONTRACT, +# TORT OR OTHERWISE) AND EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGES. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION +# OR LIMITATION OF LIABILITY FOR PERSONAL INJURY, OR OF INCIDENTAL OR +# CONSEQUENTIAL DAMAGES, SO THIS LIMITATION MAY NOT APPLY TO YOU. In no event +# shall THE AUTHOR's total liability to you for all damages (other than as may +# be required by applicable law in cases involving personal injury) exceed +# the amount of five dollars ($5.00). The foregoing limitations will apply +# even if the above stated remedy fails of its essential purpose. +################################################################################ + +# version 20230115 + +umask 137 + +declare -r MINPARAMS=1 +declare LOCK_FILE="/tmp/GIL.lock" +declare -i PID_VALUE="${PPID:-$$}" + +if [[ $# -gt "$MINPARAMS" ]] ; then + while [ $# -gt $MINPARAMS ]; do # Until you run out of parameters . . . + + case "$1" in + -p|--pid) shift ; export PID_VALUE="${1}" ;; + -f|--file) shift ; export LOCK_FILE="${1}" ;; + -*) echo "$0: \"${1}\" Argument Unrecognized!" 1>&2 || false ;; + *) export LOCK_FILE="${1}" || false ;; + esac + shift + done +fi + +if [[ ( -e "${LOCK_FILE}" ) ]] ; then + if [[ ( "${PID_VALUE}" -eq $(head -n 1 "${LOCK_FILE}") ) ]] ; then + EXIT_CODE=0 ; + else + EXIT_CODE=$(head -n 1 "${LOCK_FILE}") ; + fi +fi + +if [[ ( $# -eq 0 ) ]] ; then + echo -n "${PID_VALUE:-$PPID}" > "${LOCK_FILE}" ; wait ; + test -e "${LOCK_FILE}" || false ; + EXIT_CODE=0 ; +fi + +exit ${EXIT_CODE:-126}; + diff --git a/.github/workflows/Labeler.yml b/.github/workflows/Labeler.yml new file mode 100644 index 0000000..2f59e0c --- /dev/null +++ b/.github/workflows/Labeler.yml @@ -0,0 +1,19 @@ +name: "Pull Request Labeler" +on: + pull_request_target: + types: [opened, reopened] + branches: [ master, stable ] + +jobs: + triage: + permissions: + actions: read + contents: read + packages: none + pull-requests: write + security-events: none + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v4 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml new file mode 100644 index 0000000..1d13627 --- /dev/null +++ b/.github/workflows/Tests.yml @@ -0,0 +1,401 @@ +name: CI +on: + push: + branches: + - master + - stable + tags: + - v* + +jobs: + BUILD: + if: github.repository == 'reactive-firewall/python-repo' + runs-on: ubuntu-latest + defaults: + run: + shell: bash + env: + LANG: "en_US.UTF-8" + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.12" + - name: Pre-Clean + id: clean + run: make -j1 -f Makefile purge 2>/dev/null || true ; + - name: Test Build + id: build + run: make -j1 -f Makefile build ; + - name: Post-Clean + id: post + run: make -j1 -f Makefile purge || true ; + + + BOOTSTRAP: + if: ${{ always() }} + needs: BUILD + runs-on: ubuntu-latest + defaults: + run: + shell: bash + timeout-minutes: 5 + continue-on-error: ${{ matrix.experimental }} + strategy: + fail-fast: false + matrix: + python-version: [3.7, 3.8, 3.9, 3.11, 3.12] + lang-var: ["de.utf-8", "jp.utf-8"] + experimental: [true] + include: + - python-version: 3.7 + lang-var: "en_US.utf-8" + experimental: false + - python-version: 3.8 + lang-var: "en_US.utf-8" + experimental: false + - python-version: 3.9 + lang-var: "de.utf-8" + experimental: false + - python-version: 3.9 + lang-var: "jp.utf-8" + experimental: false + - python-version: 3.9 + lang-var: "en_US.utf-8" + experimental: false + - python-version: "3.11" + lang-var: "en_US.utf-8" + experimental: false + - python-version: "3.12" + lang-var: "en_US.utf-8" + experimental: false + env: + PYTHON_VERSION: ${{ matrix.python-version }} + LANG: ${{ matrix.lang-var }} + steps: + - uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Setup dependencies + run: | + python -m pip install --upgrade pip setuptools wheel + pip install -r ./requirements.txt + - name: Pre-build + id: bootstrap + run: | + make -j1 -f Makefile clean || true ; + make -j1 -f Makefile build ; + shell: bash + - name: Summerize Building + id: sumerize-py-build + run: | + echo "- Building works on python version ${{ matrix.python-version }}" >> $GITHUB_STEP_SUMMARY + if: ${{ success() }} + shell: bash + - name: Run Tests + id: test-install + run: make -j1 -f Makefile user-install ; + shell: bash + - name: Summerize Install + id: sumerize-user-install + run: | + echo "- User Installing works on python version ${{ matrix.python-version }}" >> $GITHUB_STEP_SUMMARY + if: ${{ success() }} + shell: bash + - name: Test Info + id: test-info + run: python -m setup --name --version --license || true ; + - name: Post-Clean + id: post + run: | + make -j1 -f Makefile purge || true ; + make -j1 -f Makefile clean || true ; + if: ${{ always() }} + shell: bash + + + MATS: + if: ${{ always() }} + needs: BUILD + runs-on: ubuntu-latest + defaults: + run: + shell: bash + timeout-minutes: 10 + strategy: + matrix: + python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"] + env: + PYTHON_VERSION: ${{ matrix.python-version }} + LANG: "en_US.utf-8" + steps: + - uses: actions/checkout@v3 + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies for ${{ matrix.python-version }} + run: | + pip install -r ./requirements.txt ; + pip install coverage || true ; + - name: Pre-Clean + id: clean + run: make -j1 -f Makefile clean || true ; + - name: Run Tests for python ${{ matrix.python-version }} + id: tests + run: make -j1 -f Makefile test ; + - name: Summerize MATs for python ${{ matrix.python-version }} + id: sumerize-mats + run: | + echo "- MATS works on python version ${{ matrix.python-version }}" >> $GITHUB_STEP_SUMMARY + if: ${{ success() }} + shell: bash + - name: Post-Clean + id: post + run: make -j1 -f Makefile clean || true ; + if: ${{ always() }} + + + COVERAGE: + if: ${{ success() }} + needs: [BUILD, MATS] + runs-on: ${{ matrix.os }} + timeout-minutes: 10 + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"] + env: + OS: ${{ matrix.os }} + PYTHON_VERSION: ${{ matrix.python-version }} + LANG: "en_US.utf-8" + COVERAGE_RCFILE: ./.coveragerc + COV_CORE_SOURCE: ./ + COV_CORE_CONFIG: ./.coveragerc + COV_CORE_DATAFILE: ./coverage.xml + CODECLIMATE_REPO_TOKEN: ${{ secrets.CODECLIMATE_TOKEN }} + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + steps: + - uses: actions/checkout@v3 + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies for python ${{ matrix.python-version }} on ${{ matrix.os }} + run: | + pip install --upgrade --upgrade-strategy eager pip setuptools wheel ; + pip install --upgrade --upgrade-strategy eager -r ./requirements.txt ; + pip install --upgrade --upgrade-strategy eager pytest ; + pip install --upgrade --upgrade-strategy eager pytest-cov ; + pip install --upgrade --upgrade-strategy eager coverage ; + - name: Install code-climate tools for ${{ matrix.python-version }} + if: ${{ runner.os }} == "Linux" + shell: bash + run: | + if [ $OS == ubuntu-latest ] ; then curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter || true ; fi ; + if [ $OS == ubuntu-latest ] ; then chmod +x ./cc-test-reporter 2>/dev/null || true ; fi + if [ $OS == ubuntu-latest ] ; then ./cc-test-reporter before-build || true ; fi + - name: Install deepsource tools for ${{ matrix.python-version }} + if: ${{ runner.os }} == "Linux" + shell: bash + run: | + if [ $OS == ubuntu-latest ] ; then (curl https://deepsource.io/cli | sh) || true ; else echo "SKIP deepsource" ; fi ; + - name: Pre-Clean + id: clean + run: make -j1 -f Makefile clean || true ; + - name: Generate Coverage for py3.9 on ${{ matrix.os }} + if: ${{ runner.python-version }} == "3.9" + run: make -f Makefile test ; + - name: Generate Coverage for py${{ matrix.python-version }} on ${{ matrix.os }} + if: ${{ runner.python-version }} != "3.9" + run: make -f Makefile test-pytest ; + - name: Upload Python ${{ matrix.python-version }} coverage to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage.xml + directory: . + flags: ${{ matrix.os }},${{ matrix.python-version }} + name: pythonrepo-github-${{ matrix.os }}-${{ matrix.python-version }} + verbose: true + fail_ci_if_error: false + - name: Upload Python ${{ matrix.python-version }} Artifact + uses: actions/upload-artifact@v3 + with: + name: Test-Report-${{ matrix.os }}-${{ matrix.python-version }} + path: ./test-reports/ + if-no-files-found: ignore + - name: code-climate for ${{ matrix.python-version }} + if: ${{ runner.os }} == "Linux" + shell: bash + run: | + if [ $OS == ubuntu-latest ] ; then ./cc-test-reporter after-build --exit-code 0 || true ; else echo "SKIP code climate" ; fi ; + - name: deepsource for ${{ matrix.python-version }} + if: ${{ runner.os }} == "Linux" + shell: bash + run: | + if [ $OS == ubuntu-latest ] ; then ./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml 2>/dev/null || true ; else echo "SKIP deepsource" ; fi ; + - name: Post-Clean + id: post + run: make -j1 -f Makefile clean || true ; + if: ${{ always() }} + + + STYLE: + if: ${{ success() }} + needs: [BUILD, MATS] + runs-on: ubuntu-latest + timeout-minutes: 10 + + env: + PYTHON_VERSION: '3.10' + LANG: "en_US.utf-8" + + steps: + - uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: Install dependencies for python Linters + run: | + pip install --upgrade pip setuptools wheel + pip install -r ./requirements.txt ; + pip install flake8 ; + pip install pyflakes ; + pip install pep8 ; + - name: Pre-Clean + id: clean + run: make -j1 -f Makefile clean || true ; + - name: Testing Style + id: style + run: make -j1 -f Makefile test-style ; + shell: bash + - name: Post-Clean + id: post + run: make -j1 -f Makefile clean || true ; + if: ${{ always() }} + + + INTEGRATION: + if: ${{ success() }} + needs: [MATS, COVERAGE] + runs-on: ${{ matrix.os }} + timeout-minutes: 10 + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"] + env: + OS: ${{ matrix.os }} + PYTHON_VERSION: ${{ matrix.python-version }} + LANG: "en_US.utf-8" + LC_CTYPE: "en_US.utf-8" + COVERAGE_RCFILE: ./.coveragerc + COV_CORE_SOURCE: ./ + COV_CORE_CONFIG: ./.coveragerc + COV_CORE_DATAFILE: .coverage + CODECLIMATE_REPO_TOKEN: ${{ secrets.CODECLIMATE_TOKEN }} + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + steps: + - uses: actions/checkout@v3 + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies for python ${{ matrix.python-version }} on ${{ matrix.os }} + run: | + pip install --upgrade pip setuptools wheel + pip install -r ./requirements.txt ; + pip install coverage ; + pip install pytest ; + pip install pytest-cov ; + - name: Install code-climate tools for ${{ matrix.python-version }} + if: ${{ runner.os }} != "Linux" + run: | + if [ $OS == macos-latest ] ; then curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-darwin-amd64 > ./cc-test-reporter || true ; fi ; + if [ $OS == macos-latest ] ; then chmod +x ./cc-test-reporter 2>/dev/null || true ; fi + if [ $OS == macos-latest ] ; then ./cc-test-reporter before-build || true ; fi + shell: bash + - name: Pre-Clean + id: clean-prep + run: make -j1 -f Makefile clean ; + - name: Pre-build for Python ${{ matrix.python-version }} on ${{ matrix.os }} + run: make -j1 -f Makefile build ; + if: ${{ success() }} + - name: Pre-install for Python ${{ matrix.python-version }} on ${{ matrix.os }} + run: make -j1 -f Makefile user-install || true ; + if: ${{ success() }} + - name: Re-Generate Coverage for py${{ matrix.python-version }} on ${{ matrix.os }} + run: | + make -j1 -f Makefile test-pytest ; + cp -vf ./coverage.xml ./test-reports/coverage.xml || true ; + shell: bash + - name: Upload Python ${{ matrix.python-version }} coverage to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./test-reports/coverage_supplement.xml + directory: . + flags: ${{ matrix.os }},${{ matrix.python-version }} + name: pythonrepo-github-${{ matrix.os }}-${{ matrix.python-version }} + verbose: true + fail_ci_if_error: false + - name: Upload Extra Python ${{ matrix.python-version }} Artifact + uses: actions/upload-artifact@v3 + with: + name: Integration-Test-Report-${{ matrix.os }}-${{ matrix.python-version }} + path: ./test-reports/ + if-no-files-found: ignore + - name: code-climate for ${{ matrix.python-version }} + if: ${{ runner.os }} != "Linux" + run: | + if [ $OS == macos-latest ] ; then ./cc-test-reporter after-build --exit-code 0 || true ; else echo "SKIP code climate" ; fi ; + - name: Post-purge + id: post-uninstall + run: make -j1 -f Makefile purge || true ; + if: ${{ always() }} + - name: Post-Clean + id: post-z-end + run: make -j1 -f Makefile clean || true ; + if: ${{ always() }} + + + TOX: + if: ${{ success() }} + needs: [MATS, STYLE, COVERAGE, INTEGRATION] + runs-on: ubuntu-latest + timeout-minutes: 30 + + env: + PYTHON_VERSION: '3.10' + LANG: 'en_US.utf-8' + + steps: + - uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: Install dependencies for Tox + run: | + pip install --upgrade pip setuptools wheel tox + pip install -r ./requirements.txt ; + pip install coverage ; + pip install codecov ; + pip install flake8 ; + pip install pyflakes ; + pip install pep8 ; + pip install tox ; + pip install six ; + - name: Pre-Clean + id: clean + run: make -j1 -f Makefile clean || true ; + - name: Testing Tox + run: make -j1 -f Makefile test-tox || true ; + - name: Post-Clean + id: post + run: make -j1 -f Makefile clean || true ; + if: ${{ always() }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..f3c47ce --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,70 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ master, stable ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ stable ] + schedule: + - cron: '17 5 * * 1' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'python' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://git.io/codeql-language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/LICENSE.md b/LICENSE.md index 3ee50db..c81523f 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ License - MIT -Copyright (c) 2017-2022 Mr. Walls +Copyright (c) 2017-2024 Mr. Walls THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/Makefile b/Makefile index 01ba15f..b7ae54d 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # Python Repo Template # .................................. -# Copyright (c) 2017-2019, 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. @@ -69,6 +69,11 @@ install: must_be_root $(QUITE)$(WAIT) $(QUIET)$(ECHO) "$@: Done." +user-install: must_be_root + $(QUIET)python3 -m pip install --user "git+https://github.com/reactive-firewall/pythonrepo.git#egg=pythonrepo" + $(QUITE)$(WAIT) + $(QUIET)$(ECHO) "$@: Done." + uninstall: $(QUITE)python3 -m pip uninstall pythonrepo || true $(QUITE)$(WAIT) diff --git a/docs/conf.py b/docs/conf.py index 1437135..ae43ce2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -42,7 +42,7 @@ # General information about the project. project = u'python_template' -copyright = u'2017-2019, reactive-firewall' +copyright = u'2017-2024, reactive-firewall' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -51,7 +51,7 @@ # The short X.Y version. version = 'v1.1' # The full version, including alpha/beta/rc tags. -release = 'v1.1.4' +release = 'v1.1.5' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/pythonrepo/__init__.py b/pythonrepo/__init__.py index d6b3976..2e52aac 100644 --- a/pythonrepo/__init__.py +++ b/pythonrepo/__init__.py @@ -2,7 +2,7 @@ # Python Repo Template # .................................. -# Copyright (c) 2017-2022, 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. diff --git a/pythonrepo/pythonrepo.py b/pythonrepo/pythonrepo.py index 1e25716..d9904ef 100644 --- a/pythonrepo/pythonrepo.py +++ b/pythonrepo/pythonrepo.py @@ -3,7 +3,7 @@ # Python Repo Template # .................................. -# Copyright (c) 2017-2022, 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. diff --git a/tests/__init__.py b/tests/__init__.py index 6ad829e..702eb23 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -2,7 +2,7 @@ # Python Repo Template # .................................. -# Copyright (c) 2017-2022, 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. diff --git a/tests/context.py b/tests/context.py index f8c79ac..0295996 100644 --- a/tests/context.py +++ b/tests/context.py @@ -2,7 +2,7 @@ # Python Repo Template # .................................. -# Copyright (c) 2017-2022, 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. diff --git a/tests/profiling.py b/tests/profiling.py index 08b0b87..c6b547f 100644 --- a/tests/profiling.py +++ b/tests/profiling.py @@ -3,7 +3,7 @@ # Python Test Repo Template # .................................. -# Copyright (c) 2017-2022, 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. From 3dbd9f8d01385de0ff7533c1284246332d8c5cab Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Mon, 8 Jul 2024 21:32:52 -0700 Subject: [PATCH 20/68] Regression fix for GH Actions and user-install action --- .github/workflows/Tests.yml | 5 ++++- Makefile | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 1d13627..00dc627 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -44,7 +44,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.7, 3.8, 3.9, 3.11, 3.12] + python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"] lang-var: ["de.utf-8", "jp.utf-8"] experimental: [true] include: @@ -63,6 +63,9 @@ jobs: - python-version: 3.9 lang-var: "en_US.utf-8" experimental: false + - python-version: "3.10" + lang-var: "en_US.utf-8" + experimental: false - python-version: "3.11" lang-var: "en_US.utf-8" experimental: false diff --git a/Makefile b/Makefile index b7ae54d..12917b9 100644 --- a/Makefile +++ b/Makefile @@ -69,7 +69,7 @@ install: must_be_root $(QUITE)$(WAIT) $(QUIET)$(ECHO) "$@: Done." -user-install: must_be_root +user-install: $(QUIET)python3 -m pip install --user "git+https://github.com/reactive-firewall/pythonrepo.git#egg=pythonrepo" $(QUITE)$(WAIT) $(QUIET)$(ECHO) "$@: Done." From e71709fb95c35e8d25dcb24d3d001072bc9f2036 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Mon, 8 Jul 2024 21:43:21 -0700 Subject: [PATCH 21/68] Regression fix for repo url. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 12917b9..3419aa7 100644 --- a/Makefile +++ b/Makefile @@ -65,12 +65,12 @@ init: $(QUIET)$(ECHO) "$@: Done." install: must_be_root - $(QUIET)python3 -m pip install "git+https://github.com/reactive-firewall/pythonrepo.git#egg=pythonrepo" + $(QUIET)python3 -m pip install "git+https://github.com/reactive-firewall/python-repo.git#egg=pythonrepo" $(QUITE)$(WAIT) $(QUIET)$(ECHO) "$@: Done." user-install: - $(QUIET)python3 -m pip install --user "git+https://github.com/reactive-firewall/pythonrepo.git#egg=pythonrepo" + $(QUIET)python3 -m pip install --user "git+https://github.com/reactive-firewall/python-repo.git#egg=pythonrepo" $(QUITE)$(WAIT) $(QUIET)$(ECHO) "$@: Done." From 7a0e54c5f62fd869ee9cff75995116d09b53cd36 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Mon, 8 Jul 2024 22:04:08 -0700 Subject: [PATCH 22/68] Debugging GH actions. --- .github/workflows/Tests.yml | 103 ++++++++++++++++++++++++++++++++---- 1 file changed, 93 insertions(+), 10 deletions(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 00dc627..59edf58 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -17,7 +17,7 @@ jobs: env: LANG: "en_US.UTF-8" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: "3.12" @@ -76,7 +76,7 @@ jobs: PYTHON_VERSION: ${{ matrix.python-version }} LANG: ${{ matrix.lang-var }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v4 with: @@ -134,7 +134,7 @@ jobs: PYTHON_VERSION: ${{ matrix.python-version }} LANG: "en_US.utf-8" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: @@ -161,7 +161,7 @@ jobs: if: ${{ always() }} - COVERAGE: + COVERAGE-MATS: if: ${{ success() }} needs: [BUILD, MATS] runs-on: ${{ matrix.os }} @@ -169,7 +169,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"] + python-version: ["3.11", "3.12"] env: OS: ${{ matrix.os }} PYTHON_VERSION: ${{ matrix.python-version }} @@ -181,7 +181,7 @@ jobs: CODECLIMATE_REPO_TOKEN: ${{ secrets.CODECLIMATE_TOKEN }} CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: @@ -245,6 +245,89 @@ jobs: run: make -j1 -f Makefile clean || true ; if: ${{ always() }} +COVERAGE: + if: ${{ success() }} + needs: [BUILD, MATS, COVERAGE-MATS] + runs-on: ${{ matrix.os }} + timeout-minutes: 10 + strategy: + matrix: + os: [ubuntu-latest, macos-13, windows-latest] + python-version: [3.7, 3.8, 3.9, "3.10", "3.11"] + env: + OS: ${{ matrix.os }} + PYTHON_VERSION: ${{ matrix.python-version }} + LANG: "en_US.utf-8" + COVERAGE_RCFILE: ./.coveragerc + COV_CORE_SOURCE: ./ + COV_CORE_CONFIG: ./.coveragerc + COV_CORE_DATAFILE: ./coverage.xml + CODECLIMATE_REPO_TOKEN: ${{ secrets.CODECLIMATE_TOKEN }} + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + steps: + - uses: actions/checkout@v3 + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies for python ${{ matrix.python-version }} on ${{ matrix.os }} + run: | + pip install --upgrade --upgrade-strategy eager pip setuptools wheel ; + pip install --upgrade --upgrade-strategy eager -r ./requirements.txt ; + pip install --upgrade --upgrade-strategy eager pytest ; + pip install --upgrade --upgrade-strategy eager pytest-cov ; + pip install --upgrade --upgrade-strategy eager coverage ; + - name: Install code-climate tools for ${{ matrix.python-version }} + if: ${{ runner.os }} == "Linux" + shell: bash + run: | + if [ $OS == ubuntu-latest ] ; then curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter || true ; fi ; + if [ $OS == ubuntu-latest ] ; then chmod +x ./cc-test-reporter 2>/dev/null || true ; fi + if [ $OS == ubuntu-latest ] ; then ./cc-test-reporter before-build || true ; fi + - name: Install deepsource tools for ${{ matrix.python-version }} + if: ${{ runner.os }} == "Linux" + shell: bash + run: | + if [ $OS == ubuntu-latest ] ; then (curl https://deepsource.io/cli | sh) || true ; else echo "SKIP deepsource" ; fi ; + - name: Pre-Clean + id: clean + run: make -j1 -f Makefile clean || true ; + - name: Generate Coverage for py3.9 on ${{ matrix.os }} + if: ${{ runner.python-version }} == "3.9" + run: make -f Makefile test ; + - name: Generate Coverage for py${{ matrix.python-version }} on ${{ matrix.os }} + if: ${{ runner.python-version }} != "3.9" + run: make -f Makefile test-pytest ; + - name: Upload Python ${{ matrix.python-version }} coverage to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage.xml + directory: . + flags: ${{ matrix.os }},${{ matrix.python-version }} + name: pythonrepo-github-${{ matrix.os }}-${{ matrix.python-version }} + verbose: true + fail_ci_if_error: false + - name: Upload Python ${{ matrix.python-version }} Artifact + uses: actions/upload-artifact@v3 + with: + name: Test-Report-${{ matrix.os }}-${{ matrix.python-version }} + path: ./test-reports/ + if-no-files-found: ignore + - name: code-climate for ${{ matrix.python-version }} + if: ${{ runner.os }} == "Linux" + shell: bash + run: | + if [ $OS == ubuntu-latest ] ; then ./cc-test-reporter after-build --exit-code 0 || true ; else echo "SKIP code climate" ; fi ; + - name: deepsource for ${{ matrix.python-version }} + if: ${{ runner.os }} == "Linux" + shell: bash + run: | + if [ $OS == ubuntu-latest ] ; then ./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml 2>/dev/null || true ; else echo "SKIP deepsource" ; fi ; + - name: Post-Clean + id: post + run: make -j1 -f Makefile clean || true ; + if: ${{ always() }} STYLE: if: ${{ success() }} @@ -257,7 +340,7 @@ jobs: LANG: "en_US.utf-8" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v4 with: @@ -290,7 +373,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest] - python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"] + python-version: ["3.11", "3.12"] env: OS: ${{ matrix.os }} PYTHON_VERSION: ${{ matrix.python-version }} @@ -303,7 +386,7 @@ jobs: CODECLIMATE_REPO_TOKEN: ${{ secrets.CODECLIMATE_TOKEN }} CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: @@ -377,7 +460,7 @@ jobs: LANG: 'en_US.utf-8' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v4 with: From e25b75127071a32c78924d86f677422942d70d86 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Mon, 8 Jul 2024 22:07:45 -0700 Subject: [PATCH 23/68] Regression fix (whitespace) --- .github/workflows/Tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 59edf58..0c399ec 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -245,7 +245,7 @@ jobs: run: make -j1 -f Makefile clean || true ; if: ${{ always() }} -COVERAGE: + COVERAGE: if: ${{ success() }} needs: [BUILD, MATS, COVERAGE-MATS] runs-on: ${{ matrix.os }} From ab5b5748c0b550f1f776998704356a0a2085cbff Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Mon, 8 Jul 2024 22:17:11 -0700 Subject: [PATCH 24/68] Regression fix for Circle-CI missing python3.11+ --- .circleci/config.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 95097b5..de598c1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,8 +6,6 @@ jobs: - image: circleci/python:3.8 - image: circleci/python:3.9 - image: circleci/python:3.10 - - image: circleci/python:3.11 - - image: circleci/python:3.12 environment: CI: cicleci DEBIAN_FRONTEND: noninteractive @@ -48,8 +46,6 @@ jobs: - image: circleci/python:3.8 - image: circleci/python:3.9 - image: circleci/python:3.10 - - image: circleci/python:3.11 - - image: circleci/python:3.12 parallelism: 2 environment: CI: cicleci @@ -98,8 +94,6 @@ jobs: - image: circleci/python:3.8 - image: circleci/python:3.9 - image: circleci/python:3.10 - - image: circleci/python:3.11 - - image: circleci/python:3.12 parallelism: 2 environment: CI: cicleci From 39a5fa22fa5d4cccaed323d86b5ff263ba2dbd0a Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Tue, 9 Jul 2024 17:50:09 -0700 Subject: [PATCH 25/68] Migration to new CircleCI docker images see https://circleci.com/developer/images/image/cimg/python for more. --- .circleci/config.yml | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index de598c1..d8cdcc1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,10 +2,12 @@ version: 2 jobs: build: docker: - - image: circleci/python:3.7 - - image: circleci/python:3.8 - - image: circleci/python:3.9 - - image: circleci/python:3.10 + - image: cimg/python:3.7 + - image: cimg/python:3.8 + - image: cimg/python:3.9 + - image: cimg/python:3.10 + - image: cimg/python:3.11 + - image: cimg/python:3.12 environment: CI: cicleci DEBIAN_FRONTEND: noninteractive @@ -42,10 +44,12 @@ jobs: test: docker: - - image: circleci/python:3.7 - - image: circleci/python:3.8 - - image: circleci/python:3.9 - - image: circleci/python:3.10 + - image: cimg/python:3.7 + - image: cimg/python:3.8 + - image: cimg/python:3.9 + - image: cimg/python:3.10 + - image: cimg/python:3.11 + - image: cimg/python:3.12 parallelism: 2 environment: CI: cicleci @@ -90,10 +94,12 @@ jobs: pytest: docker: - - image: circleci/python:3.7 - - image: circleci/python:3.8 - - image: circleci/python:3.9 - - image: circleci/python:3.10 + - image: cimg/python:3.7 + - image: cimg/python:3.8 + - image: cimg/python:3.9 + - image: cimg/python:3.10 + - image: cimg/python:3.11 + - image: cimg/python:3.12 parallelism: 2 environment: CI: cicleci @@ -150,7 +156,7 @@ jobs: lint: docker: - - image: circleci/python:3.8 + - image: cimg/python:3.11 environment: CI: cicleci DEBIAN_FRONTEND: noninteractive From 90f7b4733de93252dbbc46d8cf4f0a632c1d9993 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Tue, 9 Jul 2024 19:02:13 -0700 Subject: [PATCH 26/68] Fixed a few anti-patterns. --- .deepsource.toml | 5 +++-- pythonrepo/pythonrepo.py | 9 ++++----- tests/profiling.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.deepsource.toml b/.deepsource.toml index 182d2bd..5971e2d 100644 --- a/.deepsource.toml +++ b/.deepsource.toml @@ -22,7 +22,8 @@ exclude_patterns = [ ".coveralls.yml", "codecov_env", "*,cover", - ".hypothesis/" + ".hypothesis/", + "docs/" ] [[analyzers]] @@ -39,4 +40,4 @@ dependency_file_paths = [ [[analyzers]] name = "test-coverage" -enabled = true \ No newline at end of file +enabled = true diff --git a/pythonrepo/pythonrepo.py b/pythonrepo/pythonrepo.py index d9904ef..313efde 100644 --- a/pythonrepo/pythonrepo.py +++ b/pythonrepo/pythonrepo.py @@ -99,9 +99,8 @@ def parseArgs(arguments=None): def useTool(tool, *arguments): """Handler for launching the functions.""" - if (tool is not None) and (tool in TASK_OPTIONS.keys()): + if (tool is not None) and (tool in TASK_OPTIONS): try: - # print(str("launching: " + tool)) TASK_OPTIONS[tool](arguments) except Exception: w = str("WARNING - An error occured while") @@ -123,13 +122,13 @@ def main(*argv): w += str("handling the arguments.") w += str(" Cascading failure.") print(w) - exit(2) + sys.exit(2) except Exception: e = str("CRITICAL - An error occured while handling") e += str("the cascading failure.") print(e) - exit(3) - exit(0) + sys.exit(3) + sys.exit(0) if __name__ in '__main__': diff --git a/tests/profiling.py b/tests/profiling.py index c6b547f..6536ded 100644 --- a/tests/profiling.py +++ b/tests/profiling.py @@ -268,5 +268,5 @@ def main(*argv): # pragma: no cover try: exitcode = main(sys.argv[1:]) finally: - exit(exitcode) + sys.exit(exitcode) From 229a693b4ffbb05510ee37cd983902b228cf250e Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Tue, 9 Jul 2024 19:33:34 -0700 Subject: [PATCH 27/68] Create scorecards.yml Upgrade to new version of scorecards-analysis.yml actions --- .github/workflows/scorecards.yml | 73 ++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/scorecards.yml diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml new file mode 100644 index 0000000..1d517f9 --- /dev/null +++ b/.github/workflows/scorecards.yml @@ -0,0 +1,73 @@ +# This workflow uses actions that are not certified by GitHub. They are provided +# by a third-party and are governed by separate terms of service, privacy +# policy, and support documentation. + +name: Scorecard supply-chain security +on: + # For Branch-Protection check. Only the default branch is supported. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection + branch_protection_rule: + # To guarantee Maintained check is occasionally updated. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained + schedule: + - cron: '18 9 * * 5' + push: + branches: [ "master" ] + +# Declare default permissions as read only. +permissions: read-all + +jobs: + analysis: + name: Scorecard analysis + runs-on: ubuntu-latest + permissions: + # Needed to upload the results to code-scanning dashboard. + security-events: write + # Needed to publish results and get a badge (see publish_results below). + id-token: write + # Uncomment the permissions below if installing in a private repository. + # contents: read + # actions: read + + steps: + - name: "Checkout code" + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + persist-credentials: false + + - name: "Run analysis" + uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1 + with: + results_file: results.sarif + results_format: sarif + # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: + # - you want to enable the Branch-Protection check on a *public* repository, or + # - you are installing Scorecard on a *private* repository + # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional. + repo_token: ${{ secrets.SCORECARD_TOKEN }} + + # Public repositories: + # - Publish results to OpenSSF REST API for easy access by consumers + # - Allows the repository to include the Scorecard badge. + # - See https://github.com/ossf/scorecard-action#publishing-results. + # For private repositories: + # - `publish_results` will always be set to `false`, regardless + # of the value entered here. + publish_results: false + + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF + # format to the repository Actions tab. + - name: "Upload artifact" + uses: actions/upload-artifact@97a0fba1372883ab732affbe8f94b823f91727db # v3.pre.node20 + with: + name: SARIF file + path: results.sarif + retention-days: 5 + + # Upload the results to GitHub's code scanning dashboard (optional). + # Commenting out will disable upload of results to your repo's Code Scanning dashboard + - name: "Upload to code-scanning" + uses: github/codeql-action/upload-sarif@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9 + with: + sarif_file: results.sarif From 0a165a7160ab428ddae08cc4f8b07e76d79b4617 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Tue, 9 Jul 2024 19:35:58 -0700 Subject: [PATCH 28/68] Update scorecards-analysis.yml Move to old filename --- .github/workflows/scorecards-analysis.yml | 54 ++++++++++++++++------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index ca875f7..1d517f9 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -1,53 +1,73 @@ -name: Scorecards supply-chain security +# This workflow uses actions that are not certified by GitHub. They are provided +# by a third-party and are governed by separate terms of service, privacy +# policy, and support documentation. + +name: Scorecard supply-chain security on: - # Only the default branch is supported. + # For Branch-Protection check. Only the default branch is supported. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection branch_protection_rule: + # To guarantee Maintained check is occasionally updated. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained schedule: - cron: '18 9 * * 5' push: - branches: [ master ] + branches: [ "master" ] # Declare default permissions as read only. permissions: read-all jobs: analysis: - name: Scorecards analysis + name: Scorecard analysis runs-on: ubuntu-latest permissions: # Needed to upload the results to code-scanning dashboard. security-events: write + # Needed to publish results and get a badge (see publish_results below). + id-token: write + # Uncomment the permissions below if installing in a private repository. + # contents: read + # actions: read steps: - name: "Checkout code" - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@175f59783fa96e44dd6fa96619ab7bdacab56b5c # v0.0.1 + uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1 with: results_file: results.sarif results_format: sarif - # Read-only PAT token. To create it, - # follow the steps in https://github.com/ossf/scorecard-action#pat-token-creation. + # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: + # - you want to enable the Branch-Protection check on a *public* repository, or + # - you are installing Scorecard on a *private* repository + # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional. repo_token: ${{ secrets.SCORECARD_TOKEN }} - # Publish the results to enable scorecard badges. For more details, see - # https://github.com/ossf/scorecard-action#publishing-results. - # If you are installing the action on a private repo, set it to `publish_results: false` - # or comment out the following line. - publish_results: true - # Upload the results as artifacts (optional). + # Public repositories: + # - Publish results to OpenSSF REST API for easy access by consumers + # - Allows the repository to include the Scorecard badge. + # - See https://github.com/ossf/scorecard-action#publishing-results. + # For private repositories: + # - `publish_results` will always be set to `false`, regardless + # of the value entered here. + publish_results: false + + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF + # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 # v2.3.1 + uses: actions/upload-artifact@97a0fba1372883ab732affbe8f94b823f91727db # v3.pre.node20 with: name: SARIF file path: results.sarif retention-days: 5 - # Upload the results to GitHub's code scanning dashboard. + # Upload the results to GitHub's code scanning dashboard (optional). + # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@5f532563584d71fdef14ee64d17bafb34f751ce5 # v1.0.26 + uses: github/codeql-action/upload-sarif@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9 with: sarif_file: results.sarif From 542a65848ac3b55454a847aa8090d51181a19a2f Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Tue, 9 Jul 2024 19:36:25 -0700 Subject: [PATCH 29/68] Delete .github/workflows/scorecards.yml Remove new filename --- .github/workflows/scorecards.yml | 73 -------------------------------- 1 file changed, 73 deletions(-) delete mode 100644 .github/workflows/scorecards.yml diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml deleted file mode 100644 index 1d517f9..0000000 --- a/.github/workflows/scorecards.yml +++ /dev/null @@ -1,73 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. They are provided -# by a third-party and are governed by separate terms of service, privacy -# policy, and support documentation. - -name: Scorecard supply-chain security -on: - # For Branch-Protection check. Only the default branch is supported. See - # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection - branch_protection_rule: - # To guarantee Maintained check is occasionally updated. See - # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained - schedule: - - cron: '18 9 * * 5' - push: - branches: [ "master" ] - -# Declare default permissions as read only. -permissions: read-all - -jobs: - analysis: - name: Scorecard analysis - runs-on: ubuntu-latest - permissions: - # Needed to upload the results to code-scanning dashboard. - security-events: write - # Needed to publish results and get a badge (see publish_results below). - id-token: write - # Uncomment the permissions below if installing in a private repository. - # contents: read - # actions: read - - steps: - - name: "Checkout code" - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - persist-credentials: false - - - name: "Run analysis" - uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1 - with: - results_file: results.sarif - results_format: sarif - # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: - # - you want to enable the Branch-Protection check on a *public* repository, or - # - you are installing Scorecard on a *private* repository - # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional. - repo_token: ${{ secrets.SCORECARD_TOKEN }} - - # Public repositories: - # - Publish results to OpenSSF REST API for easy access by consumers - # - Allows the repository to include the Scorecard badge. - # - See https://github.com/ossf/scorecard-action#publishing-results. - # For private repositories: - # - `publish_results` will always be set to `false`, regardless - # of the value entered here. - publish_results: false - - # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF - # format to the repository Actions tab. - - name: "Upload artifact" - uses: actions/upload-artifact@97a0fba1372883ab732affbe8f94b823f91727db # v3.pre.node20 - with: - name: SARIF file - path: results.sarif - retention-days: 5 - - # Upload the results to GitHub's code scanning dashboard (optional). - # Commenting out will disable upload of results to your repo's Code Scanning dashboard - - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9 - with: - sarif_file: results.sarif From b9cdf0c890d9df92ccf8338014867d56ebc79fb8 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Tue, 9 Jul 2024 19:55:15 -0700 Subject: [PATCH 30/68] Update Labeler.yml to new version Updated out-of-date labeler action too. --- .github/workflows/Labeler.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Labeler.yml b/.github/workflows/Labeler.yml index 2f59e0c..0265d08 100644 --- a/.github/workflows/Labeler.yml +++ b/.github/workflows/Labeler.yml @@ -14,6 +14,6 @@ jobs: security-events: none runs-on: ubuntu-latest steps: - - uses: actions/labeler@v4 + - uses: actions/labeler@v5 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" From c3c2570d3cfebde8de2c14846e1b5b75453e76a9 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Tue, 9 Jul 2024 19:33:34 -0700 Subject: [PATCH 31/68] Create scorecards.yml Upgrade to new version of scorecards-analysis.yml actions --- .deepsource.toml | 2 +- .github/workflows/{scorecards-analysis.yml => scorecards.yml} | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) rename .github/workflows/{scorecards-analysis.yml => scorecards.yml} (98%) diff --git a/.deepsource.toml b/.deepsource.toml index 5971e2d..e3762a4 100644 --- a/.deepsource.toml +++ b/.deepsource.toml @@ -23,7 +23,7 @@ exclude_patterns = [ "codecov_env", "*,cover", ".hypothesis/", - "docs/" + "docs/conf.py" ] [[analyzers]] diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards.yml similarity index 98% rename from .github/workflows/scorecards-analysis.yml rename to .github/workflows/scorecards.yml index 1d517f9..c46844f 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards.yml @@ -12,7 +12,7 @@ on: schedule: - cron: '18 9 * * 5' push: - branches: [ "master" ] + branches: [ "master", "score-card-revert-patch" ] # Declare default permissions as read only. permissions: read-all @@ -46,7 +46,6 @@ jobs: # - you are installing Scorecard on a *private* repository # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional. repo_token: ${{ secrets.SCORECARD_TOKEN }} - # Public repositories: # - Publish results to OpenSSF REST API for easy access by consumers # - Allows the repository to include the Scorecard badge. From 632a61ffe70ee8bc3898d1a82505fe876b65db51 Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Wed, 10 Jul 2024 15:35:47 -0700 Subject: [PATCH 32/68] Bumped Action versions and perms --- .github/workflows/codeql-analysis.yml | 8 ++++---- .github/workflows/scorecards.yml | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index f3c47ce..bf15923 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -38,11 +38,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -53,7 +53,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v3 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -67,4 +67,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index c46844f..c2be7f4 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -12,7 +12,7 @@ on: schedule: - cron: '18 9 * * 5' push: - branches: [ "master", "score-card-revert-patch" ] + branches: [ master, score-card-revert-patch ] # Declare default permissions as read only. permissions: read-all @@ -27,8 +27,8 @@ jobs: # Needed to publish results and get a badge (see publish_results below). id-token: write # Uncomment the permissions below if installing in a private repository. - # contents: read - # actions: read + contents: read + actions: read steps: - name: "Checkout code" From dd6b74c1b17bdad5bcb1384b44cb5495a6bff32c Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Wed, 10 Jul 2024 16:08:21 -0700 Subject: [PATCH 33/68] Updated lables config for latest version. --- .github/labeler.yml | 69 +++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 31 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index 687aa86..d5200ca 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,46 +1,53 @@ -# Add 'Multicast' label to any root file changes -Multicast: - - setup.py - - multicast/*.py +# Add 'Python Repo' label to any root file changes +Python Repo: + - changed-files: + - any-glob-to-any-file: 'setup.py' + - any-glob-to-any-file: 'pythonrepo/*.py' # Add 'Lint' label to any lint file changes Linter: - - .stickler.yml - - .hound.yml - - .yamllint.conf - - .flake8.ini - - .deepsource.toml - - tests/check_* + - changed-files: + - any-glob-to-any-file: '.stickler.yml' + - any-glob-to-any-file: '.hound.yml' + - any-glob-to-any-file: '.yamllint.conf' + - any-glob-to-any-file: '.flake8.ini' + - any-glob-to-any-file: '.deepsource.toml' + - any-glob-to-any-file: 'tests/check_*' # Add 'Lang' label to any python file changes Python Lang: - - **/*.py - - *.py + - changed-files: + - any-glob-to-any-file: '**/*.py' + - any-glob-to-any-file: '*.py' Configs: - - *.yml - - ./**/*.yml - - *.ini - - *.toml - - *.cfg - - requirements.txt + - changed-files: + - any-glob-to-any-file: '*.yml' + - any-glob-to-any-file: './**/*.yml' + - any-glob-to-any-file: '*.ini' + - any-glob-to-any-file: '*.toml' + - any-glob-to-any-file: '*.cfg' + - any-glob-to-any-file: 'requirements.txt' # Add 'test' label Testing: - - tests/**/*.py - - tests/* - - .circleci/* + - changed-files: + - any-glob-to-any-file: 'tests/**/*.py' + - any-glob-to-any-file: 'tests/*' + - any-glob-to-any-file: '.circleci/*' CI: - - tests/*.py - - .stickler.yml - - .hound.yml - - .travis.yml - - .appveyor.yml - - .github/workflows/* - - .circleci/* + - changed-files: + - any-glob-to-any-file: 'tests/*.py' + - any-glob-to-any-file: '.stickler.yml' + - any-glob-to-any-file: '.hound.yml' + - any-glob-to-any-file: '.travis.yml' + - any-glob-to-any-file: '.appveyor.yml' + - any-glob-to-any-file: '.github/workflows/*' + - any-glob-to-any-file: '.circleci/*' Github: - - .github/**/* - - .github/* - - README.md + - changed-files: + - any-glob-to-any-file: '.github/**/*' + - any-glob-to-any-file: '.github/*' + - any-glob-to-any-file: 'README.md' From 60b285033994866624fb3490deac00491aeb0bed Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Wed, 10 Jul 2024 16:31:07 -0700 Subject: [PATCH 34/68] Revert to only check default branch to fix regression ( - Fixed #38 - ) --- .github/workflows/scorecards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index c2be7f4..cdcf1d4 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -12,7 +12,7 @@ on: schedule: - cron: '18 9 * * 5' push: - branches: [ master, score-card-revert-patch ] + branches: [ master ] # Declare default permissions as read only. permissions: read-all From 29d4740e2f898fc4fca6c67979743d75551a022b Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Wed, 10 Jul 2024 18:32:35 -0700 Subject: [PATCH 35/68] Cleanup Labeler config. --- .github/labeler.yml | 65 +++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index d5200ca..6d5a653 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,53 +1,60 @@ # Add 'Python Repo' label to any root file changes Python Repo: - changed-files: - - any-glob-to-any-file: 'setup.py' - - any-glob-to-any-file: 'pythonrepo/*.py' + - any-glob-to-any-file: + - setup.py + - pythonrepo/*.py # Add 'Lint' label to any lint file changes Linter: - changed-files: - - any-glob-to-any-file: '.stickler.yml' - - any-glob-to-any-file: '.hound.yml' - - any-glob-to-any-file: '.yamllint.conf' - - any-glob-to-any-file: '.flake8.ini' - - any-glob-to-any-file: '.deepsource.toml' - - any-glob-to-any-file: 'tests/check_*' + - any-glob-to-any-file: + - .stickler.yml + - .hound.yml + - .yamllint.conf + - .flake8.ini + - .deepsource.toml + - tests/check_* # Add 'Lang' label to any python file changes Python Lang: - changed-files: - - any-glob-to-any-file: '**/*.py' - - any-glob-to-any-file: '*.py' + - any-glob-to-any-file: + - '**/*.py' + - '*.py' Configs: - changed-files: - - any-glob-to-any-file: '*.yml' - - any-glob-to-any-file: './**/*.yml' - - any-glob-to-any-file: '*.ini' - - any-glob-to-any-file: '*.toml' - - any-glob-to-any-file: '*.cfg' - - any-glob-to-any-file: 'requirements.txt' + - any-glob-to-any-file: + - '*.yml' + - ./**/*.yml + - '*.ini' + - '*.toml' + - '*.cfg' + - requirements.txt # Add 'test' label Testing: - changed-files: - - any-glob-to-any-file: 'tests/**/*.py' - - any-glob-to-any-file: 'tests/*' - - any-glob-to-any-file: '.circleci/*' + - any-glob-to-any-file: + - tests/**/*.py + - tests/* + - .circleci/* CI: - changed-files: - - any-glob-to-any-file: 'tests/*.py' - - any-glob-to-any-file: '.stickler.yml' - - any-glob-to-any-file: '.hound.yml' - - any-glob-to-any-file: '.travis.yml' - - any-glob-to-any-file: '.appveyor.yml' - - any-glob-to-any-file: '.github/workflows/*' - - any-glob-to-any-file: '.circleci/*' + - any-glob-to-any-file: + - tests/*.py + - .stickler.yml + - .hound.yml + - .travis.yml + - .appveyor.yml + - .github/workflows/* + - .circleci/* Github: - changed-files: - - any-glob-to-any-file: '.github/**/*' - - any-glob-to-any-file: '.github/*' - - any-glob-to-any-file: 'README.md' + - any-glob-to-any-file: + - .github/**/* + - .github/* + - README.md From c2194fe0bc2c889136cfb36b7a7991ad44337e5f Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Wed, 10 Jul 2024 23:55:09 -0700 Subject: [PATCH 36/68] Fix CWE-73 found in PR #37 --- setup.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index 089eae8..afbb91c 100755 --- a/setup.py +++ b/setup.py @@ -28,13 +28,14 @@ def readFile(filename): """Helper Function to read files""" theResult = None - try: - 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) + if filename in ("""README.md""", """LICENSE.md"""): + try: + 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 theResult From cdba8ce61c8bf127ef7ae78efb90b6436d433201 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Thu, 11 Jul 2024 00:13:22 -0700 Subject: [PATCH 37/68] Harden default permissions of GH actions ( - Fixes #39 - ) --- .github/workflows/Labeler.yml | 3 +++ .github/workflows/Tests.yml | 3 +++ .github/workflows/codeql-analysis.yml | 3 +++ 3 files changed, 9 insertions(+) diff --git a/.github/workflows/Labeler.yml b/.github/workflows/Labeler.yml index 0265d08..7377e4c 100644 --- a/.github/workflows/Labeler.yml +++ b/.github/workflows/Labeler.yml @@ -4,6 +4,9 @@ on: types: [opened, reopened] branches: [ master, stable ] +# Declare default permissions as none. +permissions: none + jobs: triage: permissions: diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 0c399ec..b7be6a8 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -7,6 +7,9 @@ on: tags: - v* +# Declare default permissions as read only. +permissions: read-all + jobs: BUILD: if: github.repository == 'reactive-firewall/python-repo' diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index bf15923..b3a68fc 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -20,6 +20,9 @@ on: schedule: - cron: '17 5 * * 1' +# Declare default permissions as read only. +permissions: read-all + jobs: analyze: name: Analyze From 86d43746825246b328e72ac2e0207c68075ed64e Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Fri, 12 Jul 2024 18:58:01 -0700 Subject: [PATCH 38/68] Harden default permissions of GH actions ( - Fixes #39 and #40 - ) * Harden default permissions of GH actions ( - Fixes #39 - ) * Bump version of GH checkout action ( - WIP #40 / WIP #44 - ) * Bump version of GH setup-pytho action ( - Fixes #44 - ) * Simplify eager triggers of GH actions ( - Resolves #42 - ) --- .github/workflows/Labeler.yml | 2 +- .github/workflows/Tests.yml | 25 ++++++++++++++++--------- .github/workflows/codeql-analysis.yml | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/Labeler.yml b/.github/workflows/Labeler.yml index 7377e4c..118b87b 100644 --- a/.github/workflows/Labeler.yml +++ b/.github/workflows/Labeler.yml @@ -5,7 +5,7 @@ on: branches: [ master, stable ] # Declare default permissions as none. -permissions: none +permissions: {} jobs: triage: diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index b7be6a8..de61e29 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -6,6 +6,13 @@ on: - stable tags: - v* + pull_request: + types: + - opened + - edited + - reopened + - synchronize + - ready_for_review # Declare default permissions as read only. permissions: read-all @@ -21,7 +28,7 @@ jobs: LANG: "en_US.UTF-8" steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.12" - name: Pre-Clean @@ -81,7 +88,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Setup dependencies @@ -139,7 +146,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies for ${{ matrix.python-version }} @@ -186,7 +193,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies for python ${{ matrix.python-version }} on ${{ matrix.os }} @@ -268,9 +275,9 @@ jobs: CODECLIMATE_REPO_TOKEN: ${{ secrets.CODECLIMATE_TOKEN }} CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies for python ${{ matrix.python-version }} on ${{ matrix.os }} @@ -345,7 +352,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.10" - name: Install dependencies for python Linters @@ -391,7 +398,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies for python ${{ matrix.python-version }} on ${{ matrix.os }} @@ -465,7 +472,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.10" - name: Install dependencies for Tox diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b3a68fc..5439c0f 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -41,7 +41,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v4.1.7 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL From f23e54ad8f612bc6bc9e9b28072339a3c53cae91 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Fri, 12 Jul 2024 20:38:46 -0700 Subject: [PATCH 39/68] Marked early del to ignore false-positives of PYL-C0414 ( - Fixes #48 - ) --- tests/__init__.py | 4 ++-- tests/context.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index 702eb23..7eb262c 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -36,10 +36,10 @@ ImportErr = None del ImportErr raise ImportError(str("Test module failed completely.")) - from tests import context as context + from tests import context as context # skipcq: PYL-C0414 if context.__name__ is None: raise ImportError(str("Test module failed to import even the context framework.")) - from tests import profiling as profiling + from tests import profiling as profiling # skipcq: PYL-C0414 if profiling.__name__ is None: raise ImportError(str("Test module failed to import even the profiling framework.")) from tests import test_basic diff --git a/tests/context.py b/tests/context.py index 0295996..3552f41 100644 --- a/tests/context.py +++ b/tests/context.py @@ -35,7 +35,7 @@ try: - import pythonrepo as pythonrepo + import pythonrepo as pythonrepo # skipcq: PYL-C0414 if pythonrepo.__name__ is None: raise ImportError("Failed to import pythonrepo.") except Exception as badErr: From 259ffb61cea3e73646b2d74d85b1db5fd7825966 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Fri, 12 Jul 2024 20:23:05 -0700 Subject: [PATCH 40/68] Marked early del to ignore false-positives of PYL-W0043 ( - Fixes #47 - ) --- tests/test_usage.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_usage.py b/tests/test_usage.py index 9dfe1eb..bcb2980 100644 --- a/tests/test_usage.py +++ b/tests/test_usage.py @@ -215,7 +215,7 @@ def test_template_case(self): print(str((err.args))) print(str("")) err = None - del err + del err # skipcq: PTC-W0043 theResult = False self.assertTrue(theResult) @@ -253,7 +253,7 @@ def test_profile_template_case(self): print(str((err.args))) print(str("")) err = None - del err + del err # skipcq: PTC-W0043 theResult = False self.assertTrue(theResult) @@ -292,7 +292,7 @@ def test_fail_template_case(self): print(str((err.args))) print(str("")) err = None - del err + del err # skipcq: PTC-W0043 theResult = False self.assertTrue(theResult) @@ -331,7 +331,7 @@ def test_bad_template_case(self): print(str((err.args))) print(str("")) err = None - del err + del err # skipcq: PTC-W0043 theResult = False self.assertTrue(theResult) From 5f11d123c4e6199225ee43bae3b2a5410c3dc1c9 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Fri, 12 Jul 2024 21:05:44 -0700 Subject: [PATCH 41/68] refactor to avoid PYL-W0621 ( - Fixes #49 - ) --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index afbb91c..862e023 100755 --- a/setup.py +++ b/setup.py @@ -30,8 +30,8 @@ def readFile(filename): theResult = None if filename in ("""README.md""", """LICENSE.md"""): try: - with open(str("""./{}""").format(str(filename))) as f: - theResult = f.read() + with open(str("""./{}""").format(str(filename))) as file: + theResult = file.read() except Exception: theResult = str( """See https://github.com/reactive-firewall/python-repo/{}""" From 3566cdaf8078c2b3cbf6fab80b3514f15c9ca6bb Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Fri, 12 Jul 2024 21:11:10 -0700 Subject: [PATCH 42/68] comment to skip false PYL-W0622 ( - Fixes #50 - ) --- tests/profiling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/profiling.py b/tests/profiling.py index 6536ded..7b850c2 100644 --- a/tests/profiling.py +++ b/tests/profiling.py @@ -132,7 +132,7 @@ def checkpoint(self, name=''): def __enter__(self): return self - def __exit__(self, type, value, traceback): + def __exit__(self, type, value, traceback): # skipcq: PLY-W0622 self.checkpoint(str("finished")) pass From 538713679e4541c85984acae3149a3f1b3dec8aa Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Sat, 13 Jul 2024 12:00:01 -0700 Subject: [PATCH 43/68] Fixup typo (- Fixes #50 -) --- tests/profiling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/profiling.py b/tests/profiling.py index 7b850c2..6b2a352 100644 --- a/tests/profiling.py +++ b/tests/profiling.py @@ -132,7 +132,7 @@ def checkpoint(self, name=''): def __enter__(self): return self - def __exit__(self, type, value, traceback): # skipcq: PLY-W0622 + def __exit__(self, type, value, traceback): # skipcq: PYL-W0622 self.checkpoint(str("finished")) pass From b0fc5e0d98b72ce8089f132df65ef15dbc82a94d Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Sun, 14 Jul 2024 19:06:25 -0700 Subject: [PATCH 44/68] Added styleistic newline for FLK-D204 linter --- tests/profiling.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/profiling.py b/tests/profiling.py index 7b850c2..c92b78a 100644 --- a/tests/profiling.py +++ b/tests/profiling.py @@ -112,6 +112,7 @@ class timewith(): """Basic timer for do_time_profile.""" + def __init__(self, name=''): self.name = name self.start = time.time() From aa386dbd3f5f53819d068d3b72db47b06d437ce9 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Sun, 14 Jul 2024 19:10:02 -0700 Subject: [PATCH 45/68] Refactored docstring for style to scilence linter FLK-D209. --- tests/test_usage.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_usage.py b/tests/test_usage.py index bcb2980..8750ef1 100644 --- a/tests/test_usage.py +++ b/tests/test_usage.py @@ -97,8 +97,10 @@ def checkPythonCommand(args=None, stderr=None): @profiling.do_cprofile def timePythonCommand(args=None, stderr=None): - """Function for backend subprocess check_output command - with support for coverage and profiling.""" + """ + Function for backend subprocess check_output command + with support for coverage and profiling. + """ if args is None: args = [None] return checkPythonCommand(args, stderr) From f0a2ad45f45638eae1c9e555602b0edf382adb3c Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Sun, 14 Jul 2024 19:43:36 -0700 Subject: [PATCH 46/68] Fixup .codecov.yml --- .codecov.yml | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/.codecov.yml b/.codecov.yml index 2e91d53..8ace9c0 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,17 +1,44 @@ +codecov: + notify: + wait_for_ci: true + require_ci_to_pass: true +comment: + behavior: default + layout: reach, diff, flags, files, footer + require_base: false + require_changes: false + require_head: true + show_carryforward_flags: false coverage: + precision: 3 + round: nearest status: + changes: false + default_rules: + flag_coverage_not_uploaded_behavior: include + patch: true project: - default: on + default: target: 95% base: auto + branches: + - master + - stable + if_ci_failed: ignore + only_pulls: false + removed_code_behavior: adjust_base tests: target: 80% - flags: tests + if_ci_failed: failure + only_pulls: false + removed_code_behavior: fully_covered_patch + flags: + - tests paths: - tests - +github_checks: + annotations: true flags: tests: paths: - - tests - joined: false + - tests \ No newline at end of file From ee529c31ab3bcddf2535904c957dcdac0b4a3419 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Sun, 14 Jul 2024 21:30:08 -0700 Subject: [PATCH 47/68] Refactor pointless global doctoring to muzzle linter PYL-W0105 (- Fixes #54 -) --- pythonrepo/pythonrepo.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pythonrepo/pythonrepo.py b/pythonrepo/pythonrepo.py index 313efde..4424085 100644 --- a/pythonrepo/pythonrepo.py +++ b/pythonrepo/pythonrepo.py @@ -36,7 +36,6 @@ from . import __version__ -"""The version of this program.""" __prog__ = str(__module__) From 5884c168959de934977c1eec0f27bb36454bce50 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Sun, 14 Jul 2024 21:38:17 -0700 Subject: [PATCH 48/68] Resolves PYL-W0107 (- Fixes #55 -) --- tests/profiling.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/profiling.py b/tests/profiling.py index 7b850c2..7b2a616 100644 --- a/tests/profiling.py +++ b/tests/profiling.py @@ -134,7 +134,6 @@ def __enter__(self): def __exit__(self, type, value, traceback): # skipcq: PLY-W0622 self.checkpoint(str("finished")) - pass def do_time_profile(func, timer_name="time_profile"): From ef508d452447879c63364ae4025841a27009b83f Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Sun, 14 Jul 2024 21:44:41 -0700 Subject: [PATCH 49/68] Fix Anti-pattern PYL-R0123 (- Fixes #53 -) --- tests/test_usage.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_usage.py b/tests/test_usage.py index 8750ef1..a6106cc 100644 --- a/tests/test_usage.py +++ b/tests/test_usage.py @@ -3,7 +3,7 @@ # Python Repo Template # .................................. -# Copyright (c) 2017-2019, 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. @@ -57,7 +57,7 @@ def buildPythonCommand(args=None): # you need to change this to the name of your project __project__ = str("pythonrepo") try: - if args is None or args is [None]: + if args is None or (args == [None]): theArgs = ["exit 1 ; #"] else: theArgs = args From 082f6245ebb43af426e0278211843b85ee00cc96 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Sun, 14 Jul 2024 22:07:52 -0700 Subject: [PATCH 50/68] Resolve conflicting style-linting (- WIP #56 -) --- tests/test_usage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_usage.py b/tests/test_usage.py index 8750ef1..9a45ddb 100644 --- a/tests/test_usage.py +++ b/tests/test_usage.py @@ -166,7 +166,7 @@ class BasicUsageTestSuite(unittest.TestCase): def test_absolute_truth_and_meaning(self): """Insanity Test. if ( is true ) usage.""" - self.assertTrue(True) + self.assertTrue(True) # skipcq: PYL-W1503 def test_syntax(self): """Test case importing code. if ( import is not None ) usage.""" From c7c8a17a8eb5212bdcd3f3314637f9e39ae992e6 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Sun, 14 Jul 2024 22:17:09 -0700 Subject: [PATCH 51/68] Resolves PYL-W1503 (- Fixes #56 -) --- tests/test_basic.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_basic.py b/tests/test_basic.py index f76f54f..5a96de8 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -27,11 +27,12 @@ class BasicTestSuite(unittest.TestCase): def test_absolute_truth_and_meaning(self): """Insanitty Test. Because it only matters if we're not mad as hatters.""" assert True + self.assertTrue(True) # skipcq: PYL-W1503 def test_meta_test(self): """Insanity Test for unittests assertion.""" - self.assertTrue(True) - self.assertFalse(False) + self.assertTrue(True) # skipcq: PYL-W1503 + self.assertFalse(False) # skipcq: PYL-W1503 self.assertIsNone(None) def test_syntax(self): From 3ebab3c4708764ef892df3c241d55c8468524bc0 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Sun, 14 Jul 2024 21:30:08 -0700 Subject: [PATCH 52/68] Refactor pointless global doctoring to muzzle linter PYL-W0105 (- Fixes #54 -) --- pythonrepo/pythonrepo.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pythonrepo/pythonrepo.py b/pythonrepo/pythonrepo.py index 313efde..4424085 100644 --- a/pythonrepo/pythonrepo.py +++ b/pythonrepo/pythonrepo.py @@ -36,7 +36,6 @@ from . import __version__ -"""The version of this program.""" __prog__ = str(__module__) From fdcd9d93491f478362987635c5dd9ead21d2c260 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Sun, 14 Jul 2024 21:38:17 -0700 Subject: [PATCH 53/68] Resolves PYL-W0107 (- Fixes #55 -) --- tests/profiling.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/profiling.py b/tests/profiling.py index 5341521..71ce87c 100644 --- a/tests/profiling.py +++ b/tests/profiling.py @@ -135,7 +135,6 @@ def __enter__(self): def __exit__(self, type, value, traceback): # skipcq: PYL-W0622 self.checkpoint(str("finished")) - pass def do_time_profile(func, timer_name="time_profile"): From ac959097cdd1aafb38137792c96241de62fdda6d Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Sun, 14 Jul 2024 21:44:41 -0700 Subject: [PATCH 54/68] Fix Anti-pattern PYL-R0123 (- Fixes #53 -) --- tests/test_usage.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_usage.py b/tests/test_usage.py index 8750ef1..a6106cc 100644 --- a/tests/test_usage.py +++ b/tests/test_usage.py @@ -3,7 +3,7 @@ # Python Repo Template # .................................. -# Copyright (c) 2017-2019, 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. @@ -57,7 +57,7 @@ def buildPythonCommand(args=None): # you need to change this to the name of your project __project__ = str("pythonrepo") try: - if args is None or args is [None]: + if args is None or (args == [None]): theArgs = ["exit 1 ; #"] else: theArgs = args From d6be075e9a0aa0ac1bbb20fecb5885df52c92e25 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Sun, 14 Jul 2024 22:07:52 -0700 Subject: [PATCH 55/68] Resolve conflicting style-linting (- WIP #56 -) --- tests/test_usage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_usage.py b/tests/test_usage.py index a6106cc..b75d253 100644 --- a/tests/test_usage.py +++ b/tests/test_usage.py @@ -166,7 +166,7 @@ class BasicUsageTestSuite(unittest.TestCase): def test_absolute_truth_and_meaning(self): """Insanity Test. if ( is true ) usage.""" - self.assertTrue(True) + self.assertTrue(True) # skipcq: PYL-W1503 def test_syntax(self): """Test case importing code. if ( import is not None ) usage.""" From 07ab5674afa73c20133f90483f738233cdb57688 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Sun, 14 Jul 2024 22:17:09 -0700 Subject: [PATCH 56/68] Resolves PYL-W1503 (- Fixes #56 -) --- tests/test_basic.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_basic.py b/tests/test_basic.py index f76f54f..5a96de8 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -27,11 +27,12 @@ class BasicTestSuite(unittest.TestCase): def test_absolute_truth_and_meaning(self): """Insanitty Test. Because it only matters if we're not mad as hatters.""" assert True + self.assertTrue(True) # skipcq: PYL-W1503 def test_meta_test(self): """Insanity Test for unittests assertion.""" - self.assertTrue(True) - self.assertFalse(False) + self.assertTrue(True) # skipcq: PYL-W1503 + self.assertFalse(False) # skipcq: PYL-W1503 self.assertIsNone(None) def test_syntax(self): From 4416fbb5f5aa2df770a9d44567b9aaeb6f3bccce Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Sun, 14 Jul 2024 22:58:55 -0700 Subject: [PATCH 57/68] Fix up deepsource complaints (#57) Include Various Hotfixes: * Refactor pointless global doctoring to muzzle linter PYL-W0105 (- Fixes #54 -) * Resolves PYL-W0107 (- Fixes #55 -) * Fix Anti-pattern PYL-R0123 (- Fixes #53 -) * Resolve conflicting style-linting (- WIP #56 -) * Resolves PYL-W1503 (- Fixes #56 -) --- pythonrepo/pythonrepo.py | 1 - tests/profiling.py | 1 - tests/test_basic.py | 5 +++-- tests/test_usage.py | 6 +++--- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pythonrepo/pythonrepo.py b/pythonrepo/pythonrepo.py index 313efde..4424085 100644 --- a/pythonrepo/pythonrepo.py +++ b/pythonrepo/pythonrepo.py @@ -36,7 +36,6 @@ from . import __version__ -"""The version of this program.""" __prog__ = str(__module__) diff --git a/tests/profiling.py b/tests/profiling.py index 5341521..71ce87c 100644 --- a/tests/profiling.py +++ b/tests/profiling.py @@ -135,7 +135,6 @@ def __enter__(self): def __exit__(self, type, value, traceback): # skipcq: PYL-W0622 self.checkpoint(str("finished")) - pass def do_time_profile(func, timer_name="time_profile"): diff --git a/tests/test_basic.py b/tests/test_basic.py index f76f54f..5a96de8 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -27,11 +27,12 @@ class BasicTestSuite(unittest.TestCase): def test_absolute_truth_and_meaning(self): """Insanitty Test. Because it only matters if we're not mad as hatters.""" assert True + self.assertTrue(True) # skipcq: PYL-W1503 def test_meta_test(self): """Insanity Test for unittests assertion.""" - self.assertTrue(True) - self.assertFalse(False) + self.assertTrue(True) # skipcq: PYL-W1503 + self.assertFalse(False) # skipcq: PYL-W1503 self.assertIsNone(None) def test_syntax(self): diff --git a/tests/test_usage.py b/tests/test_usage.py index 8750ef1..b75d253 100644 --- a/tests/test_usage.py +++ b/tests/test_usage.py @@ -3,7 +3,7 @@ # Python Repo Template # .................................. -# Copyright (c) 2017-2019, 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. @@ -57,7 +57,7 @@ def buildPythonCommand(args=None): # you need to change this to the name of your project __project__ = str("pythonrepo") try: - if args is None or args is [None]: + if args is None or (args == [None]): theArgs = ["exit 1 ; #"] else: theArgs = args @@ -166,7 +166,7 @@ class BasicUsageTestSuite(unittest.TestCase): def test_absolute_truth_and_meaning(self): """Insanity Test. if ( is true ) usage.""" - self.assertTrue(True) + self.assertTrue(True) # skipcq: PYL-W1503 def test_syntax(self): """Test case importing code. if ( import is not None ) usage.""" From b34116b70b263c75b9bb829a8a038cfa7eaf338d Mon Sep 17 00:00:00 2001 From: reactive-firewall Date: Mon, 19 Aug 2024 14:24:33 -0700 Subject: [PATCH 58/68] Minor fixup to ignore PTC-W0020 to maintain clearity in source. --- pythonrepo/__init__.py | 1 + pythonrepo/pythonrepo.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pythonrepo/__init__.py b/pythonrepo/__init__.py index 2e52aac..30f5295 100644 --- a/pythonrepo/__init__.py +++ b/pythonrepo/__init__.py @@ -1,3 +1,4 @@ +#! /usr/bin/env python3 # -*- coding: utf-8 -*- # Python Repo Template diff --git a/pythonrepo/pythonrepo.py b/pythonrepo/pythonrepo.py index 4424085..12a94cc 100644 --- a/pythonrepo/pythonrepo.py +++ b/pythonrepo/pythonrepo.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 # -*- coding: utf-8 -*- # Python Repo Template @@ -65,7 +65,7 @@ def NoOp(*args, **kwargs): # More boiler-plate-code -TASK_OPTIONS = dict({ +TASK_OPTIONS = dict({ # skipcq: PTC-W0020 'noop': NoOp }) """The callable function tasks of this program.""" From 56874d1832a531b98f09630e3e6c4fb47b47a1c5 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Mon, 19 Aug 2024 14:56:27 -0700 Subject: [PATCH 59/68] Fixup for CI to use latest archive upload and codecov actions. --- .github/workflows/Tests.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index de61e29..09b1713 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -225,7 +225,7 @@ jobs: if: ${{ runner.python-version }} != "3.9" run: make -f Makefile test-pytest ; - name: Upload Python ${{ matrix.python-version }} coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./coverage.xml @@ -235,7 +235,7 @@ jobs: verbose: true fail_ci_if_error: false - name: Upload Python ${{ matrix.python-version }} Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Test-Report-${{ matrix.os }}-${{ matrix.python-version }} path: ./test-reports/ @@ -309,7 +309,7 @@ jobs: if: ${{ runner.python-version }} != "3.9" run: make -f Makefile test-pytest ; - name: Upload Python ${{ matrix.python-version }} coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./coverage.xml @@ -319,7 +319,7 @@ jobs: verbose: true fail_ci_if_error: false - name: Upload Python ${{ matrix.python-version }} Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Test-Report-${{ matrix.os }}-${{ matrix.python-version }} path: ./test-reports/ @@ -430,7 +430,7 @@ jobs: cp -vf ./coverage.xml ./test-reports/coverage.xml || true ; shell: bash - name: Upload Python ${{ matrix.python-version }} coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./test-reports/coverage_supplement.xml @@ -440,7 +440,7 @@ jobs: verbose: true fail_ci_if_error: false - name: Upload Extra Python ${{ matrix.python-version }} Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Integration-Test-Report-${{ matrix.os }}-${{ matrix.python-version }} path: ./test-reports/ From ded92be14accefd105ce3bc15986138fe0c0cbe0 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Mon, 19 Aug 2024 15:05:38 -0700 Subject: [PATCH 60/68] Fixup for CI regarding duplicate python3.11 test results. (- Fixes #38 -) --- .github/workflows/Tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 09b1713..3306833 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -319,6 +319,7 @@ jobs: verbose: true fail_ci_if_error: false - name: Upload Python ${{ matrix.python-version }} Artifact + if: ${{ runner.python-version }} != "3.11" uses: actions/upload-artifact@v4 with: name: Test-Report-${{ matrix.os }}-${{ matrix.python-version }} From 2abeec29c51b066b84671d9a2839b83ac68a244c Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Tue, 20 Aug 2024 15:41:11 -0700 Subject: [PATCH 61/68] House Keeping for PR #34 Includes: - Fixes for https://github.com/reactive-firewall/python-repo/pull/34/files#r1722492778 - Fixes for https://github.com/reactive-firewall/python-repo/pull/34/files#r1722494177 - Fixes for https://github.com/reactive-firewall/python-repo/pull/34/files#r1722506148 --- .github/CONTRIBUTING.md | 6 ++---- .github/ISSUE_TEMPLATE.md | 2 +- .github/ISSUE_TEMPLATE/bug_report.md | 6 +++--- .github/ISSUE_TEMPLATE/house-keeping.md | 23 +++++++++++++++++++++++ .github/labeler.yml | 2 ++ docs/conf.py | 2 +- setup.cfg | 7 +++++-- setup.py | 2 +- 8 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/house-keeping.md diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index a93d9cb..f8bfd8a 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -31,7 +31,7 @@ Here is a brief explanation on how I triage incoming tickets to get a better sen When sitting down to do some triaging work, start with the list of untriaged tickets. Consider all tickets that do not have a label as untriaged. The first step is to categorize the ticket into one of the following categories and either close the ticket or assign an appropriate lable. The reported issue * is not valid -If you think the ticket is invalid comment why you think it is invalid, then close the ticket. Tickets might be invalid if they were already fixed in the past or it was decided that the proposed feature will not be implemented because it does not conform with the overall goal of Pocket-PiAI Project. Also if you happen to know that the problem was already reported, label the ticket with Status: duplicate, reference the other ticket that is already addressing the problem and close the duplicate. +If you think the ticket is invalid comment why you think it is invalid, then close the ticket. Tickets might be invalid if they were already fixed in the past or it was decided that the proposed feature will not be implemented because it does not conform with the overall goal of Python-Repo Project. Also if you happen to know that the problem was already reported, label the ticket with Status: duplicate, reference the other ticket that is already addressing the problem and close the duplicate. Examples: @@ -107,9 +107,7 @@ This is the checklist that I try to go through for every single pull request tha - [ ] Do the tests pass for all of the following? If not, write a note in the PR, or fix them yourself. - - [ ] Python 3.8 - Mac - - [ ] Python 3.8 - Linux (OPTIONAL) - - [ ] Python 3.9 - Linux + - [ ] Python 3.9 - Linux (OPTIONAL) - [ ] Python 3.9 (or Newer) - Mac - [ ] Python 3.10 - Linux - [ ] Python 3.11 - Linux diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 751474c..0a88d6d 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -9,7 +9,7 @@ >> `uname -a` - [ ] linux - [ ] MacOS (darwin) -- `multicast` version: +- `` version: >> `python3 -m pythonrepo.pythonrepo --version` diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index a3a7bea..4122280 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -2,7 +2,7 @@ name: Bug report about: Create a report to help us improve title: '' -labels: Bug, Failing +labels: Bug, Testing assignees: reactive-firewall --- @@ -26,11 +26,11 @@ If applicable, add logs here to help explain your problem. **Screenshots** _(optional)_ If applicable, add screenshots to help explain your problem. -**PiAP Device (please complete the following information):** +**Reporter's Device (please complete the following information):** - OS: [e.g. macOS] - OS Version: [e.g. 22] - Python Version [e.g. 3.9] _(optional)_ - - Python Template Version: [e.g. v0.5.0] + - Python Template Version: [e.g. v1.5.0] **Additional context** _(optional)_ Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/house-keeping.md b/.github/ISSUE_TEMPLATE/house-keeping.md new file mode 100644 index 0000000..68cdcde --- /dev/null +++ b/.github/ISSUE_TEMPLATE/house-keeping.md @@ -0,0 +1,23 @@ +--- +name: House Keeping +about: Create a suggestion to help improve a specific detail like depenancy version. +title: House Keeping +labels: Documentation, Github, Enhancement +assignees: '' + +--- + +**Describe the Task** +A clear and concise description of what needs done. +[e.g. library xyz should use the latest version 123] + +**Expected Solution** __(suggested)__ +A clear and concise description of what you (or others) might expect as a fix. +[e.g. update the version number to 123] + +**Related Documentation** __(optional)__ +If applicable, add documentation references to help explain your question. +[e.g. see link/to/librarry/version/123/docs] + +**Additional context** __(optional)__ +Add any other context about the question here. diff --git a/.github/labeler.yml b/.github/labeler.yml index 6d5a653..20faf9f 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -4,6 +4,8 @@ Python Repo: - any-glob-to-any-file: - setup.py - pythonrepo/*.py + - LICENSE + - LICENSE.md # Add 'Lint' label to any lint file changes Linter: diff --git a/docs/conf.py b/docs/conf.py index ae43ce2..14c7307 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -51,7 +51,7 @@ # The short X.Y version. version = 'v1.1' # The full version, including alpha/beta/rc tags. -release = 'v1.1.5' +release = 'v1.1.4' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/setup.cfg b/setup.cfg index 458a068..621fe9a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -13,6 +13,9 @@ classifiers = 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 @@ -34,5 +37,5 @@ packages = find: [options.packages.find] exclude = - docs - tests + docs + tests diff --git a/setup.py b/setup.py index 862e023..ec81270 100755 --- a/setup.py +++ b/setup.py @@ -50,7 +50,7 @@ def readFile(filename): setup( name="""pythonrepo""", - version="""1.1.3""", + version="""1.1.4""", description="""Python Repo""", long_description=readme, install_requires=requirements, From e1159728587e6b8e8fee15aa47bcc887e00a96f1 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Tue, 20 Aug 2024 16:14:39 -0700 Subject: [PATCH 62/68] Fixup for PR #60 to no-longer run python3.11 coverage twice in github CI (- Fixes #61 -) --- .github/workflows/Tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 3306833..b850cbf 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -263,7 +263,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-13, windows-latest] - python-version: [3.7, 3.8, 3.9, "3.10", "3.11"] + python-version: [3.7, 3.8, 3.9, "3.10"] env: OS: ${{ matrix.os }} PYTHON_VERSION: ${{ matrix.python-version }} @@ -319,7 +319,6 @@ jobs: verbose: true fail_ci_if_error: false - name: Upload Python ${{ matrix.python-version }} Artifact - if: ${{ runner.python-version }} != "3.11" uses: actions/upload-artifact@v4 with: name: Test-Report-${{ matrix.os }}-${{ matrix.python-version }} From f5dad4cf84dcc50b69a7d1cb904b56fab37bf4c1 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Thu, 5 Sep 2024 15:18:51 -0700 Subject: [PATCH 63/68] Create dependabot.yml --- .github/dependabot.yml | 69 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..28e087e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,69 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: "pip" # See documentation for possible values + directory: "/" # Location of package manifests + milestone: 2 + target-branch: "master" + versioning-strategy: increase-if-necessary + # Labels on pull requests for version updates only + labels: + - "Configs" + - "Duplicate" + - "Python Lang" + - "Python Repo" + groups: + production-dependencies: + dependency-type: "production" + exclude-patterns: + - "setuptools*" + development-dependencies: + dependency-type: "development" + allow: + - dependency-name: "setuptools" + dependency-type: "production" + - dependency-name: "pip" + dependency-type: "direct" + - dependency-name: "wheel" + dependency-type: "production" + - dependency-name: "build" + dependency-type: "production" + - dependency-name: "argparse" + dependency-type: "direct" + - dependency-name: "six" + dependency-type: "direct" + - dependency-name: "tox" + dependency-type: "development" + - dependency-name: "virtualenv" + dependency-type: "development" + assignees: + - "reactive-firewall" + commit-message: + prefix: "[HOTFIX] " + include: "scope" + schedule: + interval: "weekly" + day: "tuesday" + - package-ecosystem: "github-actions" # See documentation for possible values + directory: ".github/workflows/" # Location of package manifests + milestone: 2 + target-branch: "master" + # Labels on pull requests for version updates only + labels: + - "Configs" + - "Duplicate" + - "GitHub" + - "Testing" + - "Python Repo" + assignees: + - "reactive-firewall" + commit-message: + prefix: "[UPDATE] " + include: "scope" + schedule: + interval: "weekly" + day: "tuesday" From 776159a3086ce090b8f4e76df54994de636d7df6 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Thu, 5 Sep 2024 16:32:53 -0700 Subject: [PATCH 64/68] [STYLE] Apply suggestions from code review (- WIP #67 & PR #66 -) - Resolves issue #67 and others raised during code review. Signed-off-by: Mr. Walls --- .github/dependabot.yml | 96 +++++++++++++++++++++++------------------- 1 file changed, 52 insertions(+), 44 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 28e087e..0e05553 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,51 +3,59 @@ # Please see the documentation for all configuration options: # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file +# This Dependabot configuration file is set up to manage dependency updates for both Python packages (pip) and GitHub Actions workflows. +# +# Key points: +# - Dependencies are categorized into production and development groups. +# - The "setuptools" package is treated as an exception: it is excluded from the production group but is still allowed to be updated as a production dependency. +# - The configuration includes specific labels, assignees, and commit message formats to streamline the update process. +# - Updates are scheduled to run weekly on Tuesdays. + version: 2 updates: - - package-ecosystem: "pip" # See documentation for possible values - directory: "/" # Location of package manifests - milestone: 2 - target-branch: "master" - versioning-strategy: increase-if-necessary - # Labels on pull requests for version updates only - labels: - - "Configs" - - "Duplicate" - - "Python Lang" - - "Python Repo" - groups: - production-dependencies: - dependency-type: "production" - exclude-patterns: - - "setuptools*" - development-dependencies: - dependency-type: "development" - allow: - - dependency-name: "setuptools" - dependency-type: "production" - - dependency-name: "pip" - dependency-type: "direct" - - dependency-name: "wheel" - dependency-type: "production" - - dependency-name: "build" - dependency-type: "production" - - dependency-name: "argparse" - dependency-type: "direct" - - dependency-name: "six" - dependency-type: "direct" - - dependency-name: "tox" - dependency-type: "development" - - dependency-name: "virtualenv" - dependency-type: "development" - assignees: - - "reactive-firewall" - commit-message: - prefix: "[HOTFIX] " - include: "scope" - schedule: - interval: "weekly" - day: "tuesday" + - package-ecosystem: "pip" # See documentation for possible values + directory: "/" # Location of package manifests + milestone: 2 + target-branch: "master" + versioning-strategy: increase-if-necessary + # Labels on pull requests for version updates only + labels: + - "Configs" + - "Version Update" + - "Python Lang" + - "Python Repo" + groups: + production-dependencies: + dependency-type: "production" + exclude-patterns: + - "setuptools*" + development-dependencies: + dependency-type: "development" + allow: + - dependency-name: "setuptools" + dependency-type: "production" + - dependency-name: "pip" + dependency-type: "direct" + - dependency-name: "wheel" + dependency-type: "production" + - dependency-name: "build" + dependency-type: "production" + - dependency-name: "argparse" + dependency-type: "direct" + - dependency-name: "six" + dependency-type: "direct" + - dependency-name: "tox" + dependency-type: "development" + - dependency-name: "virtualenv" + dependency-type: "development" + assignees: + - "reactive-firewall" + commit-message: + prefix: "[HOTFIX] " + include: "scope" + schedule: + interval: "weekly" + day: "tuesday" - package-ecosystem: "github-actions" # See documentation for possible values directory: ".github/workflows/" # Location of package manifests milestone: 2 @@ -55,7 +63,7 @@ updates: # Labels on pull requests for version updates only labels: - "Configs" - - "Duplicate" + - "Version Update" - "GitHub" - "Testing" - "Python Repo" From a67d225adec80120853ce26a5c5fbb12447c5a7f Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Thu, 5 Sep 2024 16:51:06 -0700 Subject: [PATCH 65/68] [REGRESSION] Fix .github/dependabot.yml spacing (- WIP PR #66 -) Signed-off-by: Mr. Walls --- .github/dependabot.yml | 96 +++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0e05553..d8d716e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -13,65 +13,65 @@ version: 2 updates: - - package-ecosystem: "pip" # See documentation for possible values - directory: "/" # Location of package manifests - milestone: 2 - target-branch: "master" - versioning-strategy: increase-if-necessary - # Labels on pull requests for version updates only - labels: - - "Configs" - - "Version Update" - - "Python Lang" - - "Python Repo" - groups: - production-dependencies: - dependency-type: "production" - exclude-patterns: - - "setuptools*" - development-dependencies: - dependency-type: "development" - allow: - - dependency-name: "setuptools" - dependency-type: "production" - - dependency-name: "pip" - dependency-type: "direct" - - dependency-name: "wheel" - dependency-type: "production" - - dependency-name: "build" - dependency-type: "production" - - dependency-name: "argparse" - dependency-type: "direct" - - dependency-name: "six" - dependency-type: "direct" - - dependency-name: "tox" - dependency-type: "development" - - dependency-name: "virtualenv" - dependency-type: "development" - assignees: - - "reactive-firewall" - commit-message: - prefix: "[HOTFIX] " - include: "scope" - schedule: - interval: "weekly" - day: "tuesday" - - package-ecosystem: "github-actions" # See documentation for possible values - directory: ".github/workflows/" # Location of package manifests + - package-ecosystem: "pip" # See documentation for possible values + directory: "/" # Location of package manifests milestone: 2 target-branch: "master" + versioning-strategy: increase-if-necessary # Labels on pull requests for version updates only labels: - "Configs" - "Version Update" - - "GitHub" - - "Testing" + - "Python Lang" - "Python Repo" + groups: + production-dependencies: + dependency-type: "production" + exclude-patterns: + - "setuptools*" + development-dependencies: + dependency-type: "development" + allow: + - dependency-name: "setuptools" + dependency-type: "production" + - dependency-name: "pip" + dependency-type: "direct" + - dependency-name: "wheel" + dependency-type: "production" + - dependency-name: "build" + dependency-type: "production" + - dependency-name: "argparse" + dependency-type: "direct" + - dependency-name: "six" + dependency-type: "direct" + - dependency-name: "tox" + dependency-type: "development" + - dependency-name: "virtualenv" + dependency-type: "development" assignees: - "reactive-firewall" commit-message: - prefix: "[UPDATE] " + prefix: "[HOTFIX] " include: "scope" schedule: interval: "weekly" day: "tuesday" + - package-ecosystem: "github-actions" # See documentation for possible values + directory: ".github/workflows/" # Location of package manifests + milestone: 2 + target-branch: "master" + # Labels on pull requests for version updates only + labels: + - "Configs" + - "Version Update" + - "GitHub" + - "Testing" + - "Python Repo" + assignees: + - "reactive-firewall" + commit-message: + prefix: "[UPDATE] " + include: "scope" + schedule: + interval: "weekly" + day: "tuesday" From 7b9c1776d21480aeabdde40938ea407ba8053d30 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Thu, 5 Sep 2024 17:02:04 -0700 Subject: [PATCH 66/68] [CI] Create dependabot.yml for version updating (#66) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Resolves issue #67 and others raised during code review. --- 🩹 **Caution:** Dependabot seems confused by the nature of this development branch and is unable to cope, so while dangerous, its CI failures will be ignored for this PR. --- Squashes: * Create dependabot.yml f5dad4cf84dcc50b69a7d1cb904b56fab37bf4c1 * [STYLE] Apply suggestions from code review (- WIP #67 & PR #66 -) 776159a3086ce090b8f4e76df54994de636d7df6 * [REGRESSION] Fix .github/dependabot.yml spacing (- WIP PR #66 -) a67d225adec80120853ce26a5c5fbb12447c5a7f --- .github/dependabot.yml | 77 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..d8d716e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,77 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +# This Dependabot configuration file is set up to manage dependency updates for both Python packages (pip) and GitHub Actions workflows. +# +# Key points: +# - Dependencies are categorized into production and development groups. +# - The "setuptools" package is treated as an exception: it is excluded from the production group but is still allowed to be updated as a production dependency. +# - The configuration includes specific labels, assignees, and commit message formats to streamline the update process. +# - Updates are scheduled to run weekly on Tuesdays. + +version: 2 +updates: + - package-ecosystem: "pip" # See documentation for possible values + directory: "/" # Location of package manifests + milestone: 2 + target-branch: "master" + versioning-strategy: increase-if-necessary + # Labels on pull requests for version updates only + labels: + - "Configs" + - "Version Update" + - "Python Lang" + - "Python Repo" + groups: + production-dependencies: + dependency-type: "production" + exclude-patterns: + - "setuptools*" + development-dependencies: + dependency-type: "development" + allow: + - dependency-name: "setuptools" + dependency-type: "production" + - dependency-name: "pip" + dependency-type: "direct" + - dependency-name: "wheel" + dependency-type: "production" + - dependency-name: "build" + dependency-type: "production" + - dependency-name: "argparse" + dependency-type: "direct" + - dependency-name: "six" + dependency-type: "direct" + - dependency-name: "tox" + dependency-type: "development" + - dependency-name: "virtualenv" + dependency-type: "development" + assignees: + - "reactive-firewall" + commit-message: + prefix: "[HOTFIX] " + include: "scope" + schedule: + interval: "weekly" + day: "tuesday" + - package-ecosystem: "github-actions" # See documentation for possible values + directory: ".github/workflows/" # Location of package manifests + milestone: 2 + target-branch: "master" + # Labels on pull requests for version updates only + labels: + - "Configs" + - "Version Update" + - "GitHub" + - "Testing" + - "Python Repo" + assignees: + - "reactive-firewall" + commit-message: + prefix: "[UPDATE] " + include: "scope" + schedule: + interval: "weekly" + day: "tuesday" From 96453e76fc579c39b0cd3f610471983df3a4b540 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Thu, 5 Sep 2024 17:36:09 -0700 Subject: [PATCH 67/68] [REGRESSION] Fixes the dependabot.yml file syntax to hopefully restore CI (- WIP PR #66 & #67 -) --- .github/dependabot.yml | 58 ++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d8d716e..5400d77 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,18 +3,22 @@ # Please see the documentation for all configuration options: # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file -# This Dependabot configuration file is set up to manage dependency updates for both Python packages (pip) and GitHub Actions workflows. -# +# This Dependabot configuration file is set up to manage dependency updates +# for both Python packages (pip) and GitHub Actions workflows. +# # Key points: # - Dependencies are categorized into production and development groups. -# - The "setuptools" package is treated as an exception: it is excluded from the production group but is still allowed to be updated as a production dependency. -# - The configuration includes specific labels, assignees, and commit message formats to streamline the update process. +# - The "setuptools" package is treated as an exception: it is excluded from +# the production group but is still allowed to be updated as a production +# dependency. +# - The configuration includes specific labels, assignees, and commit message +# formats to streamline the update process. # - Updates are scheduled to run weekly on Tuesdays. - +--- version: 2 updates: - - package-ecosystem: "pip" # See documentation for possible values - directory: "/" # Location of package manifests + - package-ecosystem: "pip" # See documentation for possible values + directory: "/" # Location of package manifests milestone: 2 target-branch: "master" versioning-strategy: increase-if-necessary @@ -31,7 +35,7 @@ updates: - "setuptools*" development-dependencies: dependency-type: "development" - allow: + allow: - dependency-name: "setuptools" dependency-type: "production" - dependency-name: "pip" @@ -56,22 +60,22 @@ updates: schedule: interval: "weekly" day: "tuesday" - - package-ecosystem: "github-actions" # See documentation for possible values - directory: ".github/workflows/" # Location of package manifests - milestone: 2 - target-branch: "master" - # Labels on pull requests for version updates only - labels: - - "Configs" - - "Version Update" - - "GitHub" - - "Testing" - - "Python Repo" - assignees: - - "reactive-firewall" - commit-message: - prefix: "[UPDATE] " - include: "scope" - schedule: - interval: "weekly" - day: "tuesday" + - package-ecosystem: "github-actions" # See documentation for possible values + directory: ".github/workflows/" # Location of package manifests + milestone: 2 + target-branch: "master" + # Labels on pull requests for version updates only + labels: + - "Configs" + - "Version Update" + - "GitHub" + - "Testing" + - "Python Repo" + assignees: + - "reactive-firewall" + commit-message: + prefix: "[UPDATE] " + include: "scope" + schedule: + interval: "weekly" + day: "tuesday" From 591604fd4ce585839353d453c749fe283267dd83 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Sep 2024 02:15:36 +0000 Subject: [PATCH 68/68] [UPDATE] (deps): Bump ossf/scorecard-action in /.github/workflows Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.3.1 to 2.4.0. - [Release notes](https://github.com/ossf/scorecard-action/releases) - [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md) - [Commits](https://github.com/ossf/scorecard-action/compare/0864cf19026789058feabb7e87baa5f140aac736...62b2cac7ed8198b15735ed49ab1e5cf35480ba46) --- updated-dependencies: - dependency-name: ossf/scorecard-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/scorecards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index cdcf1d4..99a4e23 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -37,7 +37,7 @@ jobs: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1 + uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0 with: results_file: results.sarif results_format: sarif