Skip to content

Commit 2ebae3a

Browse files
authored
Merge pull request #66 from blooop/feature/pre_commit
Feature/pre commit
2 parents 26eac32 + 7eaec9c commit 2ebae3a

File tree

16 files changed

+443
-350
lines changed

16 files changed

+443
-350
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ RUN curl -L -o /usr/local/bin/pixi -fsSL --compressed "https://github.com/prefix
1010
USER vscode
1111
WORKDIR /home/vscode
1212

13-
RUN echo 'eval "$(pixi completion -s bash)"' >> /home/vscode/.bashrc
13+
RUN echo 'eval "$(pixi completion -s bash)"' >> /home/vscode/.bashrc

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@
4343
# numpy file format
4444
*.npy filter=lfs diff=lfs merge=lfs -text
4545
# GitHub syntax highlighting
46-
pixi.lock linguist-language=YAML merge=ourslock
46+
pixi.lock linguist-language=YAML merge=ourslock

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ jobs:
2929
- name: Upload coverage reports to Codecov
3030
uses: codecov/codecov-action@v4
3131
env:
32-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
32+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/pre-commit.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: pre-commit
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
pre-commit:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- uses: pre-commit/[email protected]

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ jobs:
1515
with:
1616
pypi-token: ${{ secrets.PYPI_API_TOKEN }}
1717
gh-token: ${{ secrets.GITHUB_TOKEN }}
18-
parse-changelog: true
18+
parse-changelog: true

.pre-commit-config.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# To use:
2+
#
3+
# pre-commit run -a
4+
#
5+
# Or:
6+
#
7+
# pre-commit install # (runs every time you commit in git)
8+
#
9+
# To update this file:
10+
#
11+
# pre-commit autoupdate
12+
#
13+
# See https://github.com/pre-commit/pre-commit
14+
15+
repos:
16+
# Standard hooks
17+
- repo: https://github.com/pre-commit/pre-commit-hooks
18+
rev: v5.0.0
19+
hooks:
20+
- id: check-added-large-files
21+
- id: check-ast
22+
- id: check-case-conflict
23+
- id: check-docstring-first
24+
- id: check-merge-conflict
25+
- id: check-executables-have-shebangs
26+
- id: check-shebang-scripts-are-executable
27+
- id: name-tests-test
28+
- id: detect-private-key
29+
- id: check-symlinks
30+
- id: check-toml
31+
- id: check-xml
32+
- id: check-yaml
33+
args: ['--unsafe'] # Fixes errors parsing custom jinja templates
34+
# - id: check-json
35+
# - id: pretty-format-json
36+
# args: ['--autofix']
37+
- id: debug-statements
38+
- id: end-of-file-fixer
39+
- id: mixed-line-ending
40+
# - id: trailing-whitespace
41+
- id: fix-byte-order-marker
42+
43+
# Formatter for python
44+
- repo: https://github.com/astral-sh/ruff-pre-commit
45+
rev: v0.7.3
46+
hooks:
47+
# Run the linter.
48+
- id: ruff
49+
types_or: [ python, pyi ]
50+
args: [ --fix ]
51+
# Run the formatter.
52+
- id: ruff-format
53+
types_or: [ python, pyi ]
54+
# Checks for spelling mistakes
55+
- repo: https://github.com/codespell-project/codespell
56+
rev: v2.3.0 #TODO latest version 2.3.0 finds a lot of spelling mistakes but fails on "assertIn"
57+
hooks:
58+
- id: codespell
59+
args: ['--write-changes']
60+
exclude: \.(svg|pyc|lock|json)$

.vscode/extensions.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
2-
"recommendations": [
3-
"ms-python.python",
4-
"ms-python.vscode-pylance",
5-
"ms-python.pylint",
6-
"ms-python.black-formatter",
7-
"njpwerner.autodocstring",
8-
"charliermarsh.ruff",
9-
"mhutchie.git-graph",
10-
"eamodio.gitlens",
11-
"tamasfe.even-better-toml",
12-
"Codium.codium",
13-
"ms-azuretools.vscode-docker",
14-
"ryanluker.vscode-coverage-gutters",
15-
"jjjermiah.pixi-vscode"
16-
]
17-
}
2+
"recommendations": [
3+
"ms-python.python",
4+
"ms-python.vscode-pylance",
5+
"ms-python.pylint",
6+
"ms-python.black-formatter",
7+
"njpwerner.autodocstring",
8+
"charliermarsh.ruff",
9+
"mhutchie.git-graph",
10+
"eamodio.gitlens",
11+
"tamasfe.even-better-toml",
12+
"Codium.codium",
13+
"ms-azuretools.vscode-docker",
14+
"ryanluker.vscode-coverage-gutters",
15+
"jjjermiah.pixi-vscode"
16+
]
17+
}

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
"/home/vscode/.local/lib/python3.10/site-packages/python_template/**": true
1212
},
1313
"python.analysis.autoImportCompletions": false //vscode gets it wrong more than right and mostly gets in the way
14-
}
14+
}

CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,3 @@
33
## python_template
44

55
## [0.0.0]
6-
7-

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ If you don't want to install rocker on your system but want to use vscode, you c
8181

8282
## Troubleshooting
8383

84-
The main pixi tasks are related to CI. Github actions runs the pixi task "ci". The CI is mostly likey to fail from a lockfile mismatch. Use `pixi run fix` to fix any lockfile related problems.
84+
The main pixi tasks are related to CI. Github actions runs the pixi task "ci". The CI is mostly likely to fail from a lockfile mismatch. Use `pixi run fix` to fix any lockfile related problems.
8585

8686
## vscode tasks
8787

@@ -94,6 +94,3 @@ There are two core tasks.
9494
2. run \<cfg\>
9595

9696
This runs python with the file set in \<cfg\>
97-
98-
99-

0 commit comments

Comments
 (0)