Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DX: implement developer infrastructure #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions .pre-commit-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
repos:
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes

- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
- id: nbstripout
args:
- --extra-keys
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- --extra-keys
- --drop-empty-cells
- --extra-keys

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good to add this arg for delete empty cell(s) in jupyter notebook, see e.g. https://github.com/ComPWA/gluex-nstar/blob/main/.pre-commit-config.yaml#L41C11-L41C31

- |
cell.attachments
cell.metadata.code_folding
cell.metadata.id
cell.metadata.pycharm
cell.metadata.user_expressions
metadata.celltoolbar
metadata.colab.name
metadata.colab.provenance
metadata.interpreter
metadata.notify_time
metadata.toc
metadata.toc-autonumbering
metadata.toc-showcode
metadata.toc-showmarkdowntxt
metadata.toc-showtags
metadata.varInspector
metadata.vscode

- repo: https://github.com/ComPWA/policy
rev: 0.3.5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run

pre-commit autoupdate

hooks:
- id: check-dev-files
args:
- --dev-python-version=3.10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use the newest here:

Suggested change
- --dev-python-version=3.10
- --dev-python-version=3.12

- --no-github-actions
- --no-gitpod
- --no-prettierrc
- --no-pypi
- --no-version-branches
- --pin-requirements=monthly
Comment on lines +38 to +43
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this public repo, we can activate all CI workflows

Suggested change
- --no-github-actions
- --no-gitpod
- --no-prettierrc
- --no-pypi
- --no-version-branches
- --pin-requirements=monthly
- --no-gitpod
- --no-prettierrc
- --pin-requirements=monthly

- --repo-name=K-matrix-research
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- --repo-name=K-matrix-research
- --repo-name=kmatrix

- id: fix-nbformat-version

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
hooks:
- id: ruff
args: [--fix]
types_or: [python, pyi, jupyter]
- id: ruff-format
types_or: [python, pyi, jupyter]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-ast
- id: check-case-conflict
- id: check-docstring-first
- id: check-json
- id: check-merge-conflict
- id: check-toml
- id: check-vcs-permalinks
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
exclude: >
(?x)^(
.*\.bib
)$
- id: mixed-line-ending
- id: trailing-whitespace

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

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

- repo: https://github.com/pappasam/toml-sort
rev: v0.23.1
hooks:
- id: toml-sort
args:
- --in-place

- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 2.7.3
hooks:
- id: editorconfig-checker
name: editorconfig
alias: ec
exclude: >-
(?x)^(
.*\.py
)$
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

11 changes: 11 additions & 0 deletions enviroment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: kmatrix
dependencies:
- python==3.10.*
- pip
- graphviz
- pip:
- -c .constraints/py3.10.txt -e .[dev]
variables:
PRETTIER_LEGACY_CLI: 1
PYDEVD_DISABLE_FILE_VALIDATION: 1
PYTHONHASHSEED: 0
Loading