diff --git a/rst_include/3rd_party_stubs/readme.txt b/.3rd_party_stubs/readme.txt similarity index 83% rename from rst_include/3rd_party_stubs/readme.txt rename to .3rd_party_stubs/readme.txt index 1284afd..63da825 100644 --- a/rst_include/3rd_party_stubs/readme.txt +++ b/.3rd_party_stubs/readme.txt @@ -1,6 +1,6 @@ -put 3rd party stubs in this directory needed to pass mypy on travis. +put 3rd party stubs in this directory needed to pass mypy on Github Actions. -in the travis.yml the MYPYPATH is set to this directory. +in the Github Actions the MYPYPATH is set to this directory. for local testing, put the *.pyi Files into another central directory and set the mypy path accordingly. the reason for that is, that a certain *.pyi have to be only found once by mypy, otherwise it will throw an error. @@ -17,6 +17,6 @@ the module "external_test" is used in project_a, and project_b, and package_a im -- project_B ------- package_b_dir --- 3rd_party_stubs --- external_test.pyi -for travis test of project_A we need to set the MYPYPATH to .../projects/project_A/package_a_dir/3rd_party_stubs +for travis test of project_A we need to set the MYPYPATH to .../projects/project_A/3rd_party_stubs for local tests, we need to set the MYPYPATH to .../projects/stub_directory , not to find external_test.pyi twice. diff --git a/.bettercodehub.yml b/.bettercodehub.yml deleted file mode 100644 index 5565464..0000000 --- a/.bettercodehub.yml +++ /dev/null @@ -1,6 +0,0 @@ -component_depth: 4 -languages: - - python -exclude: - # regex pattern, see https://bettercodehub.com/docs/configuration-manual - - .*/setup\.py diff --git a/.docs/README_template.rst b/.docs/README_template.rst index bf13d3f..831a007 100644 --- a/.docs/README_template.rst +++ b/.docs/README_template.rst @@ -2,7 +2,7 @@ rst_include =========== -Version v2.1.2.2 as of 2022-06-03 see `Changelog`_ +Version v2.1.3 as of 2023-07-21 see `Changelog`_ .. include:: ./badges.rst @@ -11,10 +11,10 @@ Version v2.1.2.2 as of 2022-06-03 see `Changelog`_ ---- -automated tests, Travis Matrix, Documentation, Badges, etc. are managed with `PizzaCutter `_ (cookiecutter on steroids) -Python version required: 3.6.0 or newer +Python version required: 3.8.0 or newer .. include:: ./tested_under.rst diff --git a/.docs/badges.rst b/.docs/badges.rst index 6a653d9..f8ec100 100644 --- a/.docs/badges.rst +++ b/.docs/badges.rst @@ -1,6 +1,5 @@ -|build_badge| |license| |pypi| |pypi-downloads| |black| - -|codecov| |better_code| |cc_maintain| |cc_issues| |cc_coverage| |snyk| +|build_badge| |codeql| |license| |pypi| +|pypi-downloads| |black| |codecov| |cc_maintain| |cc_issues| |cc_coverage| |snyk| @@ -8,6 +7,9 @@ :target: https://github.com/bitranox/rst_include/actions/workflows/python-package.yml +.. |codeql| image:: https://github.com/bitranox/rst_include/actions/workflows/codeql-analysis.yml/badge.svg?event=push + :target: https://github.com//bitranox/rst_include/actions/workflows/codeql-analysis.yml + .. |license| image:: https://img.shields.io/github/license/webcomics/pywine.svg :target: http://en.wikipedia.org/wiki/MIT_License @@ -21,9 +23,6 @@ .. |codecov| image:: https://img.shields.io/codecov/c/github/bitranox/rst_include :target: https://codecov.io/gh/bitranox/rst_include -.. |better_code| image:: https://bettercodehub.com/edge/badge/bitranox/rst_include?branch=master - :target: https://bettercodehub.com/results/bitranox/rst_include - .. |cc_maintain| image:: https://img.shields.io/codeclimate/maintainability-percentage/bitranox/rst_include?label=CC%20maintainability :target: https://codeclimate.com/github/bitranox/rst_include/maintainability :alt: Maintainability @@ -36,7 +35,7 @@ :target: https://codeclimate.com/github/bitranox/rst_include/test_coverage :alt: Code Coverage -.. |snyk| image:: https://img.shields.io/snyk/vulnerabilities/github/bitranox/rst_include +.. |snyk| image:: https://snyk.io/test/github/bitranox/rst_include/badge.svg :target: https://snyk.io/test/github/bitranox/rst_include .. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg diff --git a/.docs/installation.rst b/.docs/installation.rst index 52724d9..b01e35c 100644 --- a/.docs/installation.rst +++ b/.docs/installation.rst @@ -32,14 +32,14 @@ python -m pip install --upgrade -r //requirements.txt -- to install the latest development version from source code: +- to install the latest development version, including test dependencies from source code: .. code-block:: # cd ~ $ git clone https://github.com/bitranox/rst_include.git $ cd rst_include - python setup.py install + python -m pip install -e .[test] .. include:: ./installation_via_makefile.rst diff --git a/.docs/installation_via_pypi.rst b/.docs/installation_via_pypi.rst index 3c51700..d6c082d 100644 --- a/.docs/installation_via_pypi.rst +++ b/.docs/installation_via_pypi.rst @@ -3,3 +3,11 @@ .. code-block:: python -m pip install --upgrade rst_include + + +- to install the latest release from PyPi via pip, including test dependencies: + +.. code-block:: + + python -m pip install --upgrade rst_include[test] + diff --git a/.docs/tested_under.rst b/.docs/tested_under.rst index ac7193c..27f6afa 100644 --- a/.docs/tested_under.rst +++ b/.docs/tested_under.rst @@ -1,3 +1,3 @@ -tested on recent linux with python 3.6, 3.7, 3.8, 3.9, 3.10, pypy-3.8 - architectures: amd64 +tested on recent linux with python 3.8, 3.9, 3.10, 3.11, 3.12-dev, pypy-3.9, pypy-3.10 - architectures: amd64 -`100% code coverage `_, flake8 style checking ,mypy static type checking ,tested under `Linux, macOS, Windows `_, automatic daily builds and monitoring +`100% code coverage `_, flake8 style checking ,mypy static type checking ,tested under `Linux, macOS, Windows `_, automatic daily builds and monitoring diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..7e38a25 --- /dev/null +++ b/.flake8 @@ -0,0 +1,5 @@ +[flake8] +max_line_length = 160 +ignore = E123, E203, E402, F401, F403, F405, W503 +exclude = .git, __pycache__, build, dist, .eggs, .hg, .mypy_cache, .nox, .tox, .venv, _build, buck-out +max-complexity = 20 diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 99f43b3..48b17b9 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -46,7 +46,7 @@ jobs: # MYPY tests MYPY_DO_TESTS: "True" MYPY_OPTIONS: "--follow-imports=normal --ignore-missing-imports --implicit-reexport --install-types --no-warn-unused-ignores --non-interactive --strict" - MYPYPATH: "./rst_include/3rd_party_stubs" + MYPYPATH: "./.3rd_party_stubs" # coverage DO_COVERAGE: "True" @@ -71,15 +71,15 @@ jobs: matrix: include: # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-software + # https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#available-versions-of-python-and-pypy - os: windows-latest - python-version: "3.10" + python-version: "3.11" env: cEXPORT: "SET" BUILD_DOCS: "False" - DEPLOY_SDIST: "False" - DEPLOY_WHEEL: "False" - DEPLOY_TEST: "False" + BUILD: "False" + BUILD_TEST: "False" MYPY_DO_TESTS: "True" # Setup tests DO_SETUP_INSTALL: "True" @@ -89,87 +89,91 @@ jobs: - os: ubuntu-latest - python-version: "3.6" + python-version: "3.8" env: BUILD_DOCS: "False" - DEPLOY_SDIST: "True" - DEPLOY_WHEEL: "True" - DEPLOY_TEST: "True" + BUILD: "True" + BUILD_TEST: "True" MYPY_DO_TESTS: "True" DO_SETUP_INSTALL: "True" - DO_SETUP_INSTALL_TEST: "False" + DO_SETUP_INSTALL_TEST: "True" DO_CLI_TEST: "True" - os: ubuntu-latest - python-version: "3.7" + python-version: "3.9" env: BUILD_DOCS: "False" - DEPLOY_SDIST: "True" - DEPLOY_WHEEL: "True" - DEPLOY_TEST: "True" + BUILD: "True" + BUILD_TEST: "True" MYPY_DO_TESTS: "True" DO_SETUP_INSTALL: "True" - DO_SETUP_INSTALL_TEST: "False" + DO_SETUP_INSTALL_TEST: "True" DO_CLI_TEST: "True" - os: ubuntu-latest - python-version: "3.8" + python-version: "3.10" env: BUILD_DOCS: "False" - DEPLOY_SDIST: "True" - DEPLOY_WHEEL: "True" - DEPLOY_TEST: "True" + BUILD: "True" + BUILD_TEST: "True" MYPY_DO_TESTS: "True" DO_SETUP_INSTALL: "True" - DO_SETUP_INSTALL_TEST: "False" + DO_SETUP_INSTALL_TEST: "True" DO_CLI_TEST: "True" - os: ubuntu-latest - python-version: "3.9" + python-version: "3.11" env: - BUILD_DOCS: "False" - DEPLOY_SDIST: "True" - DEPLOY_WHEEL: "True" - DEPLOY_TEST: "True" + BUILD_DOCS: "True" + BUILD: "True" + BUILD_TEST: "True" MYPY_DO_TESTS: "True" DO_SETUP_INSTALL: "True" - DO_SETUP_INSTALL_TEST: "False" + DO_SETUP_INSTALL_TEST: "True" DO_CLI_TEST: "True" - os: ubuntu-latest - python-version: "3.10" + python-version: "3.12-dev" env: BUILD_DOCS: "True" - DEPLOY_SDIST: "True" - DEPLOY_WHEEL: "True" - DEPLOY_TEST: "True" + BUILD: "True" + BUILD_TEST: "True" + MYPY_DO_TESTS: "True" + DO_SETUP_INSTALL: "True" + DO_SETUP_INSTALL_TEST: "True" + DO_CLI_TEST: "True" + + - os: ubuntu-latest + python-version: "pypy-3.9" + env: + BUILD_DOCS: "False" + BUILD: "True" + BUILD_TEST: "True" MYPY_DO_TESTS: "True" DO_SETUP_INSTALL: "True" DO_SETUP_INSTALL_TEST: "True" DO_CLI_TEST: "True" - os: ubuntu-latest - python-version: "pypy-3.8" + python-version: "pypy-3.10" env: BUILD_DOCS: "False" - DEPLOY_SDIST: "True" - DEPLOY_WHEEL: "True" - DEPLOY_TEST: "True" - MYPY_DO_TESTS: "False" + BUILD: "True" + BUILD_TEST: "True" + MYPY_DO_TESTS: "True" DO_SETUP_INSTALL: "True" - DO_SETUP_INSTALL_TEST: "False" + DO_SETUP_INSTALL_TEST: "True" DO_CLI_TEST: "True" - os: macos-latest - python-version: "3.10" + python-version: "3.11" env: cPREFIX: "" # prefix before commands - used for wine, there the prefix is "wine" cPYTHON: "python3" # command to launch python interpreter (it's different on macOS, there we need python3) cPIP: "python3 -m pip" # command to launch pip (it's different on macOS, there we need pip3) BUILD_DOCS: "False" - DEPLOY_SDIST: "True" - DEPLOY_WHEEL: "True" - DEPLOY_TEST: "True" + BUILD: "True" + BUILD_TEST: "True" MYPY_DO_TESTS: "True" # Setup tests DO_SETUP_INSTALL: "True" @@ -185,7 +189,8 @@ jobs: - uses: actions/checkout@v3 - name: Setting up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + # see: https://github.com/actions/setup-python + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0d4496a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,217 +0,0 @@ -language: python -group: travis_latest -dist: bionic -sudo: true - -env: - global: - # prefix before commands - used for wine, there the prefix is "wine" - - cPREFIX="" - # command to launch python interpreter (its different on macOs, there we need python3) - - cPYTHON="python" - # command to launch pip (its different on macOs, there we need pip3) - - cPIP="python -m pip" - # switch off wine fix me messages - - WINEDEBUG=fixme-all - - # PYTEST - - PYTEST_DO_TESTS="True" - - # FLAKE8 tests - - DO_FLAKE8_TESTS="True" - - # MYPY tests - - MYPY_DO_TESTS="True" - - MYPY_OPTIONS="--follow-imports=normal --ignore-missing-imports --implicit-reexport --install-types --no-warn-unused-ignores --non-interactive --strict" - - MYPYPATH="./rst_include/3rd_party_stubs" - - # coverage - - DO_COVERAGE="True" - - DO_COVERAGE_UPLOAD_CODECOV="True" - - DO_COVERAGE_UPLOAD_CODE_CLIMATE="True" - - # package name - - PACKAGE_NAME="rst_include" - # the registered CLI Command - - CLI_COMMAND="rst_include" - # the source file for rst_include (rebuild rst file includes) - - RST_INCLUDE_SOURCE="./.docs/README_template.rst" - # the target file for rst_include (rebuild rst file includes) - - RST_INCLUDE_TARGET="./README.rst" - - # secure environment variable - - secure: "Qe9oava9KsQAqDpYwKl3s51ZZTj6j1aZw+vrSJYz8GXanGGGVfoe1FLDjm9TyQTMDkiQd4HF0zKAbUGfgR3DKpfg17BgWZn9r8qt4WE4GclO0h3cXnqp7F3DmZqIBDyZfOgXalng51/g02G78rCeugA7jZ+pPFEzkPkmuhWrsalnsVKUpxxmsaBWCP8jftUTXbnuu7xB6RZPmd8Vz9eYbEwujES1cAo/Yz79crJfBIw3jYkU8GYGEVt9QojBTZXieD6WN6wexRzLRChzn32SDfhT6NQVKOqjNBItRXqJd8luwLbon6k63lyvA5VNNgA70Roa4SpsDwxmqeGLone2Y5WXXKcZgIxQcMVzxJMDYGNEtGX5rGuwOU1Fn6JM1LBC9AW79y1dusyAJJHumPa0f5FknIiUvIdJ5sz/emS/tuoSKtf12vSeXvQskZ2m/Fe5HWSym+qeOuNHqvmOcN+s2aiNFMTQWWxuhyN5o96AeDvn6eF8fpbQqTD1nSwzlZ13BZzB8FtokCU1ASxhqL9e0H6fXOWg8MjXFzgYYW5R6nx31CGOCSWUPWxX5Y2NfdJi9PCMZLOPMbWw0jOO6P3Fw2TuCxQGuAfSWuxMrWHFfrQpfG3eoaYYluzUKA9z2rAy7O9l7tu9dSSfl6IEmLi/dLnBKEIerNKNQpN1xWd8lAQ=" # CC_TEST_REPORTER_ID.secret - - secure: "DrfW5T9mXVPBREpmvqHm/lGeNINRXo7aCFXiW5RVGoyFR2GsdZuF8GQQX9SFBGm46bgQ9cuCQErEkwxxa5nBIXbfEIpn4TMDZ/JSbS7zWk4WT6VSuRXl2ibiKfZP53mR/+AAdJvoSY72JlDr6q1p/M9AMj816n5mvanDmebUQNiUHIksuRZR3I2RBAHj3aWb1AOYSg6WIMZernacamSnY4KCodYL5FXxjASHuyxP2vtU+tgrLmUxRtFX5zvPFAMv/0372cS/QSizwnuYbX2MU8UFuxsrBZISGuUtehItJ7/aYjhFzYN8CKad90OFqQNwQ+Tbd828vxq3kbKByVrZqbh5eJGDGBfZobFxOyEXIqfNcwVrVE5XDVbY6+BTu+YMXCJe/scHL6nxkKM8vs32LgofHo4RChY9HG8IHPzN2hgwohivBCnmzh4MpArfOXpAVXhhpioFcvKpaigiX35c1+Z4S3tdz6ERyzCox+tVAlZs5gUgNsU+ZVUbquHSRSo3+e+fAfc7NqZs+VjzIApUbxGHYn2GMSACuIwQLKOrNsWlAvJZ0BalstVyDEXESRjDwx0Z45WP88MjXUFVJIfFHMJzu0OtGPFY3QGIZIgxiZMei3/D0c8dU0gyMLZuwJZGHCkchTKTo6ZgdsNGnf+e3x3J0VyXHTENT0GuyYhKN88=" # PYPI_PASSWORD.secret - - - -addons: - apt: - packages: - - xvfb # install xvfb virtual framebuffer - this we need for WINE - - winbind # needed for WINE - -services: # start services - - xvfb # is needed for WINE on headless installation - -matrix: - include: - - - os: windows - if: true - language: sh - name: "Windows Python 3.9" - - # oddly a secure password under env: global: causes that choco fails - # so we need to put the option : filter_secrets: false - # this can be a security issue, check that You dont leak secrets here ! - filter_secrets: false - before_install: - - git clone https://github.com/bitranox/lib_bash.git /usr/local/lib_bash - - chmod -R 0755 /usr/local/lib_bash - - chmod -R +x /usr/local/lib_bash/*.sh - - /usr/local/lib_bash/lib_retry.sh retry choco install python3 - - export PATH="/c/Python310:/c/Python310/Scripts:/c/Python39:/c/Python39/Scripts:/c/Python38:/c/Python38/Scripts:$PATH" - - export BUILD_DOCS="False" - - export DEPLOY_SDIST="False" - - export DEPLOY_WHEEL="False" - - export DEPLOY_TEST="False" - - export MYPY_DO_TESTS="True" - - - - os: linux - arch: "amd64" - if: true - language: python - python: "3.6" - before_install: - - export BUILD_DOCS="False" - - export DEPLOY_SDIST="True" - - export DEPLOY_WHEEL="True" - - export BUILD_TEST="True" - - export MYPY_DO_TESTS="True" - - - os: linux - arch: "amd64" - if: true - language: python - python: "3.7" - before_install: - - export BUILD_DOCS="False" - - export DEPLOY_SDIST="True" - - export DEPLOY_WHEEL="False" - - export BUILD_TEST="True" - - export MYPY_DO_TESTS="True" - - - os: linux - arch: "amd64" - if: true - language: python - python: "3.8" - before_install: - - export BUILD_DOCS="False" - - export DEPLOY_SDIST="True" - - export DEPLOY_WHEEL="True" - - export BUILD_TEST="True" - - export MYPY_DO_TESTS="True" - - - os: linux - arch: "amd64" - if: true - language: python - python: "3.9" - before_install: - - export BUILD_DOCS="True" - - export DEPLOY_SDIST="True" - - export DEPLOY_WHEEL="True" - - export BUILD_TEST="True" - - export MYPY_DO_TESTS="True" - - - os: linux - arch: "amd64" - if: true - language: python - python: "pypy3" - before_install: - - export BUILD_DOCS="False" - - export DEPLOY_SDIST="True" - - export DEPLOY_WHEEL="True" - - export BUILD_TEST="True" - - export MYPY_DO_TESTS="False" - - - os: linux - arch: "ppc64le" - if: tag IS present - language: python - python: "3.9" - before_install: - - export BUILD_DOCS="False" - - export DEPLOY_SDIST="True" - - export DEPLOY_WHEEL="True" - - export BUILD_TEST="True" - - export MYPY_DO_TESTS="True" - - - os: linux - arch: "s390x" - if: tag IS present - language: python - python: "3.9" - before_install: - - export BUILD_DOCS="False" - - export DEPLOY_SDIST="True" - - export DEPLOY_WHEEL="True" - - export BUILD_TEST="True" - - export MYPY_DO_TESTS="True" - - - os: linux - arch: "arm64" - if: tag IS present - language: python - python: "3.9" - before_install: - - export BUILD_DOCS="False" - - export DEPLOY_SDIST="True" - - export DEPLOY_WHEEL="True" - - export BUILD_TEST="True" - - export MYPY_DO_TESTS="True" - - - os: osx - if: true - language: sh - name: "macOS 10.15.7" - python: "3.8" - osx_image: xcode12.2 - env: - # on osx pip and python points to python 2.7 - therefore we have to use pip3 and python3 here - - cPREFIX="" # prefix before commands - used for wine, there the prefix is "wine" - - cPYTHON="python3" # command to launch python interpreter (its different on macOs, there we need python3) - - cPIP="python3 -m pip" # command to launch pip (its different on macOs, there we need pip3) - - export BUILD_DOCS="False" - - export DEPLOY_SDIST="False" - - export DEPLOY_WHEEL="False" - - export DEPLOY_TEST="True" - - export MYPY_DO_TESTS="True" - - -install: - - ${cPIP} install lib_travis - - log_util --colortest - - lib_travis install - -script: - - BRANCH=$(lib_travis get_branch) - - log_util --level=NOTICE --banner "working on branch ${BRANCH}" - - lib_travis script - -after_success: - - lib_travis after_success - - lib_travis deploy - - ls -l ./dist - -notifications: - email: - recipients: - - bitranox@gmail.com - # on_success default: change - on_success: never - on_failure: always diff --git a/CHANGES.rst b/CHANGES.rst index 414d788..42d4ffa 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,26 @@ Changelog - new MINOR version for added functionality in a backwards compatible manner - new PATCH version for backwards compatible bug fixes +v2.1.3 +-------- +2023-07-21: + - require minimum python 3.8 + - remove python 3.7 tests + - introduce PEP517 packaging standard + - introduce pyproject.toml build-system + - remove mypy.ini + - remove pytest.ini + - remove setup.cfg + - remove setup.py + - remove .bettercodehub.yml + - remove .travis.yml + - update black config + - clean ./tests/test_cli.py + - add codeql badge + - move 3rd_party_stubs outside the src directory to ``./.3rd_party_stubs`` + - add pypy 3.10 tests + - add python 3.12-dev tests + v2.1.2.2 -------- 2022-06-02: setup github actions v3, python3.10 test matrix diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 7fb9e5a..487af65 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -2,73 +2,67 @@ ## 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, sex characteristics, gender identity and expression, -level of experience, education, socio-economic status, nationality, personal -appearance, race, religion, or sexual identity and orientation. +We as members, contributors, and leaders pledge to make participation +in our community a harassment-free experience for everyone, regardless +of age, body size, visible or invisible disability, ethnicity, +sex characteristics, gender identity and expression, level of experience, +education, socio-economic status, nationality, personal appearance, +race, caste, color, religion, or sexual identity and orientation. + +We pledge to act and interact in ways that contribute to an open, +welcoming, diverse, inclusive, and healthy community. ## Our Standards -Examples of behavior that contributes to creating a positive environment -include: +Examples of behavior that contributes to a positive environment for our community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall community -* 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: +Examples of unacceptable behavior include: -* The use of sexualized language or imagery and unwelcome sexual attention or - advances -* Trolling, insulting/derogatory comments, and personal or political attacks +* The use of sexualized language or imagery, and sexual attention or advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks * Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting +* Publishing others’ private information, such as a physical or email address, + without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting -## Our Responsibilities +## Enforcement 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. +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in response +to any behavior that they deem inappropriate, threatening, offensive, or harmful. -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. +Community leaders 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, and will communicate reasons for moderation decisions when appropriate. ## 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. +This Code of Conduct applies within all community spaces, +and also applies when an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, +or acting as an appointed representative at an online or offline event. ## Enforcement -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at bitranox@gmail.com. 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. +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported +to the community leaders responsible for enforcement at bitranox@gmail.com . All complaints will be reviewed and investigated promptly and fairly. -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. +All community leaders are obligated to respect the privacy and security +of the reporter of any incident. ## Attribution -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, +available at https://www.contributor-covenant.org/version/2/1/code_of_conduct/ [homepage]: https://www.contributor-covenant.org diff --git a/LICENSE b/LICENSE index 709736b..b4540a5 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 1990-2022 Robert Nowotny +Copyright (c) 1990-2023 Robert Nowotny Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Makefile b/Makefile index 04c6df2..a8561d7 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ ## create virtual environment +## see: https://earthly.dev/blog/python-makefile/ venv: echo "ToDo - MakeFile is still in Development, contact bitranox@gmail.com if You need it" ## virtualenv venv @@ -27,3 +28,4 @@ uninstall: ## ideas - create make targets for "normal" installation and virtual environments, ## and to be able to pass the virtual environment directory alternatively ## not a priority now, since there are many other ways to install this package +## see: https://earthly.dev/blog/python-makefile/ diff --git a/README.rst b/README.rst index 46be818..9da45f5 100644 --- a/README.rst +++ b/README.rst @@ -2,11 +2,10 @@ rst_include =========== -Version v2.1.2.2 as of 2022-06-03 see `Changelog`_ +Version v2.1.3 as of 2023-07-21 see `Changelog`_ -|build_badge| |license| |pypi| |pypi-downloads| |black| - -|codecov| |better_code| |cc_maintain| |cc_issues| |cc_coverage| |snyk| +|build_badge| |codeql| |license| |pypi| +|pypi-downloads| |black| |codecov| |cc_maintain| |cc_issues| |cc_coverage| |snyk| @@ -14,6 +13,9 @@ Version v2.1.2.2 as of 2022-06-03 see `Changelog`_ :target: https://github.com/bitranox/rst_include/actions/workflows/python-package.yml +.. |codeql| image:: https://github.com/bitranox/rst_include/actions/workflows/codeql-analysis.yml/badge.svg?event=push + :target: https://github.com//bitranox/rst_include/actions/workflows/codeql-analysis.yml + .. |license| image:: https://img.shields.io/github/license/webcomics/pywine.svg :target: http://en.wikipedia.org/wiki/MIT_License @@ -27,9 +29,6 @@ Version v2.1.2.2 as of 2022-06-03 see `Changelog`_ .. |codecov| image:: https://img.shields.io/codecov/c/github/bitranox/rst_include :target: https://codecov.io/gh/bitranox/rst_include -.. |better_code| image:: https://bettercodehub.com/edge/badge/bitranox/rst_include?branch=master - :target: https://bettercodehub.com/results/bitranox/rst_include - .. |cc_maintain| image:: https://img.shields.io/codeclimate/maintainability-percentage/bitranox/rst_include?label=CC%20maintainability :target: https://codeclimate.com/github/bitranox/rst_include/maintainability :alt: Maintainability @@ -42,7 +41,7 @@ Version v2.1.2.2 as of 2022-06-03 see `Changelog`_ :target: https://codeclimate.com/github/bitranox/rst_include/test_coverage :alt: Code Coverage -.. |snyk| image:: https://img.shields.io/snyk/vulnerabilities/github/bitranox/rst_include +.. |snyk| image:: https://snyk.io/test/github/bitranox/rst_include/badge.svg :target: https://snyk.io/test/github/bitranox/rst_include .. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg @@ -71,14 +70,14 @@ This has many advantages like : ---- -automated tests, Travis Matrix, Documentation, Badges, etc. are managed with `PizzaCutter `_ (cookiecutter on steroids) -Python version required: 3.6.0 or newer +Python version required: 3.8.0 or newer -tested on recent linux with python 3.6, 3.7, 3.8, 3.9, 3.10, pypy-3.8 - architectures: amd64 +tested on recent linux with python 3.8, 3.9, 3.10, 3.11, 3.12-dev, pypy-3.9, pypy-3.10 - architectures: amd64 -`100% code coverage `_, flake8 style checking ,mypy static type checking ,tested under `Linux, macOS, Windows `_, automatic daily builds and monitoring +`100% code coverage `_, flake8 style checking ,mypy static type checking ,tested under `Linux, macOS, Windows `_, automatic daily builds and monitoring ---- @@ -391,6 +390,13 @@ Installation and Upgrade python -m pip install --upgrade rst_include + +- to install the latest release from PyPi via pip, including test dependencies: + +.. code-block:: + + python -m pip install --upgrade rst_include[test] + - to install the latest version from github via pip: @@ -414,14 +420,14 @@ Installation and Upgrade python -m pip install --upgrade -r //requirements.txt -- to install the latest development version from source code: +- to install the latest development version, including test dependencies from source code: .. code-block:: # cd ~ $ git clone https://github.com/bitranox/rst_include.git $ cd rst_include - python setup.py install + python -m pip install -e .[test] - via makefile: makefiles are a very convenient way to install. Here we can do much more, @@ -483,6 +489,26 @@ Changelog - new MINOR version for added functionality in a backwards compatible manner - new PATCH version for backwards compatible bug fixes +v2.1.3 +-------- +2023-07-21: + - require minimum python 3.8 + - remove python 3.7 tests + - introduce PEP517 packaging standard + - introduce pyproject.toml build-system + - remove mypy.ini + - remove pytest.ini + - remove setup.cfg + - remove setup.py + - remove .bettercodehub.yml + - remove .travis.yml + - update black config + - clean ./tests/test_cli.py + - add codeql badge + - move 3rd_party_stubs outside the src directory to ``./.3rd_party_stubs`` + - add pypy 3.10 tests + - add python 3.12-dev tests + v2.1.2.2 -------- 2022-06-02: setup github actions v3, python3.10 test matrix diff --git a/pyproject.toml b/pyproject.toml index a594d1d..4082b1c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,89 @@ +[build-system] +requires = ['setuptools', 'setuptools-scm'] +build-backend = "setuptools.build_meta" + +[project] +# see: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html +name = "rst_include" +authors = [ + {name = "Robert Nowotny", email = "bitranox@gmail.com"}, +] +description = "commandline tool to resolve RST File includes" +readme = "README.rst" +requires-python = ">=3.8.0" +keywords = [ +] +license = {text = "MIT"} +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Topic :: Software Development :: Libraries :: Python Modules", +] +# dependencies - former setup.cfg "install_requires" +# see: https://setuptools.pypa.io/en/latest/userguide/dependency_management.html +dependencies = [ + "cli_exit_tools", + "click", + "lib_list", + "lib_log_utils", + "pathlib3x", +] +version = "v2.1.3" +# seems to be not allowed anymore +# zip-save = false + +[project.urls] +Homepage = "https://github.com/bitranox/rst_include" +Documentation = "https://github.com/bitranox/rst_include/blob/master/README.rst" +Repository = "https://github.com/bitranox/rst_include.git" +Changelog = "https://github.com/bitranox/rst_include/blob/master/CHANGES.rst" + +[project.optional-dependencies] +test = [ + "black", + "codecov", + "coloredlogs", + "coverage", + "flake8", + "mypy", + "pytest", + "pytest-cov", + "pytest-runner", + "readme_renderer", +] + +[project.scripts] + rst_include = "rst_include.rst_include_cli:cli_main" + +[tool.setuptools.package-data] +rst_include = [ + "*.pyi", + "__init__.pyi", + "py.typed", +] [tool.black] line-length = 160 -target-version = ['py36'] +#You should include all Python versions that you want your code to run under +target-version = ['py37', 'py38', 'py39', 'py310', 'py311'] # Note that you have to use single-quoted strings in TOML for regular expressions include = '\.pyi?$' exclude = '/(\.eggs|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|_build|buck-out|build|dist)/' + +[tool.mypy] +verbosity=0 +warn_unused_configs = true +ignore_missing_imports = true +no_implicit_optional = true +no_strict_optional = true +show_error_context = true + +[tool.pytest.ini_options] +addopts = "-vvl --doctest-modules" +doctest_optionflags = "NORMALIZE_WHITESPACE ELLIPSIS ALLOW_UNICODE ALLOW_BYTES IGNORE_EXCEPTION_DETAIL" +log_cli = true +log_cli_level = "CRITICAL" diff --git a/requirements_test.txt b/requirements_test.txt index 3c8b4bc..8325f6c 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,13 +1,13 @@ ## Test Requirements ## following Requirements will be installed temporarily for ## "setup.py install test" or "pip install --install-option test" -black ; platform_python_implementation != "PyPy" -black==19.3b0 ; platform_python_implementation == "PyPy" +black codecov coloredlogs coverage flake8 -mypy ; platform_python_implementation != "PyPy" +mypy pytest pytest-cov pytest-runner +readme_renderer diff --git a/rst_include/__init__conf__.py b/rst_include/__init__conf__.py index 3448fd5..91bd3ee 100644 --- a/rst_include/__init__conf__.py +++ b/rst_include/__init__conf__.py @@ -1,24 +1,22 @@ # CONF -name = "rst_include" -title = "commandline tool to resolve RST File includes" -version = "v2.1.2.2" -url = "https://github.com/bitranox/rst_include" -author = "Robert Nowotny" -author_email = "bitranox@gmail.com" -shell_command = "rst_include" +name = 'rst_include' +title = 'commandline tool to resolve RST File includes' +version = 'v2.1.3' +url = 'https://github.com/bitranox/rst_include' +author = 'Robert Nowotny' +author_email = 'bitranox@gmail.com' +shell_command = 'rst_include' def print_info() -> None: - print( - """\ + print("""\ Info for rst_include: commandline tool to resolve RST File includes - Version : v2.1.2.2 + Version : v2.1.3 Url : https://github.com/bitranox/rst_include Author : Robert Nowotny - Email : bitranox@gmail.com""" - ) + Email : bitranox@gmail.com""") diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 1b70e11..0000000 --- a/setup.cfg +++ /dev/null @@ -1,22 +0,0 @@ -[flake8] -max_line_length = 160 -ignore = E123, E203, E402, F401, F403, F405, W503 -exclude = .git, __pycache__, build, dist, .eggs, .hg, .mypy_cache, .nox, .tox, .venv, _build, buck-out -max-complexity = 20 - -[mypy] -verbosity=0 -warn_unused_configs = True -ignore_missing_imports = True -no_implicit_optional = True -no_strict_optional = True -show_error_context = True - -[tool:pytest] -addopts = -vvl --doctest-modules -doctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS ALLOW_UNICODE ALLOW_BYTES IGNORE_EXCEPTION_DETAIL -log_cli = True -log_cli_level = CRITICAL - -[aliases] -test=pytest diff --git a/setup.py b/setup.py deleted file mode 100644 index 0d3d1ac..0000000 --- a/setup.py +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/env python3 - -import codecs -import os -import pathlib -from typing import Any, List, Dict - -from setuptools import setup # type: ignore -from setuptools import find_packages - - -def is_travis_deploy() -> bool: - if os.getenv("DEPLOY_SDIST", "") or os.getenv("DEPLOY_WHEEL", ""): - return is_tagged_commit() - else: - return False - - -def is_tagged_commit() -> bool: - if "TRAVIS_TAG" in os.environ: - if os.environ["TRAVIS_TAG"]: - return True - return False - - -def strip_links_from_required(l_required: List[str]) -> List[str]: - """ - >>> required = ['lib_regexp @ git+https://github.com/bitranox/lib_regexp.git', 'test'] - >>> assert strip_links_from_required(required) == ['lib_regexp', 'test'] - - """ - l_req_stripped: List[str] = list() - for req in l_required: - req_stripped = req.split("@")[0].strip() - l_req_stripped.append(req_stripped) - return l_req_stripped - - -# will be overwritten with long_description if exists ! -long_description = "commandline tool to resolve RST File includes" -path_readme = pathlib.Path(__file__).parent / "README.rst" - -if path_readme.exists(): - # noinspection PyBroadException - try: - readme_content = codecs.open(str(path_readme), encoding="utf-8").read() - long_description = readme_content - except Exception: - pass - - -def get_requirements_from_file(requirements_filename: str) -> List[str]: - """ - >>> assert len(get_requirements_from_file('requirements.txt')) > 0 - """ - l_requirements = list() - try: - with open(str(pathlib.Path(__file__).parent / requirements_filename), mode="r") as requirements_file: - for line in requirements_file: - line_data = get_line_data(line) - if line_data: - l_requirements.append(line_data) - except FileNotFoundError: - pass - return l_requirements - - -def get_line_data(line: str) -> str: - line = line.strip() - if "#" in line: - line = line.split("#", 1)[0].strip() - return line - - -tests_require = get_requirements_from_file("requirements_test.txt") -install_requires = get_requirements_from_file("requirements.txt") -setup_requires = list(set(tests_require + install_requires)) - -# for deploy on pypi we must not rely on imports from github -if is_travis_deploy() and is_tagged_commit(): - setup_requires = strip_links_from_required(setup_requires) - tests_require = strip_links_from_required(tests_require) - install_requires = strip_links_from_required(install_requires) - -setup_kwargs: Dict[str, Any] = dict() -setup_kwargs["name"] = "rst_include" -setup_kwargs["version"] = "v2.1.2.2" -setup_kwargs["url"] = "https://github.com/bitranox/rst_include" -setup_kwargs["packages"] = find_packages() -setup_kwargs["package_data"] = {"rst_include": ["py.typed", "*.pyi", "__init__.pyi"]} -setup_kwargs["description"] = "commandline tool to resolve RST File includes" -setup_kwargs["long_description"] = long_description -setup_kwargs["long_description_content_type"] = "text/x-rst" -setup_kwargs["author"] = "Robert Nowotny" -setup_kwargs["author_email"] = "bitranox@gmail.com" -setup_kwargs["classifiers"] = [ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Natural Language :: English", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Topic :: Software Development :: Libraries :: Python Modules", -] -setup_kwargs["entry_points"] = {"console_scripts": ["rst_include = rst_include.rst_include_cli:cli_main"]} -# minimally needs to run tests - no project requirements here -setup_kwargs["tests_require"] = tests_require -# specify what a project minimally needs to run correctly -setup_kwargs["install_requires"] = install_requires -# minimally needs to run the setup script, dependencies needs also to put here for "setup.py install test" -# dependencies must not be put here for pip install -setup_kwargs["setup_requires"] = setup_requires -setup_kwargs["python_requires"] = ">=3.6.0" -setup_kwargs["zip_safe"] = False - - -if __name__ == "__main__": - setup(**setup_kwargs) diff --git a/tests/local_testscripts/lib_bash_functions.sh b/tests/local_testscripts/lib_bash_functions.sh index 0119486..e43742f 100644 --- a/tests/local_testscripts/lib_bash_functions.sh +++ b/tests/local_testscripts/lib_bash_functions.sh @@ -63,6 +63,7 @@ function clean_caches() { } function install_virtualenv_debian() { + # installs the debian python3-virtualenv package if ! is_package_installed python3-virtualenv; then banner "python3-virtualenv is not installed, I will install it for You" wait_for_enter @@ -75,15 +76,16 @@ function install_test_requirements() { clr_green "installing/updating pip, setuptools, wheel" sudo chmod -R 0777 ~/.eggs # make already installed eggs accessible, just in case they were installed as root - python3 -m pip install --upgrade pip - python3 -m pip install --upgrade setuptools - python3 -m pip install --upgrade wheel + /opt/python3/bin/python3 -m pip install --upgrade pip + /opt/python3/bin/python3 -m pip install --upgrade setuptools + /opt/python3/bin/python3 -m pip install --upgrade wheel # this we need for local testscripts - python3 -m pip install --upgrade click + /opt/python3/bin/python3 -m pip install --upgrade click + /opt/python3/bin/python3 -m pip install --upgrade black if test -f "${project_root_dir}/requirements_test.txt"; then clr_green "installing/updating test requirements from \"requirements_test.txt\"" - python3 -m pip install --upgrade -r "${project_root_dir}/requirements_test.txt" + /opt/python3/bin/python3 -m pip install --upgrade -r "${project_root_dir}/requirements_test.txt" else clr_red "requirements_test.txt not found" fi @@ -103,6 +105,8 @@ function install_clean_virtual_environment() { clr_green "installing venv" delete_virtual_environment virtualenv ~/venv + sudo chmod -R 0777 ~/venv + sudo chmod -R 0777 /usr/local/lib/python3.*/dist-packages } @@ -110,6 +114,8 @@ function cleanup() { trap '' 2 # disable Ctrl+C delete_virtual_environment clean_caches + # delete the link to commandline interface + rm -f /usr/local/bin/rst_include cd "${save_dir}" || exit trap 2 # enable Ctrl+C } @@ -118,7 +124,7 @@ function cleanup() { function run_black() { # run black for *.py files my_banner "running black with settings from ${project_root_dir}/pyproject.toml" - if ! python3 -m black "${project_root_dir}"/**/*.py; then + if ! /opt/python3/bin/python3 -m black "${project_root_dir}"/**/*.py; then my_banner_warning "black ERROR" beep sleep "${sleeptime_on_error}" @@ -130,7 +136,7 @@ function run_black() { function run_flake8_tests() { # run flake8, settings from setup.cfg my_banner "running flake8 with settings from ${project_root_dir}/setup.cfg" - if ! python3 -m flake8 --append-config="${project_root_dir}/setup.cfg" "$@" "${project_root_dir}"; then + if ! /opt/python3/bin/python3 -m flake8 --append-config="${project_root_dir}/setup.cfg" "$@" "${project_root_dir}"; then my_banner_warning "flake8 ERROR" beep sleep "${sleeptime_on_error}" @@ -141,7 +147,7 @@ function run_flake8_tests() { function run_mypy_tests() { my_banner "mypy tests" - if ! python3 -m mypy "${project_root_dir}" --follow-imports=normal --ignore-missing-imports --implicit-reexport --install-types --no-warn-unused-ignores --non-interactive --strict; then + if ! /opt/python3/bin/python3 -m mypy "${project_root_dir}" --follow-imports=normal --ignore-missing-imports --implicit-reexport --install-types --no-warn-unused-ignores --non-interactive --strict; then my_banner_warning "mypy tests ERROR" beep sleep "${sleeptime_on_error}" @@ -153,7 +159,7 @@ function run_mypy_tests() { function run_pytest() { # run pytest, accepts additional pytest parameters like --disable-warnings and so on my_banner "running pytest with settings from pytest.ini, mypy.ini and conftest.py" - if ! python3 -m pytest "${project_root_dir}" "$@" --cov="${project_root_dir}" --cov-config=.coveragerc; then + if ! /opt/python3/bin/python3 -m pytest "${project_root_dir}" "$@" --cov="${project_root_dir}" --cov-config=.coveragerc; then my_banner_warning "pytest ERROR" beep sleep "${sleeptime_on_error}" @@ -162,11 +168,26 @@ function run_pytest() { } -function install_pip_requirements_venv() { +function run_pytest_venv() { + # run pytest, accepts additional pytest parameters like --disable-warnings and so on + my_banner "running pytest with settings from pytest.ini, mypy.ini and conftest.py" + if ! ~/venv/local/bin/python3 -m pytest "${project_root_dir}" "$@" --cov="${project_root_dir}" --cov-config=.coveragerc; then + my_banner_warning "pytest ERROR" + beep + sleep "${sleeptime_on_error}" + return 1 + fi +} + + +# todo wip delete me +function install_pip_requirements_venv_old() { + # install the requirements in the virtual environment if test -f "${project_root_dir}/requirements.txt on virtual environment"; then + my_banner_warning "install_pip_requirements_venv is deprecated - setup_install_venv installiert requirements ohnehin" my_banner "pip install -r requirements.txt" install_clean_virtual_environment - if ! ~/venv/bin/python3 -m pip install -r "${project_root_dir}/requirements.txt"; then + if ! ~/venv/local/bin/python3 -m pip install -r "${project_root_dir}/requirements.txt"; then my_banner_warning "pip install -r requirements.txt ERROR" beep sleep "${sleeptime_on_error}" @@ -177,12 +198,12 @@ function install_pip_requirements_venv() { function setup_install_venv() { - if test -f "${project_root_dir}/setup.py"; then - my_banner "setup.py install on virtual environment" + if test -f "${project_root_dir}/pyproject.toml"; then + my_banner "install via pip and pyproject.toml on virtual environment" install_clean_virtual_environment cd "${project_root_dir}" || exit - if ! ~/venv/bin/python3 "${project_root_dir}/setup.py" install; then - my_banner_warning "setup.py install ERROR" + if ! ~/venv/local/bin/python3 -m pip install -e ".[test]"; then + my_banner_warning "pip install [test] ERROR" beep sleep "${sleeptime_on_error}" return 1 @@ -191,12 +212,14 @@ function setup_install_venv() { } -function setup_test_venv() { +# todo wip delete me +function setup_test_venv_old() { if test -f "${project_root_dir}/setup.py"; then + my_banner_warning "setup_test_venv is deprecated - benutze run_pytest_venv" my_banner "setup.py test on virtual environment" install_clean_virtual_environment cd "${project_root_dir}" || exit - if ! ~/venv/bin/python3 "${project_root_dir}/setup.py" test; then + if ! ~/venv/local/bin/python3 "${project_root_dir}/setup.py" test; then my_banner_warning "setup.py test ERROR" beep sleep "${sleeptime_on_error}" @@ -207,11 +230,10 @@ function setup_test_venv() { function test_commandline_interface_venv() { - # this will fail if rotek lib directory is in the path - keep this as a reminder my_banner "test commandline interface on virtual environment" - clr_green "issuing command : $HOME/venv/bin/rst_include --version" - if ! "$HOME/venv/bin/rst_include" --version; then + clr_green "issuing command : /usr/local/bin/rst_include --version" + if ! "/usr/local/bin/rst_include" --version; then my_banner_warning "test commandline interface on virtual environment ERROR" beep sleep "${sleeptime_on_error}" @@ -220,12 +242,26 @@ function test_commandline_interface_venv() { } -function test_setup_test_venv() { +function test_commandline_interface_venv_old() { + # this will fail if rotek lib directory is in the path - keep this as a reminder + my_banner "test commandline interface on virtual environment" + + clr_green "issuing command : $HOME/venv/local/bin/rst_include --version" + if ! "$HOME/venv/local/bin/rst_include" --version; then + my_banner_warning "test commandline interface on virtual environment ERROR" + beep + sleep "${sleeptime_on_error}" + return 1 + fi +} + +# todo wip delete me +function test_setup_test_venv_old() { if test -f "${project_root_dir}/setup.py"; then my_banner "setup.py test" install_clean_virtual_environment cd "${project_root_dir}" || exit - if ! ~/venv/bin/python3 "${project_root_dir}/setup.py" test; then + if ! ~/venv/local/bin/python3 "${project_root_dir}/setup.py" test; then my_banner_warning "setup.py test ERROR" beep sleep "${sleeptime_on_error}" diff --git a/tests/local_testscripts/run_testloop.sh b/tests/local_testscripts/run_testloop.sh index e91087c..2d5e515 100644 --- a/tests/local_testscripts/run_testloop.sh +++ b/tests/local_testscripts/run_testloop.sh @@ -17,7 +17,7 @@ DO_BLACK="True" # cleanup on cntrl-c trap cleanup EXIT -# install dependencies +# install dependencies which needed on local python, like venv install_dependencies function pytest_loop { diff --git a/travis_secrets/create_secrets.sh b/travis_secrets/create_secrets.sh deleted file mode 100644 index e9222c0..0000000 --- a/travis_secrets/create_secrets.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -save_dir="$PWD" -own_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" || exit && pwd -P)" # this gives the full path, even for sourced scripts - -# shellcheck disable=SC1090 -source "${own_dir}/create_secrets_bash_helpers.sh" - -project_root_dir="${project_root_dir}" - -install_dependencies - -banner "this will encrypt the name and the value of a secret environment variable for travis. -common secrets for the PizzaCutter Python Template are: -\"CC_TEST_REPORTER_ID\" and \"PYPI_PASSWORD\"" - -read -rp 'variable name :' var_name -read -rp 'variable value :' var_value - -cd "${project_root_dir}"||exit -travis encrypt "${var_name}=${var_value}" --no-interactive --com > "${own_dir}/secrets/${var_name}.secret.txt" - -banner "the secret for \"${var_name}\" was created and exported to: -${own_dir}/secrets/${var_name}.secret.txt. -it will be imported to travis.yml the next time You run PizzaCutter" -wait_for_enter -cd "${save_dir}" || exit diff --git a/travis_secrets/create_secrets_bash_helpers.sh b/travis_secrets/create_secrets_bash_helpers.sh deleted file mode 100644 index a03ea33..0000000 --- a/travis_secrets/create_secrets_bash_helpers.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash -save_dir="$PWD" -# this gives the full path, even for sourced scripts -dir_own="$(cd "$(dirname "${BASH_SOURCE[0]}")" || exit && pwd -P)" - -sudo_askpass="$(command -v ssh-askpass)" -export SUDO_ASKPASS="${sudo_askpass}" -# get rid of (ssh-askpass:25930): dbind-WARNING **: 18:46:12.019: Couldn't register with accessibility bus: Did not receive a reply. -export NO_AT_BRIDGE=1 - -dir_travis_secrets="${dir_own}" -# one level up -project_root_dir="$(dirname "${dir_travis_secrets}")" - -# CONSTANTS -True=0 -False=1 - -function install_or_update_lib_bash() { - if [[ ! -f /usr/local/lib_bash/install_or_update.sh ]]; then - sudo git clone https://github.com/bitranox/lib_bash.git /usr/local/lib_bash 2>/dev/null - sudo chmod -R 0755 /usr/local/lib_bash 2>/dev/null - sudo chmod -R +x /usr/local/lib_bash/*.sh 2>/dev/null - sudo /usr/local/lib_bash/install_or_update.sh 2>/dev/null - else - /usr/local/lib_bash/install_or_update.sh - fi -} - -install_or_update_lib_bash - -source /usr/local/lib_bash/lib_helpers.sh - -function my_banner() { - banner "${project_root_dir}: ${1}" -} - -function my_banner_warning() { - banner_warning "${project_root_dir}: ${1}" -} - -function purge_linux_package_ruby() { - # purges ruby and all ruby gems - sudo apt-get purge ruby -y - sudo apt-get purge ruby-dev -y - sudo rm -rf /usr/share/rubygems-integration - sudo rm -rf /var/lib/gems - sudo rm -rf /usr/bin/gems - sudo rm -rf /usr/share/ri -} - - -function is_travis_gem_installed() { - if [[ $(sudo gem list | grep -c travis) == 0 ]]; then - return $False - else - return $True - fi -} - - -function install_travis_gem() { - sudo gem install travis -} - - -function check_install_travis_gem() { - if ! is_travis_gem_installed ; then - banner "Ruby Travis Gem is not installed, I will install it for You" - wait_for_enter - install_travis_gem - fi -} - - -function check_install_ruby_dev() { - if ! is_package_installed ruby-dev; then - banner "Linux Package ruby-dev is not installed, I will install it for You" - wait_for_enter - install_package_if_not_present ruby-dev - fi -} - -function install_dependencies() { - clr_green "installing dependencies" - check_install_ruby_dev - check_install_travis_gem -} - -cd "${save_dir}"||exit diff --git a/travis_secrets/secrets/CC_TEST_REPORTER_ID.secret.txt b/travis_secrets/secrets/CC_TEST_REPORTER_ID.secret.txt deleted file mode 100644 index 39deb50..0000000 --- a/travis_secrets/secrets/CC_TEST_REPORTER_ID.secret.txt +++ /dev/null @@ -1 +0,0 @@ -"Qe9oava9KsQAqDpYwKl3s51ZZTj6j1aZw+vrSJYz8GXanGGGVfoe1FLDjm9TyQTMDkiQd4HF0zKAbUGfgR3DKpfg17BgWZn9r8qt4WE4GclO0h3cXnqp7F3DmZqIBDyZfOgXalng51/g02G78rCeugA7jZ+pPFEzkPkmuhWrsalnsVKUpxxmsaBWCP8jftUTXbnuu7xB6RZPmd8Vz9eYbEwujES1cAo/Yz79crJfBIw3jYkU8GYGEVt9QojBTZXieD6WN6wexRzLRChzn32SDfhT6NQVKOqjNBItRXqJd8luwLbon6k63lyvA5VNNgA70Roa4SpsDwxmqeGLone2Y5WXXKcZgIxQcMVzxJMDYGNEtGX5rGuwOU1Fn6JM1LBC9AW79y1dusyAJJHumPa0f5FknIiUvIdJ5sz/emS/tuoSKtf12vSeXvQskZ2m/Fe5HWSym+qeOuNHqvmOcN+s2aiNFMTQWWxuhyN5o96AeDvn6eF8fpbQqTD1nSwzlZ13BZzB8FtokCU1ASxhqL9e0H6fXOWg8MjXFzgYYW5R6nx31CGOCSWUPWxX5Y2NfdJi9PCMZLOPMbWw0jOO6P3Fw2TuCxQGuAfSWuxMrWHFfrQpfG3eoaYYluzUKA9z2rAy7O9l7tu9dSSfl6IEmLi/dLnBKEIerNKNQpN1xWd8lAQ=" diff --git a/travis_secrets/secrets/PYPI_PASSWORD.secret.txt b/travis_secrets/secrets/PYPI_PASSWORD.secret.txt deleted file mode 100644 index 681ae44..0000000 --- a/travis_secrets/secrets/PYPI_PASSWORD.secret.txt +++ /dev/null @@ -1 +0,0 @@ -"DrfW5T9mXVPBREpmvqHm/lGeNINRXo7aCFXiW5RVGoyFR2GsdZuF8GQQX9SFBGm46bgQ9cuCQErEkwxxa5nBIXbfEIpn4TMDZ/JSbS7zWk4WT6VSuRXl2ibiKfZP53mR/+AAdJvoSY72JlDr6q1p/M9AMj816n5mvanDmebUQNiUHIksuRZR3I2RBAHj3aWb1AOYSg6WIMZernacamSnY4KCodYL5FXxjASHuyxP2vtU+tgrLmUxRtFX5zvPFAMv/0372cS/QSizwnuYbX2MU8UFuxsrBZISGuUtehItJ7/aYjhFzYN8CKad90OFqQNwQ+Tbd828vxq3kbKByVrZqbh5eJGDGBfZobFxOyEXIqfNcwVrVE5XDVbY6+BTu+YMXCJe/scHL6nxkKM8vs32LgofHo4RChY9HG8IHPzN2hgwohivBCnmzh4MpArfOXpAVXhhpioFcvKpaigiX35c1+Z4S3tdz6ERyzCox+tVAlZs5gUgNsU+ZVUbquHSRSo3+e+fAfc7NqZs+VjzIApUbxGHYn2GMSACuIwQLKOrNsWlAvJZ0BalstVyDEXESRjDwx0Z45WP88MjXUFVJIfFHMJzu0OtGPFY3QGIZIgxiZMei3/D0c8dU0gyMLZuwJZGHCkchTKTo6ZgdsNGnf+e3x3J0VyXHTENT0GuyYhKN88=" diff --git a/travis_secrets/shellcheck.sh b/travis_secrets/shellcheck.sh deleted file mode 100644 index 24bac1f..0000000 --- a/travis_secrets/shellcheck.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# test the shellscripts in the current directory - -save_dir="$PWD" - -# install bash helper scripts -function install_or_update_lib_bash() { - if [[ ! -f /usr/local/lib_bash/install_or_update.sh ]]; then - sudo git clone https://github.com/bitranox/lib_bash.git /usr/local/lib_bash 2>/dev/null - sudo chmod -R 0755 /usr/local/lib_bash 2>/dev/null - sudo chmod -R +x /usr/local/lib_bash/*.sh 2>/dev/null - sudo /usr/local/lib_bash/install_or_update.sh 2>/dev/null - else - /usr/local/lib_bash/install_or_update.sh - fi -} - -install_or_update_lib_bash - -source /usr/local/lib_bash/lib_helpers.sh - - -function check_shellcheck_installed { - # check if shellcheck is installed, otherwise install it - if ! is_package_installed shellcheck; then - banner "shellcheck is not installed, I will install it for You" - wait_for_enter - install_package_if_not_present shellcheck - fi -} - - -function shell_check { - banner "checking shellscripts" - # exclude Codes : - # SC1091 not following external sources -> so we dont check /usr/local/lib_bash/lib_helpers.sh - if shellcheck --shell=bash --color=always \ - --exclude=SC1091 \ - ./*.sh \ - ; then - banner "finished shellcheck without errors" - else - banner_warning "finished shellcheck, some errors occured, check the output" - fi - -} - -check_shellcheck_installed -shell_check -cd "${save_dir}"||exit