Skip to content

Commit

Permalink
Use tox and pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
coretl committed Jan 23, 2024
1 parent 1510f36 commit 5d16c58
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 180 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
26 changes: 0 additions & 26 deletions .github/workflows/linkcheck.yml

This file was deleted.

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
build/
build/
*.egg-info
.tox/
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
69 changes: 69 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -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
45 changes: 45 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 0 additions & 7 deletions requirements.in

This file was deleted.

145 changes: 0 additions & 145 deletions requirements.txt

This file was deleted.

0 comments on commit 5d16c58

Please sign in to comment.