diff --git a/.github/workflows/_docs.yml b/.github/workflows/_docs.yml index cc4ca692..368e2f35 100644 --- a/.github/workflows/_docs.yml +++ b/.github/workflows/_docs.yml @@ -21,7 +21,7 @@ jobs: run: pip install -r requirements.txt - name: Build docs - run: sphinx-build -EW --keep-going -T docs build/html + run: tox -e docs - name: Remove environment.pickle run: rm build/html/.doctrees/environment.pickle diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1273213e..6b534869 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,8 @@ jobs: # TODO: Use the CI straight from the template uses: ./.github/workflows/_check.yml + # TODO: add pre-commit and ctt + docs: needs: check if: ${{ ! needs.check.outputs.branch-pr }} diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml deleted file mode 100644 index 354b152f..00000000 --- a/.github/workflows/linkcheck.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Link Check - -on: - workflow_dispatch: - schedule: - # Run weekly to check URL links still resolve - - cron: "0 8 * * WED" - -jobs: - docs: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup python - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - - name: Install python packages - run: pip install -r requirements.txt - - - name: Check links - run: sphinx-build -b linkcheck -T docs build/html diff --git a/.gitignore b/.gitignore index d1638636..a2dd67b8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -build/ \ No newline at end of file +build/ +*.egg-info +.tox/ \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..4205af38 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,16 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-added-large-files + - id: check-yaml + - id: check-merge-conflict + + - repo: local + hooks: + - id: constraints + name: check constraints match installed + language: system + entry: pip-compile + files: ^(pyproject\.toml|dev-requirements\.txt)$ + pass_filenames: false diff --git a/dev-requirements.txt b/dev-requirements.txt new file mode 100644 index 00000000..f1bcb8fb --- /dev/null +++ b/dev-requirements.txt @@ -0,0 +1,69 @@ +# +# This file is autogenerated by pip-compile with Python 3.9 +# by the following command: +# +# pip-compile --extra=dev --no-annotate --output-file=dev-requirements.txt --strip-extras +# +accessible-pygments==0.0.4 +alabaster==0.7.16 +babel==2.14.0 +beautifulsoup4==4.12.3 +build==1.0.3 +certifi==2023.11.17 +cfgv==3.4.0 +charset-normalizer==3.3.2 +click==8.1.7 +colorama==0.4.6 +distlib==0.3.8 +docutils==0.20.1 +filelock==3.13.1 +identify==2.5.33 +idna==3.6 +imagesize==1.4.1 +importlib-metadata==7.0.1 +jinja2==3.1.3 +livereload==2.6.3 +markdown-it-py==3.0.0 +markupsafe==2.1.4 +mdit-py-plugins==0.4.0 +mdurl==0.1.2 +myst-parser==2.0.0 +nodeenv==1.8.0 +packaging==23.2 +pathlib2==2.3.7.post1 +pip-tools==7.3.0 +platformdirs==4.1.0 +pluggy==1.3.0 +pre-commit==3.6.0 +py==1.11.0 +pydata-sphinx-theme==0.15.2 +pygments==2.17.2 +pyproject-hooks==1.0.0 +pyyaml==6.0.1 +requests==2.31.0 +six==1.16.0 +snowballstemmer==2.2.0 +soupsieve==2.5 +sphinx==7.2.6 +sphinx-autobuild==2021.3.14 +sphinx-copybutton==0.5.2 +sphinx-design==0.5.0 +sphinxcontrib-applehelp==1.0.8 +sphinxcontrib-devhelp==1.0.6 +sphinxcontrib-htmlhelp==2.0.5 +sphinxcontrib-jsmath==1.0.1 +sphinxcontrib-qthelp==1.0.7 +sphinxcontrib-serializinghtml==1.1.10 +tomli==2.0.1 +tornado==6.4 +tox==3.28.0 +tox-direct==0.4 +typing-extensions==4.9.0 +urllib3==2.1.0 +virtualenv==20.25.0 +wheel==0.42.0 +zipp==3.17.0 + +# The following packages are considered to be unsafe in a requirements file: +# pip +# setuptools diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..3f78ddfe --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,45 @@ +[project] +name = "python-copier-template" +version = "0.0" + +[project.optional-dependencies] +dev = [ + "myst-parser", + "pip-tools", + "pre-commit", + "pydata-sphinx-theme>=0.12", + "sphinx-autobuild", + "sphinx-copybutton", + "sphinx-design", + "tox-direct", +] + +# tox must currently be configured via an embedded ini string +# See: https://github.com/tox-dev/tox/issues/999 +[tool.tox] +legacy_tox_ini = """ +[tox] +skipsdist=True + +[testenv:{pre-commit,docs}] +# Don't create a virtualenv for the command, requires tox-direct plugin +direct = True +passenv = * +allowlist_externals = + pre-commit + sphinx-build + sphinx-autobuild +commands = + pre-commit: pre-commit run --all-files --show-diff-on-failure {posargs} + docs: sphinx-{posargs:build -EW --keep-going} -T docs build/html +""" + +[tool.pip-tools] +src-files = ["pyproject.toml"] +extras = ["dev"] +output-file = "dev-requirements.txt" +quiet = true +# Make output suitable for use as a constraints file +strip-extras = true +# Remove annotations as coverage source seems to make false positive in CI +no-annotate = true diff --git a/requirements.in b/requirements.in deleted file mode 100644 index 2dd41841..00000000 --- a/requirements.in +++ /dev/null @@ -1,7 +0,0 @@ -myst-parser -pip-tools -pre-commit -pydata-sphinx-theme>=0.12 -sphinx-autobuild -sphinx-copybutton -sphinx-design diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 7c2f71dd..00000000 --- a/requirements.txt +++ /dev/null @@ -1,145 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.9 -# by the following command: -# -# pip-compile -# -accessible-pygments==0.0.4 - # via pydata-sphinx-theme -alabaster==0.7.16 - # via sphinx -babel==2.14.0 - # via - # pydata-sphinx-theme - # sphinx -beautifulsoup4==4.12.3 - # via pydata-sphinx-theme -build==1.0.3 - # via pip-tools -certifi==2023.11.17 - # via requests -cfgv==3.4.0 - # via pre-commit -charset-normalizer==3.3.2 - # via requests -click==8.1.7 - # via pip-tools -colorama==0.4.6 - # via sphinx-autobuild -distlib==0.3.8 - # via virtualenv -docutils==0.20.1 - # via - # myst-parser - # pydata-sphinx-theme - # sphinx -filelock==3.13.1 - # via virtualenv -identify==2.5.33 - # via pre-commit -idna==3.6 - # via requests -imagesize==1.4.1 - # via sphinx -importlib-metadata==7.0.1 - # via - # build - # sphinx -jinja2==3.1.3 - # via - # myst-parser - # sphinx -livereload==2.6.3 - # via sphinx-autobuild -markdown-it-py==3.0.0 - # via - # mdit-py-plugins - # myst-parser -markupsafe==2.1.4 - # via jinja2 -mdit-py-plugins==0.4.0 - # via myst-parser -mdurl==0.1.2 - # via markdown-it-py -myst-parser==2.0.0 - # via -r requirements.in -nodeenv==1.8.0 - # via pre-commit -packaging==23.2 - # via - # build - # pydata-sphinx-theme - # sphinx -pip-tools==7.3.0 - # via -r requirements.in -platformdirs==4.1.0 - # via virtualenv -pre-commit==3.6.0 - # via -r requirements.in -pydata-sphinx-theme==0.15.2 - # via -r requirements.in -pygments==2.17.2 - # via - # accessible-pygments - # pydata-sphinx-theme - # sphinx -pyproject-hooks==1.0.0 - # via build -pyyaml==6.0.1 - # via - # myst-parser - # pre-commit -requests==2.31.0 - # via sphinx -six==1.16.0 - # via livereload -snowballstemmer==2.2.0 - # via sphinx -soupsieve==2.5 - # via beautifulsoup4 -sphinx==7.2.6 - # via - # myst-parser - # pydata-sphinx-theme - # sphinx-autobuild - # sphinx-copybutton - # sphinx-design -sphinx-autobuild==2021.3.14 - # via -r requirements.in -sphinx-copybutton==0.5.2 - # via -r requirements.in -sphinx-design==0.5.0 - # via -r requirements.in -sphinxcontrib-applehelp==1.0.8 - # via sphinx -sphinxcontrib-devhelp==1.0.6 - # via sphinx -sphinxcontrib-htmlhelp==2.0.5 - # via sphinx -sphinxcontrib-jsmath==1.0.1 - # via sphinx -sphinxcontrib-qthelp==1.0.7 - # via sphinx -sphinxcontrib-serializinghtml==1.1.10 - # via sphinx -tomli==2.0.1 - # via - # build - # pip-tools - # pyproject-hooks -tornado==6.4 - # via livereload -typing-extensions==4.9.0 - # via pydata-sphinx-theme -urllib3==2.1.0 - # via requests -virtualenv==20.25.0 - # via pre-commit -wheel==0.42.0 - # via pip-tools -zipp==3.17.0 - # via importlib-metadata - -# The following packages are considered to be unsafe in a requirements file: -# pip -# setuptools