diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index e36d5cc1..c717ce13 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -44,7 +44,7 @@ If possible, please include a small, self-contained reproduction. * domdf_python_tools: ## Installation source - + ## Other Additional Information: diff --git a/.github/actions_build_conda.sh b/.github/actions_build_conda.sh index 4983f899..01676e9f 100755 --- a/.github/actions_build_conda.sh +++ b/.github/actions_build_conda.sh @@ -3,7 +3,7 @@ set -e -x -python -m mkrecipe || exit 1 +python -m mkrecipe --type wheel || exit 1 # Switch to miniconda source "/home/runner/miniconda/etc/profile.d/conda.sh" diff --git a/.github/workflows/conda_ci.yml b/.github/workflows/conda_ci.yml index 7b4cef1f..ec5b69ca 100644 --- a/.github/workflows/conda_ci.yml +++ b/.github/workflows/conda_ci.yml @@ -6,6 +6,9 @@ on: push: branches: ["master"] +permissions: + contents: read + jobs: tests: name: "Conda" diff --git a/.github/workflows/docs_test_action.yml b/.github/workflows/docs_test_action.yml index 43c27755..77fa347d 100644 --- a/.github/workflows/docs_test_action.yml +++ b/.github/workflows/docs_test_action.yml @@ -4,15 +4,29 @@ name: "Docs Check" on: - push +permissions: + contents: read + jobs: docs: runs-on: ubuntu-latest steps: - name: Checkout πŸ›ŽοΈ uses: "actions/checkout@v1" + + - name: Check for changed files + uses: dorny/paths-filter@v2 + id: changes + with: + list-files: "json" + filters: | + code: + - '!tests/**' + - name: Install and Build πŸ”§ - uses: ammaraskar/sphinx-action@master + uses: sphinx-toolbox/sphinx-action@sphinx-3.3.1 + if: steps.changes.outputs.code == 'true' with: - pre-build-command: apt-get update && apt-get install gcc python3-dev git pandoc -y && python -m pip install tox + pre-build-command: python -m pip install tox docs-folder: "doc-source/" build-command: "tox -e docs -- -W " diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 29303d6c..742dfdd7 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -5,6 +5,9 @@ name: Flake8 on: push: +permissions: + contents: read + jobs: Run: name: "Flake8" @@ -14,12 +17,23 @@ jobs: - name: Checkout πŸ›ŽοΈ uses: "actions/checkout@v2" + - name: Check for changed files + uses: dorny/paths-filter@v2 + id: changes + with: + list-files: "json" + filters: | + code: + - '!(doc-source/**|CONTRIBUTING.rst|.imgbotconfig|.pre-commit-config.yaml|.pylintrc|.readthedocs.yml)' + - name: Setup Python 🐍 + if: steps.changes.outputs.code == 'true' uses: "actions/setup-python@v2" with: - python-version: "3.8" + python-version: "3.6" - name: Install dependencies πŸ”§ + if: steps.changes.outputs.code == 'true' run: | python -VV python -m site @@ -27,4 +41,5 @@ jobs: python -m pip install tox - name: "Run Flake8" + if: steps.changes.outputs.code == 'true' run: "python -m tox -e lint -- --format github" diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index e10cf9ba..43f22f72 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -5,6 +5,9 @@ name: mypy on: push: +permissions: + contents: read + jobs: Run: name: "mypy / ${{ matrix.os }}" @@ -19,7 +22,17 @@ jobs: - name: Checkout πŸ›ŽοΈ uses: "actions/checkout@v2" + - name: Check for changed files + uses: dorny/paths-filter@v2 + id: changes + with: + list-files: "json" + filters: | + code: + - '!(doc-source/**|CONTRIBUTING.rst|.imgbotconfig|.pre-commit-config.yaml|.pylintrc|.readthedocs.yml)' + - name: Setup Python 🐍 + if: steps.changes.outputs.code == 'true' uses: "actions/setup-python@v2" with: python-version: "3.6" @@ -32,4 +45,5 @@ jobs: python -m pip install --upgrade tox virtualenv - name: "Run mypy" + if: steps.changes.outputs.code == 'true' run: "python -m tox -e mypy" diff --git a/.github/workflows/python_ci.yml b/.github/workflows/python_ci.yml index 24a29946..e035de81 100644 --- a/.github/workflows/python_ci.yml +++ b/.github/workflows/python_ci.yml @@ -5,13 +5,17 @@ name: Windows on: push: +permissions: + actions: write + contents: read + jobs: tests: name: "windows-2019 / Python ${{ matrix.config.python-version }}" runs-on: "windows-2019" continue-on-error: ${{ matrix.config.experimental }} env: - USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10.0-alpha.7,pypy-3.6,pypy-3.7' + USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10.0-beta.1,pypy-3.6,pypy-3.7' strategy: fail-fast: False @@ -21,7 +25,7 @@ jobs: - {python-version: "3.7", testenvs: "py37,build", experimental: False} - {python-version: "3.8", testenvs: "py38,build", experimental: False} - {python-version: "3.9", testenvs: "py39,build", experimental: False} - - {python-version: "3.10.0-alpha.7", testenvs: "py310-dev,build", experimental: True} + - {python-version: "3.10.0-beta.1", testenvs: "py310-dev,build", experimental: True} - {python-version: "pypy-3.6", testenvs: "pypy36,build", experimental: False} - {python-version: "pypy-3.7", testenvs: "pypy37,build", experimental: True} @@ -29,12 +33,25 @@ jobs: - name: Checkout πŸ›ŽοΈ uses: "actions/checkout@v2" + - name: Check for changed files + if: startsWith(github.ref, 'refs/tags/') != true + uses: dorny/paths-filter@v2 + id: changes + with: + list-files: "json" + filters: | + code: + - '!(doc-source/**|CONTRIBUTING.rst|.imgbotconfig|.pre-commit-config.yaml|.pylintrc|.readthedocs.yml)' + - name: Setup Python 🐍 + id: setup-python + if: ${{ steps.changes.outputs.code == 'true' || steps.changes.outcome == 'skipped' }} uses: "actions/setup-python@v2" with: python-version: "${{ matrix.config.python-version }}" - name: Install dependencies πŸ”§ + if: steps.setup-python.outcome == 'success' run: | python -VV python -m site @@ -42,11 +59,12 @@ jobs: python -m pip install --upgrade tox virtualenv - name: "Run Tests for Python ${{ matrix.config.python-version }}" + if: steps.setup-python.outcome == 'success' run: python -m tox -e "${{ matrix.config.testenvs }}" - name: "Upload Coverage πŸš€" uses: actions/upload-artifact@v2 - if: ${{ always() }} + if: ${{ always() && steps.setup-python.outcome == 'success' }} with: name: "coverage-${{ matrix.config.python-version }}" path: .coverage diff --git a/.github/workflows/python_ci_linux.yml b/.github/workflows/python_ci_linux.yml index b2c541e0..d5177b22 100644 --- a/.github/workflows/python_ci_linux.yml +++ b/.github/workflows/python_ci_linux.yml @@ -5,13 +5,17 @@ name: Linux on: push: +permissions: + actions: write + contents: read + jobs: tests: name: "ubuntu-20.04 / Python ${{ matrix.config.python-version }}" runs-on: "ubuntu-20.04" continue-on-error: ${{ matrix.config.experimental }} env: - USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10.0-alpha.7,pypy-3.6,pypy-3.7' + USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10.0-beta.1,pypy-3.6,pypy-3.7' strategy: fail-fast: False @@ -21,7 +25,7 @@ jobs: - {python-version: "3.7", testenvs: "py37,build", experimental: False} - {python-version: "3.8", testenvs: "py38,build", experimental: False} - {python-version: "3.9", testenvs: "py39,build", experimental: False} - - {python-version: "3.10.0-alpha.7", testenvs: "py310-dev,build", experimental: True} + - {python-version: "3.10.0-beta.1", testenvs: "py310-dev,build", experimental: True} - {python-version: "pypy-3.6", testenvs: "pypy36,build", experimental: False} - {python-version: "pypy-3.7", testenvs: "pypy37,build", experimental: True} @@ -29,12 +33,25 @@ jobs: - name: Checkout πŸ›ŽοΈ uses: "actions/checkout@v2" + - name: Check for changed files + if: startsWith(github.ref, 'refs/tags/') != true + uses: dorny/paths-filter@v2 + id: changes + with: + list-files: "json" + filters: | + code: + - '!(doc-source/**|CONTRIBUTING.rst|.imgbotconfig|.pre-commit-config.yaml|.pylintrc|.readthedocs.yml)' + - name: Setup Python 🐍 + id: setup-python + if: ${{ steps.changes.outputs.code == 'true' || steps.changes.outcome == 'skipped' }} uses: "actions/setup-python@v2" with: python-version: "${{ matrix.config.python-version }}" - name: Install dependencies πŸ”§ + if: steps.setup-python.outcome == 'success' run: | python -VV python -m site @@ -43,11 +60,12 @@ jobs: python -m pip install --upgrade coverage_pyver_pragma - name: "Run Tests for Python ${{ matrix.config.python-version }}" + if: steps.setup-python.outcome == 'success' run: python -m tox -e "${{ matrix.config.testenvs }}" - name: "Upload Coverage πŸš€" uses: actions/upload-artifact@v2 - if: ${{ always() }} + if: ${{ always() && steps.setup-python.outcome == 'success' }} with: name: "coverage-${{ matrix.config.python-version }}" path: .coverage diff --git a/.github/workflows/python_ci_macos.yml b/.github/workflows/python_ci_macos.yml index d80399f4..68f5d34a 100644 --- a/.github/workflows/python_ci_macos.yml +++ b/.github/workflows/python_ci_macos.yml @@ -5,13 +5,17 @@ name: macOS on: push: +permissions: + actions: write + contents: read + jobs: tests: name: "macos-latest / Python ${{ matrix.config.python-version }}" runs-on: "macos-latest" continue-on-error: ${{ matrix.config.experimental }} env: - USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10.0-alpha.7,pypy-3.6,pypy-3.7' + USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10.0-beta.1,pypy-3.6,pypy-3.7' strategy: fail-fast: False @@ -21,7 +25,7 @@ jobs: - {python-version: "3.7", testenvs: "py37,build", experimental: False} - {python-version: "3.8", testenvs: "py38,build", experimental: False} - {python-version: "3.9", testenvs: "py39,build", experimental: False} - - {python-version: "3.10.0-alpha.7", testenvs: "py310-dev,build", experimental: True} + - {python-version: "3.10.0-beta.1", testenvs: "py310-dev,build", experimental: True} - {python-version: "pypy-3.6", testenvs: "pypy36,build", experimental: False} - {python-version: "pypy-3.7", testenvs: "pypy37,build", experimental: True} @@ -29,12 +33,25 @@ jobs: - name: Checkout πŸ›ŽοΈ uses: "actions/checkout@v2" + - name: Check for changed files + if: startsWith(github.ref, 'refs/tags/') != true + uses: dorny/paths-filter@v2 + id: changes + with: + list-files: "json" + filters: | + code: + - '!(doc-source/**|CONTRIBUTING.rst|.imgbotconfig|.pre-commit-config.yaml|.pylintrc|.readthedocs.yml)' + - name: Setup Python 🐍 + id: setup-python + if: ${{ steps.changes.outputs.code == 'true' || steps.changes.outcome == 'skipped' }} uses: "actions/setup-python@v2" with: python-version: "${{ matrix.config.python-version }}" - name: Install dependencies πŸ”§ + if: steps.setup-python.outcome == 'success' run: | python -VV python -m site @@ -42,11 +59,12 @@ jobs: python -m pip install --upgrade tox virtualenv - name: "Run Tests for Python ${{ matrix.config.python-version }}" + if: steps.setup-python.outcome == 'success' run: python -m tox -e "${{ matrix.config.testenvs }}" - name: "Upload Coverage πŸš€" uses: actions/upload-artifact@v2 - if: ${{ always() }} + if: ${{ always() && steps.setup-python.outcome == 'success' }} with: name: "coverage-${{ matrix.config.python-version }}" path: .coverage diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3ed72965..bc883899 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -62,7 +62,7 @@ repos: - --keep-runtime-typing - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.1.9 + rev: v1.1.10 hooks: - id: remove-crlf - id: forbid-crlf diff --git a/doc-source/conf.py b/doc-source/conf.py index 2275fbb0..110b4ef9 100644 --- a/doc-source/conf.py +++ b/doc-source/conf.py @@ -17,88 +17,12 @@ sys.path.append('.') -config = SphinxConfig() - -github_username = "domdfcoding" -github_repository = "domdf_python_tools" -author = "Dominic Davis-Foster" -project = "domdf-python-tools" -copyright = "2019-2021 Dominic Davis-Foster" -language = "en" -package_root = "domdf_python_tools" -extensions = [ - "sphinx_toolbox", - "sphinx_toolbox.more_autodoc", - "sphinx_toolbox.more_autosummary", - "sphinx_toolbox.documentation_summary", - "sphinx_toolbox.tweaks.param_dash", - "sphinx_toolbox.tweaks.latex_toc", - "sphinx.ext.intersphinx", - "sphinx.ext.mathjax", - "sphinxcontrib.httpdomain", - "sphinxcontrib.extras_require", - "sphinx.ext.todo", - "sphinxemoji.sphinxemoji", - "notfound.extension", - "sphinx_copybutton", - "sphinxcontrib.default_values", - "sphinxcontrib.toctree_plus", - "sphinx_debuginfo", - "seed_intersphinx_mapping", - "sphinx_autofixture", - "sphinx_highlights", - ] -sphinxemoji_style = "twemoji" -gitstamp_fmt = "%d %b %Y" -templates_path = ["_templates"] -html_static_path = ["_static"] -source_suffix = ".rst" -master_doc = "index" -suppress_warnings = ["image.nonlocal_uri"] -pygments_style = "default" -html_theme = "domdf_sphinx_theme" -html_theme_path = ["../.."] -html_show_sourcelink = True -toctree_plus_types = [ - "class", - "confval", - "data", - "directive", - "enum", - "exception", - "flag", - "function", - "method", - "namedtuple", - "protocol", - "role", - "typeddict", - ] -add_module_names = False -hide_none_rtype = True -all_typevars = True -overloads_location = "bottom" -documentation_summary = "Helpful functions for Pythonβ€‚πŸβ€‚πŸ› οΈ" -autodoc_exclude_members = [ - "__dict__", - "__class__", - "__dir__", - "__weakref__", - "__module__", - "__annotations__", - "__orig_bases__", - "__parameters__", - "__subclasshook__", - "__init_subclass__", - "__attrs_attrs__", - "__init__", - "__new__", - "__getnewargs__", - "__abstractmethods__", - "__hash__", - ] - -github_url = f"https://github.com/%7Bgithub_username%7D/%7Bgithub_repository%7D" +config = SphinxConfig(globalns=globals()) +project = config["project"] +author = config["author"] +documentation_summary = config.description + +github_url = "https://github.com/%7Bgithub_username%7D/%7Bgithub_repository%7D".format_map(config) rst_prolog = f""".. |pkgname| replace:: domdf_python_tools .. |pkgname2| replace:: ``domdf_python_tools`` @@ -134,14 +58,18 @@ man_pages = [("index", slug, project, [author], 1)] texinfo_documents = [("index", slug, project, author, slug, project, "Miscellaneous")] -toctree_plus_types = set(toctree_plus_types) +toctree_plus_types = set(config["toctree_plus_types"]) autodoc_default_options = { "members": None, # Include all members (methods). "special-members": None, "autosummary": None, "show-inheritance": None, - "exclude-members": ','.join(autodoc_exclude_members), + "exclude-members": ','.join(config["autodoc_exclude_members"]), + } + +latex_elements = { + "fncychap": "\\usepackage[Bjarne]{fncychap}\n\\ChNameAsIs\n\\ChTitleAsIs\n", } manpages_url = "https://manpages.debian.org/%7Bpath%7D" diff --git a/pyproject.toml b/pyproject.toml index dd214fdc..60e2b0f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,3 +33,82 @@ all = [ "pytz>=2019.1",] conda-channels = [ "conda-forge", "domdfcoding",] extras = [ "dates",] license-key = "MIT" + +[tool.sphinx-pyproject] +github_username = "domdfcoding" +github_repository = "domdf_python_tools" +author = "Dominic Davis-Foster" +project = "domdf-python-tools" +copyright = "2019-2021 Dominic Davis-Foster" +language = "en" +package_root = "domdf_python_tools" +extensions = [ + "sphinx_toolbox", + "sphinx_toolbox.more_autodoc", + "sphinx_toolbox.more_autosummary", + "sphinx_toolbox.documentation_summary", + "sphinx_toolbox.tweaks.param_dash", + "sphinx_toolbox.tweaks.latex_toc", + "sphinx.ext.intersphinx", + "sphinx.ext.mathjax", + "sphinxcontrib.httpdomain", + "sphinxcontrib.extras_require", + "sphinx.ext.todo", + "sphinxemoji.sphinxemoji", + "notfound.extension", + "sphinx_copybutton", + "sphinxcontrib.default_values", + "sphinxcontrib.toctree_plus", + "sphinx_debuginfo", + "seed_intersphinx_mapping", + "sphinx_autofixture", + "sphinx_highlights", +] +sphinxemoji_style = "twemoji" +gitstamp_fmt = "%d %b %Y" +templates_path = [ "_templates",] +html_static_path = [ "_static",] +source_suffix = ".rst" +master_doc = "index" +suppress_warnings = [ "image.nonlocal_uri",] +pygments_style = "default" +html_theme = "domdf_sphinx_theme" +html_theme_path = [ "../..",] +html_show_sourcelink = true +toctree_plus_types = [ + "class", + "confval", + "data", + "directive", + "enum", + "exception", + "flag", + "function", + "method", + "namedtuple", + "protocol", + "role", + "typeddict", +] +add_module_names = false +hide_none_rtype = true +all_typevars = true +overloads_location = "bottom" +autodoc_exclude_members = [ + "__dict__", + "__class__", + "__dir__", + "__weakref__", + "__module__", + "__annotations__", + "__orig_bases__", + "__parameters__", + "__subclasshook__", + "__init_subclass__", + "__attrs_attrs__", + "__init__", + "__new__", + "__getnewargs__", + "__abstractmethods__", + "__hash__", +]