From 746bfef18c5ea19a52d40654d5894faa96e2b47f Mon Sep 17 00:00:00 2001 From: "repo-helper[bot]" <74742576+repo-helper[bot]@users.noreply.github.com> Date: Tue, 29 Jun 2021 21:09:35 +0100 Subject: [PATCH] Updated files with 'repo_helper'. (#30) Co-authored-by: repo-helper[bot] <74742576+repo-helper[bot]@users.noreply.github.com> --- .bumpversion.cfg | 11 ++ .github/ISSUE_TEMPLATE/bug_report.md | 7 +- .github/actions_build_conda.sh | 2 +- .github/stale.yml | 2 +- .github/workflows/conda_ci.yml | 29 ++- .github/workflows/docs_test_action.yml | 19 +- .github/workflows/flake8.yml | 21 ++- .github/workflows/mypy.yml | 20 ++- .github/workflows/python_ci.yml | 30 +++- .github/workflows/python_ci_linux.yml | 35 ++-- .github/workflows/python_ci_macos.yml | 30 +++- .pre-commit-config.yaml | 15 +- .readthedocs.yml | 4 +- README.rst | 10 +- __pkginfo__.py | 14 +- doc-source/Source.rst | 25 +-- doc-source/conf.py | 112 +++--------- doc-source/index.rst | 234 +++++++++++++------------ doc-source/requirements.txt | 3 +- formate.toml | 1 + pyproject.toml | 112 +++++++++--- setup.cfg | 1 + setup.py | 4 + tests/requirements.txt | 5 +- tox.ini | 27 +-- 25 files changed, 455 insertions(+), 318 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index a5641e8..9899a60 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -7,6 +7,9 @@ tag = True [bumpversion:file:cawdrey/__init__.py] +search = : str = "{current_version}" +replace = : str = "{new_version}" + [bumpversion:file:README.rst] [bumpversion:file:doc-source/index.rst] @@ -14,3 +17,11 @@ tag = True [bumpversion:file:repo_helper.yml] [bumpversion:file:pyproject.toml] +search = version = "{current_version}" +replace = version = "{new_version}" + +[bumpversion:file:.github/workflows/conda_ci.yml] + +[bumpversion:file:setup.cfg] +search = version = {current_version} +replace = version = {new_version} diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index a2ba8f7..f25d834 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -17,7 +17,10 @@ THE ISSUE WILL BE CLOSED IF INSUFFICIENT INFORMATION IS PROVIDED. ## Steps to Reproduce - + 1. 2. @@ -41,7 +44,7 @@ THE ISSUE WILL BE CLOSED IF INSUFFICIENT INFORMATION IS PROVIDED. * Cawdrey: ## Installation source - + ## Other Additional Information: diff --git a/.github/actions_build_conda.sh b/.github/actions_build_conda.sh index 1acebbe..01676e9 100755 --- a/.github/actions_build_conda.sh +++ b/.github/actions_build_conda.sh @@ -3,7 +3,7 @@ set -e -x -python -m repo_helper make-recipe || 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/stale.yml b/.github/stale.yml index bb7ca3f..e5625b7 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -28,7 +28,7 @@ exemptMilestones: false exemptAssignees: false # Label to use when marking as stale -staleLabel: wontfix +staleLabel: stale # Comment to post when marking as stale. Set to `false` to disable markComment: > diff --git a/.github/workflows/conda_ci.yml b/.github/workflows/conda_ci.yml index cbb09ee..334a7c3 100644 --- a/.github/workflows/conda_ci.yml +++ b/.github/workflows/conda_ci.yml @@ -4,9 +4,11 @@ name: Conda Tests on: push: - pull_request: branches: ["master"] +permissions: + contents: read + jobs: tests: name: "Conda" @@ -26,7 +28,7 @@ jobs: python -VV python -m site python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade repo_helper + python -m pip install --upgrade whey-conda # $CONDA is an environment variable pointing to the root of the miniconda directory $CONDA/bin/conda update -q conda $CONDA/bin/conda install conda-build=3.21.0 @@ -34,11 +36,22 @@ jobs: $CONDA/bin/conda config --add channels conda-forge $CONDA/bin/conda config --add channels domdfcoding - - name: "Build and install package" + - name: "Build and index channel" run: | - # This mess is only necessary because conda won't fix it themselves - # https://github.com/conda/conda/issues/1884 - - python -m repo_helper build --conda --out-dir conda-bld/noarch + python -m whey --builder whey_conda --out-dir conda-bld/noarch $CONDA/bin/conda index ./conda-bld || exit 1 - $CONDA/bin/conda install -c file://$(pwd)/conda-bld cawdrey -y || exit 1 + + - name: "Search for package" + run: | + $CONDA/bin/conda search -c file://$(pwd)/conda-bld cawdrey + $CONDA/bin/conda search -c file://$(pwd)/conda-bld --override-channels cawdrey + + - name: "Install package" + run: | + $CONDA/bin/conda install -c file://$(pwd)/conda-bld cawdrey=0.4.2=py_1 -y || exit 1 + + - name: "Run Tests" + run: | + rm -rf cawdrey + $CONDA/bin/pip install -r tests/requirements.txt + $CONDA/bin/pytest tests/ diff --git a/.github/workflows/docs_test_action.yml b/.github/workflows/docs_test_action.yml index 39cdf97..77fa347 100644 --- a/.github/workflows/docs_test_action.yml +++ b/.github/workflows/docs_test_action.yml @@ -2,18 +2,31 @@ --- name: "Docs Check" on: - - pull_request - 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 177294b..116e13f 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -4,8 +4,9 @@ name: Flake8 on: push: - pull_request: - branches: ["master"] + +permissions: + contents: read jobs: Run: @@ -16,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 @@ -29,4 +41,5 @@ jobs: python -m pip install tox - name: "Run Flake8" - run: "python -m tox -e lint -- --format github" + if: steps.changes.outputs.code == 'true' + run: "python -m tox -e lint -s false -- --format github" diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index afee01e..5fb5285 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -4,8 +4,9 @@ name: mypy on: push: - pull_request: - branches: ["master"] + +permissions: + contents: read jobs: Run: @@ -14,14 +15,24 @@ jobs: strategy: matrix: - os: ['windows-2019', 'macos-latest', 'ubuntu-20.04'] + os: ['ubuntu-20.04', 'windows-2019'] fail-fast: false steps: - 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" @@ -34,4 +45,5 @@ jobs: python -m pip install --upgrade tox virtualenv - name: "Run mypy" - run: "python -m tox -e mypy" + if: steps.changes.outputs.code == 'true' + run: "python -m tox -e mypy -s false" diff --git a/.github/workflows/python_ci.yml b/.github/workflows/python_ci.yml index 054b63f..1573c49 100644 --- a/.github/workflows/python_ci.yml +++ b/.github/workflows/python_ci.yml @@ -4,8 +4,10 @@ name: Windows on: push: - pull_request: - branches: ["master"] + +permissions: + actions: write + contents: read jobs: tests: @@ -13,7 +15,7 @@ jobs: 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.5,pypy-3.6,pypy-3.7' + USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10.0-beta.3,pypy-3.6,pypy-3.7' strategy: fail-fast: False @@ -23,20 +25,33 @@ 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.5", testenvs: "py310-dev,build", experimental: True} + - {python-version: "3.10.0-beta.3", 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: False} + - {python-version: "pypy-3.7", testenvs: "pypy37,build", experimental: True} steps: - 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 @@ -44,11 +59,12 @@ jobs: python -m pip install --upgrade tox virtualenv - name: "Run Tests for Python ${{ matrix.config.python-version }}" - run: python -m tox -e "${{ matrix.config.testenvs }}" + if: steps.setup-python.outcome == 'success' + run: python -m tox -e "${{ matrix.config.testenvs }}" -s false - 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 bd1ed02..26f41c1 100644 --- a/.github/workflows/python_ci_linux.yml +++ b/.github/workflows/python_ci_linux.yml @@ -4,8 +4,10 @@ name: Linux on: push: - pull_request: - branches: ["master"] + +permissions: + actions: write + contents: read jobs: tests: @@ -13,7 +15,7 @@ jobs: 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.5,pypy-3.6,pypy-3.7' + USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10.0-beta.3,pypy-3.6,pypy-3.7' strategy: fail-fast: False @@ -23,20 +25,33 @@ 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.5", testenvs: "py310-dev,build", experimental: True} + - {python-version: "3.10.0-beta.3", 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: False} + - {python-version: "pypy-3.7", testenvs: "pypy37,build", experimental: True} steps: - 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 @@ -45,11 +60,12 @@ jobs: python -m pip install --upgrade coverage_pyver_pragma - name: "Run Tests for Python ${{ matrix.config.python-version }}" - run: python -m tox -e "${{ matrix.config.testenvs }}" + if: steps.setup-python.outcome == 'success' + run: python -m tox -e "${{ matrix.config.testenvs }}" -s false - 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 @@ -127,14 +143,13 @@ jobs: - name: Upload distribution to PyPI 🚀 if: startsWith(github.ref, 'refs/tags/') - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@v1.4.2 with: user: __token__ password: ${{ secrets.PYPI_TOKEN }} skip_existing: true - Conda: needs: deploy runs-on: "ubuntu-20.04" @@ -151,7 +166,7 @@ jobs: - name: Install dependencies 🔧 run: | python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade repo_helper + python -m pip install --upgrade mkrecipe wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh bash miniconda.sh -b -p $HOME/miniconda diff --git a/.github/workflows/python_ci_macos.yml b/.github/workflows/python_ci_macos.yml index 0d0c451..13f04ad 100644 --- a/.github/workflows/python_ci_macos.yml +++ b/.github/workflows/python_ci_macos.yml @@ -4,8 +4,10 @@ name: macOS on: push: - pull_request: - branches: ["master"] + +permissions: + actions: write + contents: read jobs: tests: @@ -13,7 +15,7 @@ jobs: 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.5,pypy-3.6,pypy-3.7' + USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10.0-beta.3,pypy-3.6,pypy-3.7' strategy: fail-fast: False @@ -23,20 +25,33 @@ 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.5", testenvs: "py310-dev,build", experimental: True} + - {python-version: "3.10.0-beta.3", 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: False} + - {python-version: "pypy-3.7", testenvs: "pypy37,build", experimental: True} steps: - 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 @@ -44,11 +59,12 @@ jobs: python -m pip install --upgrade tox virtualenv - name: "Run Tests for Python ${{ matrix.config.python-version }}" - run: python -m tox -e "${{ matrix.config.testenvs }}" + if: steps.setup-python.outcome == 'success' + run: python -m tox -e "${{ matrix.config.testenvs }}" -s false - 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 7fbaff9..36ef847 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,6 +4,11 @@ exclude: ^$ repos: + - repo: https://github.com/repo-helper/pyproject-parser + rev: v0.3.0 + hooks: + - id: reformat-pyproject + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v3.4.0 hooks: @@ -31,7 +36,7 @@ repos: args: - --allow-git - id: check-docstring-first - exclude: ^(doc-source/conf|__pkginfo__|make_conda_recipe|setup|tests/.*)\.py$ + exclude: ^(doc-source/conf|__pkginfo__|setup|tests/.*)\.py$ - id: bind-requirements - repo: https://github.com/domdfcoding/flake8-dunder-all @@ -41,7 +46,7 @@ repos: files: ^cawdrey/.*\.py$ - repo: https://github.com/domdfcoding/flake2lint - rev: v0.4.0 + rev: v0.4.1 hooks: - id: flake2lint @@ -62,16 +67,16 @@ 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 - repo: https://github.com/repo-helper/formate - rev: v0.4.3 + rev: v0.4.7 hooks: - id: formate - exclude: ^(doc-source/conf|__pkginfo__|make_conda_recipe|setup)\.(_)?py$ + exclude: ^(doc-source/conf|__pkginfo__|setup)\.(_)?py$ - repo: https://github.com/domdfcoding/dep_checker rev: v0.6.2 diff --git a/.readthedocs.yml b/.readthedocs.yml index ce3f99b..41d2e57 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -5,7 +5,9 @@ version: 2 sphinx: builder: html configuration: doc-source/conf.py -formats: all +formats: + - pdf + - htmlzip python: version: 3.8 install: diff --git a/README.rst b/README.rst index 05147a6..c71dd46 100644 --- a/README.rst +++ b/README.rst @@ -25,7 +25,7 @@ Cawdrey * - Activity - |commits-latest| |commits-since| |maintained| |pypi-downloads| * - QA - - |codefactor| |actions_flake8| |actions_mypy| |pre_commit_ci| + - |codefactor| |actions_flake8| |actions_mypy| * - Other - |license| |language| |requires| @@ -115,10 +115,6 @@ Cawdrey :target: https://pypi.org/project/cawdrey/ :alt: PyPI - Downloads -.. |pre_commit_ci| image:: https://results.pre-commit.ci/badge/github/domdfcoding/cawdrey/master.svg - :target: https://results.pre-commit.ci/latest/github/domdfcoding/cawdrey/master - :alt: pre-commit.ci status - .. end shields Contents @@ -186,8 +182,8 @@ To install with ``conda``: .. code-block:: bash - $ conda config --add channels http://conda.anaconda.org/conda-forge - $ conda config --add channels http://conda.anaconda.org/domdfcoding + $ conda config --add channels https://conda.anaconda.org/conda-forge + $ conda config --add channels https://conda.anaconda.org/domdfcoding * Then install diff --git a/__pkginfo__.py b/__pkginfo__.py index 6edc838..d9a700d 100644 --- a/__pkginfo__.py +++ b/__pkginfo__.py @@ -11,22 +11,10 @@ # This script based on https://github.com/rocky/python-uncompyle6/blob/master/__pkginfo__.py # -# stdlib -import pathlib - __all__ = [ - "__copyright__", "__version__", - "repo_root", - "install_requires", "extras_require", ] -__copyright__ = """ -2019-2021 Dominic Davis-Foster -""" - __version__ = "0.4.2" -repo_root = pathlib.Path(__file__).parent -install_requires = (repo_root / "requirements.txt").read_text(encoding="utf-8").split('\n') -extras_require = {"all": []} +extras_require = {} diff --git a/doc-source/Source.rst b/doc-source/Source.rst index 956b9b4..e0be9ec 100644 --- a/doc-source/Source.rst +++ b/doc-source/Source.rst @@ -7,24 +7,27 @@ and can be accessed from the following URL: https://github.com/domdfcoding/cawdr If you have ``git`` installed, you can clone the repository with the following command: -.. code-block:: bash +.. prompt:: bash + + git clone https://github.com/domdfcoding/cawdrey + +.. parsed-literal:: - $ git clone https://github.com/domdfcoding/cawdrey" - > Cloning into 'cawdrey'... - > remote: Enumerating objects: 47, done. - > remote: Counting objects: 100% (47/47), done. - > remote: Compressing objects: 100% (41/41), done. - > remote: Total 173 (delta 16), reused 17 (delta 6), pack-reused 126 - > Receiving objects: 100% (173/173), 126.56 KiB | 678.00 KiB/s, done. - > Resolving deltas: 100% (66/66), done. + Cloning into 'cawdrey'... + remote: Enumerating objects: 47, done. + remote: Counting objects: 100% (47/47), done. + remote: Compressing objects: 100% (41/41), done. + remote: Total 173 (delta 16), reused 17 (delta 6), pack-reused 126 + Receiving objects: 100% (173/173), 126.56 KiB | 678.00 KiB/s, done. + Resolving deltas: 100% (66/66), done. | Alternatively, the code can be downloaded in a 'zip' file by clicking: | :guilabel:`Clone or download` --> :guilabel:`Download Zip` .. figure:: git_download.png - :alt: Downloading a 'zip' file of the source code. + :alt: Downloading a 'zip' file of the source code. - Downloading a 'zip' file of the source code + Downloading a 'zip' file of the source code Building from source diff --git a/doc-source/conf.py b/doc-source/conf.py index 0b7968a..3b6ec90 100644 --- a/doc-source/conf.py +++ b/doc-source/conf.py @@ -7,68 +7,34 @@ import re import sys -sys.path.append(os.path.abspath('.')) -sys.path.append(os.path.abspath("..")) +# 3rd party +from sphinx_pyproject import SphinxConfig -# this package -from __pkginfo__ import __version__ +sys.path.append('.') -github_username = "domdfcoding" -github_repository = "cawdrey" -github_url = f"https://github.com/{github_username}/{github_repository}" +config = SphinxConfig(globalns=globals()) +project = config["project"] +author = config["author"] +documentation_summary = config.description + +github_url = "https://github.com/{github_username}/{github_repository}".format_map(config) rst_prolog = f""".. |pkgname| replace:: Cawdrey .. |pkgname2| replace:: ``Cawdrey`` .. |browse_github| replace:: `Browse the GitHub Repository <{github_url}>`__ """ -author = "Dominic Davis-Foster" -project = "Cawdrey" slug = re.sub(r'\W+', '-', project.lower()) -release = version = __version__ -copyright = "2019-2021 Dominic Davis-Foster" # pylint: disable=redefined-builtin -language = "en" -package_root = "cawdrey" - -extensions = [ - "sphinx_toolbox", - "sphinx_toolbox.more_autodoc", - "sphinx_toolbox.more_autosummary", - "sphinx_toolbox.tweaks.param_dash", - "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", - ] - -sphinxemoji_style = "twemoji" -todo_include_todos = bool(os.environ.get("SHOW_TODOS", 0)) -gitstamp_fmt = "%d %b %Y" +release = version = config.version -templates_path = ["_templates"] -html_static_path = ["_static"] -source_suffix = ".rst" -master_doc = "index" -suppress_warnings = ["image.nonlocal_uri"] -pygments_style = "default" +todo_include_todos = bool(os.environ.get("SHOW_TODOS", 0)) intersphinx_mapping = { "python": ("https://docs.python.org/3/", None), "sphinx": ("https://www.sphinx-doc.org/en/stable/", None), } -html_theme = "domdf_sphinx_theme" html_theme_options = {"logo_only": False} -html_theme_path = ["../.."] -html_show_sourcelink = True # True will show link to source html_context = { "display_github": True, @@ -83,53 +49,27 @@ man_pages = [("index", slug, project, [author], 1)] texinfo_documents = [("index", slug, project, author, slug, project, "Miscellaneous")] -toctree_plus_types = { - "class", - "function", - "method", - "data", - "enum", - "flag", - "confval", - "directive", - "role", - "confval", - "protocol", - "typeddict", - "namedtuple", - "exception", - } +toctree_plus_types = set(config["toctree_plus_types"]) -add_module_names = False -hide_none_rtype = True -all_typevars = True -overloads_location = "bottom" - - -autodoc_exclude_members = [ # Exclude "standard" methods. - "__dict__", - "__class__", - "__dir__", - "__weakref__", - "__module__", - "__annotations__", - "__orig_bases__", - "__parameters__", - "__subclasshook__", - "__init_subclass__", - "__attrs_attrs__", - "__init__", - "__new__", - "__getnewargs__", - "__abstractmethods__", - "__hash__", - ] 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 = { + "printindex": "\\begin{flushleft}\n\\printindex\n\\end{flushleft}", + "tableofcontents": "\\pdfbookmark[0]{\\contentsname}{toc}\\sphinxtableofcontents", } + +def setup(app): + # 3rd party + from sphinx_toolbox.latex import better_header_layout + + app.connect("config-inited", lambda app, config: better_header_layout(config)) + + html_logo = "../cawdrey.png" diff --git a/doc-source/index.rst b/doc-source/index.rst index bbda4ae..a63fc23 100644 --- a/doc-source/index.rst +++ b/doc-source/index.rst @@ -4,121 +4,121 @@ Cawdrey .. start short_desc -**Several useful custom dictionaries for Python 📖 🐍** +.. documentation-summary:: + :meta: .. end short_desc .. start shields -.. list-table:: - :stub-columns: 1 - :widths: 10 90 - - * - Docs - - |docs| |docs_check| - * - Tests - - |actions_linux| |actions_windows| |actions_macos| |coveralls| - * - PyPI - - |pypi-version| |supported-versions| |supported-implementations| |wheel| - * - Anaconda - - |conda-version| |conda-platform| - * - Activity - - |commits-latest| |commits-since| |maintained| |pypi-downloads| - * - QA - - |codefactor| |actions_flake8| |actions_mypy| |pre_commit_ci| - * - Other - - |license| |language| |requires| - -.. |docs| rtfd-shield:: - :project: cawdrey - :alt: Documentation Build Status - -.. |docs_check| actions-shield:: - :workflow: Docs Check - :alt: Docs Check Status - -.. |actions_linux| actions-shield:: - :workflow: Linux - :alt: Linux Test Status - -.. |actions_windows| actions-shield:: - :workflow: Windows - :alt: Windows Test Status - -.. |actions_macos| actions-shield:: - :workflow: macOS - :alt: macOS Test Status - -.. |actions_flake8| actions-shield:: - :workflow: Flake8 - :alt: Flake8 Status - -.. |actions_mypy| actions-shield:: - :workflow: mypy - :alt: mypy status - -.. |requires| requires-io-shield:: - :alt: Requirements Status - -.. |coveralls| coveralls-shield:: - :alt: Coverage - -.. |codefactor| codefactor-shield:: - :alt: CodeFactor Grade - -.. |pypi-version| pypi-shield:: - :project: cawdrey - :version: - :alt: PyPI - Package Version - -.. |supported-versions| pypi-shield:: - :project: cawdrey - :py-versions: - :alt: PyPI - Supported Python Versions - -.. |supported-implementations| pypi-shield:: - :project: cawdrey - :implementations: - :alt: PyPI - Supported Implementations - -.. |wheel| pypi-shield:: - :project: cawdrey - :wheel: - :alt: PyPI - Wheel - -.. |conda-version| image:: https://img.shields.io/conda/v/domdfcoding/cawdrey?logo=anaconda - :target: https://anaconda.org/domdfcoding/cawdrey - :alt: Conda - Package Version - -.. |conda-platform| image:: https://img.shields.io/conda/pn/domdfcoding/cawdrey?label=conda%7Cplatform - :target: https://anaconda.org/domdfcoding/cawdrey - :alt: Conda - Platform - -.. |license| github-shield:: - :license: - :alt: License - -.. |language| github-shield:: - :top-language: - :alt: GitHub top language - -.. |commits-since| github-shield:: - :commits-since: v0.4.2 - :alt: GitHub commits since tagged version - -.. |commits-latest| github-shield:: - :last-commit: - :alt: GitHub last commit - -.. |maintained| maintained-shield:: 2021 - :alt: Maintenance - -.. |pypi-downloads| pypi-shield:: - :project: cawdrey - :downloads: month - :alt: PyPI - Downloads - -.. |pre_commit_ci| pre-commit-ci-shield:: - :alt: pre-commit.ci status +.. only:: html + + .. list-table:: + :stub-columns: 1 + :widths: 10 90 + + * - Docs + - |docs| |docs_check| + * - Tests + - |actions_linux| |actions_windows| |actions_macos| |coveralls| + * - PyPI + - |pypi-version| |supported-versions| |supported-implementations| |wheel| + * - Anaconda + - |conda-version| |conda-platform| + * - Activity + - |commits-latest| |commits-since| |maintained| |pypi-downloads| + * - QA + - |codefactor| |actions_flake8| |actions_mypy| + * - Other + - |license| |language| |requires| + + .. |docs| rtfd-shield:: + :project: cawdrey + :alt: Documentation Build Status + + .. |docs_check| actions-shield:: + :workflow: Docs Check + :alt: Docs Check Status + + .. |actions_linux| actions-shield:: + :workflow: Linux + :alt: Linux Test Status + + .. |actions_windows| actions-shield:: + :workflow: Windows + :alt: Windows Test Status + + .. |actions_macos| actions-shield:: + :workflow: macOS + :alt: macOS Test Status + + .. |actions_flake8| actions-shield:: + :workflow: Flake8 + :alt: Flake8 Status + + .. |actions_mypy| actions-shield:: + :workflow: mypy + :alt: mypy status + + .. |requires| requires-io-shield:: + :alt: Requirements Status + + .. |coveralls| coveralls-shield:: + :alt: Coverage + + .. |codefactor| codefactor-shield:: + :alt: CodeFactor Grade + + .. |pypi-version| pypi-shield:: + :project: cawdrey + :version: + :alt: PyPI - Package Version + + .. |supported-versions| pypi-shield:: + :project: cawdrey + :py-versions: + :alt: PyPI - Supported Python Versions + + .. |supported-implementations| pypi-shield:: + :project: cawdrey + :implementations: + :alt: PyPI - Supported Implementations + + .. |wheel| pypi-shield:: + :project: cawdrey + :wheel: + :alt: PyPI - Wheel + + .. |conda-version| image:: https://img.shields.io/conda/v/domdfcoding/cawdrey?logo=anaconda + :target: https://anaconda.org/domdfcoding/cawdrey + :alt: Conda - Package Version + + .. |conda-platform| image:: https://img.shields.io/conda/pn/domdfcoding/cawdrey?label=conda%7Cplatform + :target: https://anaconda.org/domdfcoding/cawdrey + :alt: Conda - Platform + + .. |license| github-shield:: + :license: + :alt: License + + .. |language| github-shield:: + :top-language: + :alt: GitHub top language + + .. |commits-since| github-shield:: + :commits-since: v0.4.2 + :alt: GitHub commits since tagged version + + .. |commits-latest| github-shield:: + :last-commit: + :alt: GitHub last commit + + .. |maintained| maintained-shield:: 2021 + :alt: Maintenance + + .. |pypi-downloads| pypi-shield:: + :project: cawdrey + :downloads: month + :alt: PyPI - Downloads .. end shields @@ -212,11 +212,19 @@ Installation contributing Source +.. sidebar-links:: + :caption: Links + :github: + :pypi: cawdrey + + .. start links -View the :ref:`Function Index ` or browse the `Source Code <_modules/index.html>`__. +.. only:: html + + View the :ref:`Function Index ` or browse the `Source Code <_modules/index.html>`__. -`Browse the GitHub Repository `__ + :github:repo:`Browse the GitHub Repository ` .. end links diff --git a/doc-source/requirements.txt b/doc-source/requirements.txt index cec36d2..dc72b4e 100644 --- a/doc-source/requirements.txt +++ b/doc-source/requirements.txt @@ -11,8 +11,9 @@ sphinx-copybutton>=0.2.12 sphinx-debuginfo>=0.1.0 sphinx-notfound-page>=0.5 sphinx-prompt>=1.1.0 +sphinx-pyproject>=0.1.0 sphinx-tabs>=1.1.13 -sphinx-toolbox>=1.8.3 +sphinx-toolbox>=2.10.0 sphinxcontrib-httpdomain>=1.7.0 sphinxemoji>=0.1.6 tabulate>=0.8.7 diff --git a/formate.toml b/formate.toml index b56eceb..f16ba34 100644 --- a/formate.toml +++ b/formate.toml @@ -38,6 +38,7 @@ known_third_party = [ "domdf_python_tools", "github", "immutables", + "importlib_metadata", "pytest", "pytest_cov", "pytest_randomly", diff --git a/pyproject.toml b/pyproject.toml index a9b62e7..68bb056 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,25 +5,27 @@ build-backend = "setuptools.build_meta" [project] name = "cawdrey" version = "0.4.2" -description = "Several useful custom dictionaries for Python 📖\u2002🐍" +description = "Several useful custom dictionaries for Python 📖 🐍" readme = "README.rst" keywords = [ - "frozenordereddict", - "orderedfrozendict", - "frozen", - "immutable", - "frozendict", + "Counter", + "Mapping", + "MappingProxyType", "dict", "dictionary", + "frozen", + "frozendict", + "frozenordereddict", + "immutable", "map", - "Mapping", - "MappingProxyType", - "Counter", + "orderedfrozendict", ] dynamic = [ "requires-python", "classifiers", "dependencies",] + [[project.authors]] -email = "dominic@davis-foster.co.uk" name = "Dominic Davis-Foster" +email = "dominic@davis-foster.co.uk" + [project.license] file = "LICENSE" @@ -34,15 +36,83 @@ Homepage = "https://github.com/domdfcoding/cawdrey" "Source Code" = "https://github.com/domdfcoding/cawdrey" Documentation = "https://cawdrey.readthedocs.io/en/latest" -[tool.whey] -base-classifiers = [ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Topic :: Software Development :: Libraries :: Python Modules", - "Topic :: Utilities", - "Typing :: Typed", -] -python-versions = [ "3.6", "3.7", "3.8", "3.9",] -python-implementations = [ "CPython", "PyPy",] -platforms = [ "Windows", "macOS", "Linux",] +[tool.mkrecipe] +conda-channels = [ "conda-forge", "domdfcoding",] +extras = "all" license-key = "LGPL-3.0-or-later" + +[tool.sphinx-pyproject] +github_username = "domdfcoding" +github_repository = "cawdrey" +author = "Dominic Davis-Foster" +project = "Cawdrey" +copyright = "2019-2021 Dominic Davis-Foster" +language = "en" +package_root = "cawdrey" +extensions = [ + "sphinx_toolbox", + "sphinx_toolbox.more_autodoc", + "sphinx_toolbox.more_autosummary", + "sphinx_toolbox.documentation_summary", + "sphinx_toolbox.tweaks.param_dash", + "sphinx_toolbox.tweaks.latex_layout", + "sphinx_toolbox.tweaks.latex_toc", + "sphinx.ext.intersphinx", + "sphinx.ext.mathjax", + "sphinxcontrib.extras_require", + "sphinx.ext.todo", + "sphinxemoji.sphinxemoji", + "notfound.extension", + "sphinx_copybutton", + "sphinxcontrib.default_values", + "sphinxcontrib.toctree_plus", + "sphinx_debuginfo", + "seed_intersphinx_mapping", +] +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", + "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__", +] diff --git a/setup.cfg b/setup.cfg index 2e147b4..2536c7f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -8,6 +8,7 @@ [metadata] name = cawdrey +version = 0.4.2 author = Dominic Davis-Foster author_email = dominic@davis-foster.co.uk license = GNU Lesser General Public License v3 or later (LGPLv3+) diff --git a/setup.py b/setup.py index 5ce0582..5108861 100644 --- a/setup.py +++ b/setup.py @@ -2,6 +2,7 @@ # This file is managed by 'repo_helper'. Don't edit it directly. # stdlib +import pathlib import shutil import sys @@ -13,6 +14,9 @@ # this package from __pkginfo__ import * # pylint: disable=wildcard-import +repo_root = pathlib.Path(__file__).parent +install_requires = (repo_root / "requirements.txt").read_text(encoding="UTF-8").split('\n') + setup( description="Several useful custom dictionaries for Python 📖 🐍", extras_require=extras_require, diff --git a/tests/requirements.txt b/tests/requirements.txt index 5051380..1638d71 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,11 +1,12 @@ -coincidence>=0.1.0 +coincidence>=0.2.0 coverage>=5.1 coverage-pyver-pragma>=0.2.1 domdf-python-tools[testing]>=2.0.1 immutables>=0.14 +importlib-metadata>=3.6.0 iniconfig!=1.1.0,>=1.0.1 pytest>=6.0.0 pytest-cov>=2.8.1 -pytest-randomly>=3.3.1 +pytest-randomly>=3.7.0 pytest-rerunfailures>=9.0 pytest-timeout>=1.4.2 diff --git a/tox.ini b/tox.ini index b20e6c1..08b7212 100644 --- a/tox.ini +++ b/tox.ini @@ -42,14 +42,13 @@ basepython = python3.8 pip_version = pip>=21 changedir = {toxinidir}/doc-source deps = -r{toxinidir}/doc-source/requirements.txt -commands = sphinx-build -M html . ./build {posargs} +commands = sphinx-build -M {env:SPHINX_BUILDER:html} . ./build {posargs} [testenv:build] skip_install = True changedir = {toxinidir} deps = - virtualenv - git+https://github.com/pypa/build + build[virtualenv]>=0.3.1 check-wheel-contents>=0.1.0 twine>=3.2.0 commands = @@ -63,24 +62,25 @@ changedir = {toxinidir} ignore_errors = True skip_install = True deps = - flake8 >=3.8.2 - flake8-2020 >= 1.6.0 + flake8>=3.8.2 + flake8-2020>=1.6.0 flake8-builtins>=1.5.3 flake8-docstrings>=1.5.0 flake8-dunder-all>=0.1.1 + flake8-encodings>=0.1.0 flake8-github-actions>=0.1.0 flake8-pyi>=20.10.0 flake8-pytest-style>=1.3.0 + flake8-slots>=0.1.0 flake8-sphinx-links>=0.0.4 flake8-strftime>=0.1.1 flake8-typing-imports>=1.10.0 - flake8-encodings>=0.1.0 - flake8-slots>=0.1.0 - git+https://github.com/PyCQA/pydocstyle@5118faa7173b0e5bbc230c4adf628758e13605bf git+https://github.com/domdfcoding/flake8-quotes.git - git+https://github.com/domdfcoding/flake8-rst-docstrings.git git+https://github.com/domdfcoding/flake8-rst-docstrings-sphinx.git + git+https://github.com/domdfcoding/flake8-rst-docstrings.git + pydocstyle>=6.0.0 pygments>=2.7.1 + importlib_metadata<4.5.0; python_version<'3.8' commands = python3 -m flake8_rst_docstrings_sphinx cawdrey tests --allow-toolbox {posargs} [testenv:mypy] @@ -88,7 +88,7 @@ basepython = python3.6 ignore_errors = True changedir = {toxinidir} deps = - mypy==0.800 + mypy==0.812 -r{toxinidir}/tests/requirements.txt -r{toxinidir}/stubs.txt commands = mypy cawdrey tests {posargs} @@ -106,6 +106,10 @@ basepython = python3.6 skip_install = True ignore_errors = True whitelist_externals = /bin/bash +passenv = + COV_PYTHON_VERSION + COV_PLATFORM + COV_PYTHON_IMPLEMENTATION changedir = {toxinidir} deps = coverage>=5 @@ -117,7 +121,7 @@ commands = [flake8] max-line-length = 120 -select = E111 E112 E113 E121 E122 E125 E127 E128 E129 E131 E133 E201 E202 E203 E211 E222 E223 E224 E225 E225 E226 E227 E228 E231 E241 E242 E251 E261 E262 E265 E271 E272 E303 E304 E306 E402 E502 E703 E711 E712 E713 E714 E721 W291 W292 W293 W391 W504 YTT101 YTT102 YTT103 YTT201 YTT202 YTT203 YTT204 YTT301 YTT302 YTT303 STRFTIME001 STRFTIME002 SXL001 PT001 PT002 PT003 PT005 PT006 PT007 PT008 PT009 PT010 PT011 PT012 PT013 PT014 PT015 PT016 PT017 PT018 PT019 PT020 PT021 RST201 RST202 RST203 RST204 RST205 RST206 RST207 RST208 RST210 RST211 RST212 RST213 RST214 RST215 RST216 RST217 RST218 RST219 RST299 RST301 RST302 RST303 RST304 RST305 RST306 RST399 RST401 RST499 RST900 RST901 RST902 RST903 Q001 Q002 Q003 A001 A002 A003 TYP001 TYP002 TYP003 TYP004 TYP005 TYP006 ENC001 ENC002 ENC003 ENC004 Y001,Y002 Y003 Y004 Y005 Y006 Y007 Y008 Y009 Y010 Y011 Y012 Y013 Y014 Y015 Y090 Y091 E301 E302 E305 D100 D101 D102 D103 D104 D106 D201 D204 D207 D208 D209 D210 D211 D212 D213 D214 D215 D300 D301 D400 D402 D403 D404 D415 D417 DALL000 SLOT000 SLOT001 SLOT002 +select = E111 E112 E113 E121 E122 E125 E127 E128 E129 E131 E133 E201 E202 E203 E211 E222 E223 E224 E225 E225 E226 E227 E228 E231 E241 E242 E251 E261 E262 E265 E271 E272 E303 E304 E306 E402 E502 E703 E711 E712 E713 E714 E721 W291 W292 W293 W391 W504 YTT101 YTT102 YTT103 YTT201 YTT202 YTT203 YTT204 YTT301 YTT302 YTT303 STRFTIME001 STRFTIME002 SXL001 PT001 PT002 PT003 PT006 PT007 PT008 PT009 PT010 PT011 PT012 PT013 PT014 PT015 PT016 PT017 PT018 PT019 PT020 PT021 RST201 RST202 RST203 RST204 RST205 RST206 RST207 RST208 RST210 RST211 RST212 RST213 RST214 RST215 RST216 RST217 RST218 RST219 RST299 RST301 RST302 RST303 RST304 RST305 RST306 RST399 RST401 RST499 RST900 RST901 RST902 RST903 Q001 Q002 Q003 A001 A002 A003 TYP001 TYP002 TYP003 TYP004 TYP005 TYP006 ENC001 ENC002 ENC003 ENC004 ENC011 ENC012 ENC021 ENC022 ENC023 ENC024 ENC025 ENC026 Y001,Y002 Y003 Y004 Y005 Y006 Y007 Y008 Y009 Y010 Y011 Y012 Y013 Y014 Y015 Y090 Y091 E301 E302 E305 D100 D101 D102 D103 D104 D106 D201 D204 D207 D208 D209 D210 D211 D212 D213 D214 D215 D300 D301 D400 D402 D403 D404 D415 D417 DALL000 SLOT000 SLOT001 SLOT002 extend-exclude = doc-source,old,build,dist,__pkginfo__.py,setup.py,venv rst-directives = TODO @@ -131,6 +135,7 @@ inline-quotes = " multiline-quotes = """ docstring-quotes = """ count = True +min_python_version = 3.6.1 [coverage:run] plugins = coverage_pyver_pragma