Skip to content

Commit

Permalink
MAINT: update pixi.lock and .pre-commit-config.yml (#79)
Browse files Browse the repository at this point in the history
* DX: add configuration file for EditorConfig
* DX: add VS Code settings
* DX: avoid task command duplication
* DX: implement PR linting
* DX: remove `RemovedInSphinx90Warning` from Sphinx log
  https://www.sphinx-doc.org/en/master/man/sphinx-build.html\#deprecation-warnings
* MAINT: avoid new Ruff A004 rule in notebooks for `display`
  • Loading branch information
redeboer authored Aug 13, 2024
1 parent edb35b1 commit 16bdcd6
Show file tree
Hide file tree
Showing 9 changed files with 525 additions and 407 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
root = true

[*]
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.{ipynb,md}]
indent_size = unset

[*.{py,toml}]
indent_size = 4

[LICENSE]
indent_size = unset
13 changes: 13 additions & 0 deletions .github/workflows/pr-linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: PR linting
jobs:
lint-pr:
uses: ComPWA/actions/.github/workflows/pr-linting.yml@v1
on:
pull_request:
types:
- edited
- labeled
- opened
- reopened
- synchronize
- unlabeled
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
node_modules/
**/*.pickle
**/*.json
!.vscode/*.json
20 changes: 18 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ ci:
autoupdate_schedule: quarterly

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

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
Expand All @@ -12,11 +17,22 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/ComPWA/policy
rev: 0.3.10
rev: 0.3.18
hooks:
- id: fix-nbformat-version
- id: remove-empty-tags

- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 2.7.3
hooks:
- id: editorconfig-checker
name: editorconfig
alias: ec
exclude: >-
(?x)^(
.*\.py
)$
- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
Expand Down Expand Up @@ -47,7 +63,7 @@ repos:
- --in-place

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.5
rev: v0.5.7
hooks:
- id: ruff
args: [--fix]
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.ipynb
LICENSE
20 changes: 20 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"recommendations": [
"charliermarsh.ruff",
"eamodio.gitlens",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"executablebookproject.myst-highlight",
"github.vscode-github-actions",
"github.vscode-pull-request-github",
"mhutchie.git-graph",
"ms-python.python",
"ms-toolsai.jupyter",
"ms-vscode.live-server",
"ms-vsliveshare.vsliveshare",
"redhat.vscode-yaml",
"simonsiefke.svg-preview",
"tamasfe.even-better-toml",
"yzhang.markdown-all-in-one"
]
}
48 changes: 48 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"[git-commit]": {
"editor.rulers": [72]
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[python]": {
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.rulers": [88]
},
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"diffEditor.experimental.showMoves": true,
"editor.formatOnSave": true,
"files.associations": {
"**/pixi.lock": "yaml"
},
"git.rebaseWhenSync": true,
"github-actions.workflows.pinned.refresh.enabled": true,
"github-actions.workflows.pinned.workflows": [
".github/workflows/ci-docs.yml"
],
"gitlens.telemetry.enabled": false,
"livePreview.defaultPreviewPath": "docs/_build/html",
"multiDiffEditor.experimental.enabled": true,
"notebook.codeActionsOnSave": {
"notebook.source.organizeImports": "explicit"
},
"notebook.formatOnSave.enabled": true,
"notebook.gotoSymbols.showAllSymbols": true,
"python.terminal.activateEnvironment": false,
"redhat.telemetry.enabled": false,
"ruff.enable": true,
"ruff.importStrategy": "fromEnvironment",
"ruff.organizeImports": true,
"telemetry.telemetryLevel": "off"
}
788 changes: 399 additions & 389 deletions pixi.lock

Large diffs are not rendered by default.

23 changes: 7 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ sphinx-build \
-b html \
docs/ docs/_build/html
"""
env = {PYTHONWARNINGS = ""}

[tool.pixi.tasks.doclive]
cmd = """
Expand All @@ -70,27 +71,14 @@ sphinx-autobuild \
-b html \
docs/ docs/_build/html
"""
env = {PYTHONWARNINGS = ""}

[tool.pixi.tasks.docnb]
cmd = """
sphinx-build \
-nW --keep-going \
-b html \
docs/ docs/_build/html
"""
cmd = "pixi run doc"
env = {EXECUTE_NB = "yes"}

[tool.pixi.tasks.docnblive]
cmd = """
sphinx-autobuild \
--re-ignore '.*/_build/.*' \
--re-ignore '.*/.ipynb_checkpoints/.*' \
--re-ignore '.*/.virtual_documents/.*' \
--watch docs \
-nW --keep-going \
-b html \
docs/ docs/_build/html
"""
cmd = "pixi run doclive"
env = {EXECUTE_NB = "yes"}

[tool.pixi.tasks.lab]
Expand All @@ -110,6 +98,9 @@ ignore = [
preview = true
select = ["ALL"]

[tool.ruff.lint.flake8-builtins]
builtins-ignorelist = ["display"]

[tool.ruff.lint.per-file-ignores]
"*.ipynb" = [
"ANN",
Expand Down

0 comments on commit 16bdcd6

Please sign in to comment.