Skip to content

Commit

Permalink
MAINT: apply fixes by pre-commit hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] authored and redeboer committed Sep 9, 2024
1 parent 0721fe9 commit 9b6d894
Show file tree
Hide file tree
Showing 13 changed files with 175 additions and 83 deletions.
4 changes: 2 additions & 2 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
"*particle*.*ml",
".constraints/*.txt",
".editorconfig",
".envrc",
".gitattributes",
".gitignore",
".gitpod.*",
".pre-commit-config.yaml",
".prettierignore",
".readthedocs.yml",
Expand Down Expand Up @@ -78,7 +79,6 @@
"gellmann",
"genindex",
"getsource",
"gitpod",
"hankel",
"heli",
"heurisch",
Expand Down
11 changes: 10 additions & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
layout anaconda
if [ -e .venv ]; then
source .venv/bin/activate
elif [ -e venv ]; then
source venv/bin/activate
elif [ -e .pixi ]; then
watch_file pixi.lock
eval "$(pixi shell-hook)"
else
layout anaconda
fi
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pixi.lock linguist-language=YAML linguist-generated=true
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ TAGS

# Virtual environments
*venv/
.pixi/
.tox/
pyvenv*/

Expand All @@ -51,11 +52,11 @@ pyvenv*/
!.cspell.json
!.github/*.yml
!.github/*/*.yml
!.gitpod.yml
!.pre-commit-config.yaml
!.readthedocs.yml
!.vscode/*.json
!.zenodo.json
!codecov.yml
!environment.yml
!pyrightconfig.json
.pixi/
37 changes: 0 additions & 37 deletions .gitpod.yml

This file was deleted.

52 changes: 25 additions & 27 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,39 @@ ci:
skip:
- check-jsonschema
- mypy
- prettier
- pyright
- taplo

repos:
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes

- repo: https://github.com/ComPWA/policy
rev: 0.4.0
hooks:
- id: check-dev-files
args:
- --doc-apt-packages=graphviz
- --no-prettierrc
- --pin-requirements=monthly
- --repo-name=qrules
- --repo-title=QRules
- id: colab-toc-visible
- id: fix-nbformat-version
- id: remove-empty-tags
- id: set-nb-cells
args:
- --add-install-cell
- --additional-packages=IPython
- --extras-require=doc,viz

- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
- id: nbstripout
args:
- --drop-empty-cells
- --extra-keys
- |
cell.attachments
Expand All @@ -41,25 +59,6 @@ repos:
metadata.varInspector
metadata.vscode
- repo: https://github.com/ComPWA/policy
rev: 0.4.0
hooks:
- id: check-dev-files
args:
- --doc-apt-packages=graphviz
- --no-prettierrc
- --pin-requirements=monthly
- --repo-name=qrules
- --repo-title=QRules
- id: colab-toc-visible
- id: fix-nbformat-version
- id: remove-empty-tags
- id: set-nb-cells
args:
- --add-install-cell
- --additional-packages=IPython
- --extras-require=doc,viz

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.4
hooks:
Expand Down Expand Up @@ -92,16 +91,15 @@ repos:
args: ["--django"]
- id: trailing-whitespace

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
- repo: https://github.com/ComPWA/prettier-pre-commit
rev: v3.3.3
hooks:
- id: prettier

- repo: https://github.com/ComPWA/mirrors-taplo
rev: v0.8.1
- repo: https://github.com/ComPWA/taplo-pre-commit
rev: v0.9.3
hooks:
- id: taplo

- id: taplo-format
- repo: https://github.com/pappasam/toml-sort
rev: v0.23.1
hooks:
Expand Down
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"github.vscode-github-actions",
"github.vscode-pull-request-github",
"joaompinto.vscode-graphviz",
"mhutchie.git-graph",
"ms-python.mypy-type-checker",
"ms-python.python",
"ms-python.vscode-pylance",
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"diffEditor.experimental.showMoves": true,
"editor.formatOnSave": true,
"files.associations": {
"**/.constraints/py*.txt": "pip-requirements"
"**/.constraints/py*.txt": "pip-requirements",
"**/pixi.lock": "yaml"
},
"files.watcherExclude": {
"**/*_cache/**": true,
Expand Down
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# How to contribute?

[![Open in Visual Studio Code](https://img.shields.io/badge/vscode-open-blue?logo=visualstudiocode)](https://open.vscode.dev/ComPWA/qrules)
[![GitPod](https://img.shields.io/badge/gitpod-open-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ComPWA/qrules)

This package is part of the [ComPWA Organization](https://github.com/ComPWA). For more information about how to contribute to the packages, go to [compwa.github.io/develop](https://compwa.github.io/develop)!
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
[![Binder](https://static.mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/ComPWA/qrules/stable?filepath=docs/usage)
[![Google Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ComPWA/qrules/blob/stable)
[![Open in Visual Studio Code](https://img.shields.io/badge/vscode-open-blue?logo=visualstudiocode)](https://open.vscode.dev/ComPWA/qrules)
[![GitPod](https://img.shields.io/badge/gitpod-open-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ComPWA/qrules)

[![Documentation](https://readthedocs.org/projects/qrules/badge/?version=latest)](https://qrules.readthedocs.io)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/ComPWA/qrules/main.svg)](https://results.pre-commit.ci/latest/github/ComPWA/qrules/main)
Expand Down
2 changes: 0 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ dependencies:
- graphviz
- pip:
- -c .constraints/py3.9.txt -e .[dev]
variables:
PRETTIER_LEGACY_CLI: 1
126 changes: 124 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ namespaces = false
where = ["src"]

[tool.setuptools_scm]
local_scheme = "no-local-version"
version_scheme = "post-release"
write_to = "src/qrules/version.py"

[tool.coverage.run]
Expand Down Expand Up @@ -201,6 +203,128 @@ module = ["sphinx.*"]
ignore_missing_imports = true
module = ["tqdm.*"]

[tool.pixi.project]
channels = ["conda-forge"]
platforms = ["linux-64"]

[tool.pixi.activation.env]
PRETTIER_LEGACY_CLI = "1"

[tool.pixi.dependencies]
graphviz = "*"
python = "3.9.*"

[tool.pixi.environments]
default = {features = [
"all",
"dev",
"doc",
"jupyter",
"sty",
"test",
"types",
"viz",
]}

[tool.pixi.feature.dev.tasks.ci]
depends_on = ["cov", "docnb", "linkcheck", "sty"]

[tool.pixi.feature.dev.tasks.cov]
cmd = """
pytest tests/unit \
--cov-fail-under=90 \
--cov-report=html \
--cov-report=xml \
--cov=qrules
"""

[tool.pixi.feature.dev.tasks.doc]
cmd = """
sphinx-build \
--keep-going \
-TW \
-b html \
docs/ docs/_build/html
"""
env = {FORCE_COLOR = "yes"}

[tool.pixi.feature.dev.tasks.doclive]
cmd = """
sphinx-autobuild \
--open-browser \
--re-ignore .*/.ipynb_checkpoints/.* \
--re-ignore .*/__pycache__/.* \
--re-ignore .*\\.tmp \
--re-ignore docs/.*\\.csv \
--re-ignore docs/.*\\.gv \
--re-ignore docs/.*\\.inv \
--re-ignore docs/.*\\.json \
--re-ignore docs/.*\\.pickle \
--re-ignore docs/.*\\.yaml \
--re-ignore docs/.*\\.yml \
--re-ignore docs/_build/.* \
--re-ignore docs/_images/.* \
--re-ignore docs/_static/logo\\..* \
--re-ignore docs/api/.* \
--watch docs \
--watch src \
-b html \
docs/ docs/_build/html
"""
env = {FORCE_COLOR = "yes"}

[tool.pixi.feature.dev.tasks.docnb]
cmd = "pixi run doc"
env = {EXECUTE_NB = "yes", FORCE_COLOR = "yes"}

[tool.pixi.feature.dev.tasks.docnb-force]
cmd = "pixi run doc"
env = {FORCE_COLOR = "yes", FORCE_EXECUTE_NB = "yes", PYTHONHASHSEED = "0"}

[tool.pixi.feature.dev.tasks.docnblive]
cmd = "pixi run doclive"
env = {EXECUTE_NB = "yes", FORCE_COLOR = "yes", PYTHONHASHSEED = "0"}

[tool.pixi.feature.dev.tasks.linkcheck]
cmd = """
sphinx-build \
-T \
-b linkcheck \
docs/ docs/_build/linkcheck
"""
env = {FORCE_COLOR = "yes"}

[tool.pixi.feature.dev.tasks.nb]
cmd = "pytest --nbmake docs"

[tool.pixi.feature.dev.tasks.pydeps]
cmd = """
pydeps qrules \
-o ../module_structure.svg \
--exclude *._* \
--max-bacon=1 \
--noshow
"""

[tool.pixi.feature.dev.tasks.sty]
cmd = "pre-commit run -a"
env = {SKIP = "pyright"}

[tool.pixi.feature.dev.tasks.test]
cmd = """
pytest \
--cov-fail-under=90 \
--cov-report=html \
--cov-report=xml \
--cov=qrules
"""

[tool.pixi.feature.dev.tasks.tests]
cmd = "pytest src tests/unit"

[tool.pixi.pypi-dependencies]
qrules = {path = ".", editable = true}

[tool.pyright]
exclude = [
"**/.git",
Expand Down Expand Up @@ -281,7 +405,6 @@ src = [
"src",
"tests",
]
target-version = "py37"

[tool.ruff.format]
docstring-code-format = true
Expand Down Expand Up @@ -398,6 +521,5 @@ sort_first = [
"tool.setuptools",
"tool.setuptools_scm",
]
sort_table_keys = true
spaces_indent_inline_array = 4
trailing_comma_inline_array = true
Loading

0 comments on commit 9b6d894

Please sign in to comment.