Skip to content

Commit 19fb1a8

Browse files
authored
Feature/pre commit (#64)
* add pre-commit for ruff * add pre commit * add precommit github workflow * update pre-commit version * add pre-commit task * run pre-commit * enable more pre-commit checks * remove black * update pixi.lock * add typo * add precommit to docker * remove black settings * extract ruff settings into ruff.toml * extract ruff settings into ruff.toml * update pre-commit hooks
1 parent 26eac32 commit 19fb1a8

File tree

16 files changed

+411
-334
lines changed

16 files changed

+411
-334
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: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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-symlinks
26+
- id: check-yaml
27+
args: ['--unsafe'] # Fixes errors parsing custom jinja templates
28+
# - id: debug-statements
29+
- id: end-of-file-fixer
30+
- id: mixed-line-ending
31+
# - id: trailing-whitespace
32+
- id: fix-byte-order-marker
33+
34+
# Formatter for python
35+
- repo: https://github.com/astral-sh/ruff-pre-commit
36+
rev: v0.7.3
37+
hooks:
38+
# Run the linter.
39+
- id: ruff
40+
types_or: [ python, pyi ]
41+
args: [ --fix ]
42+
# Run the formatter.
43+
- id: ruff-format
44+
types_or: [ python, pyi ]

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
"ryanluker.vscode-coverage-gutters",
1515
"jjjermiah.pixi-vscode"
1616
]
17-
}
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: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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)