Skip to content

Commit

Permalink
Merge pull request #66 from blooop/feature/pre_commit
Browse files Browse the repository at this point in the history
Feature/pre commit
  • Loading branch information
blooop authored Nov 14, 2024
2 parents 26eac32 + 7eaec9c commit 2ebae3a
Show file tree
Hide file tree
Showing 16 changed files with 443 additions and 350 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ RUN curl -L -o /usr/local/bin/pixi -fsSL --compressed "https://github.com/prefix
USER vscode
WORKDIR /home/vscode

RUN echo 'eval "$(pixi completion -s bash)"' >> /home/vscode/.bashrc
RUN echo 'eval "$(pixi completion -s bash)"' >> /home/vscode/.bashrc
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@
# numpy file format
*.npy filter=lfs diff=lfs merge=lfs -text
# GitHub syntax highlighting
pixi.lock linguist-language=YAML merge=ourslock
pixi.lock linguist-language=YAML merge=ourslock
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
10 changes: 10 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: pre-commit

on: [pull_request]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: pre-commit/[email protected]
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
with:
pypi-token: ${{ secrets.PYPI_API_TOKEN }}
gh-token: ${{ secrets.GITHUB_TOKEN }}
parse-changelog: true
parse-changelog: true
60 changes: 60 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# To use:
#
# pre-commit run -a
#
# Or:
#
# pre-commit install # (runs every time you commit in git)
#
# To update this file:
#
# pre-commit autoupdate
#
# See https://github.com/pre-commit/pre-commit

repos:
# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-docstring-first
- id: check-merge-conflict
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: name-tests-test
- id: detect-private-key
- id: check-symlinks
- id: check-toml
- id: check-xml
- id: check-yaml
args: ['--unsafe'] # Fixes errors parsing custom jinja templates
# - id: check-json
# - id: pretty-format-json
# args: ['--autofix']
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
# - id: trailing-whitespace
- id: fix-byte-order-marker

# Formatter for python
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.3
hooks:
# Run the linter.
- id: ruff
types_or: [ python, pyi ]
args: [ --fix ]
# Run the formatter.
- id: ruff-format
types_or: [ python, pyi ]
# Checks for spelling mistakes
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0 #TODO latest version 2.3.0 finds a lot of spelling mistakes but fails on "assertIn"
hooks:
- id: codespell
args: ['--write-changes']
exclude: \.(svg|pyc|lock|json)$
32 changes: 16 additions & 16 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"recommendations": [
"ms-python.python",
"ms-python.vscode-pylance",
"ms-python.pylint",
"ms-python.black-formatter",
"njpwerner.autodocstring",
"charliermarsh.ruff",
"mhutchie.git-graph",
"eamodio.gitlens",
"tamasfe.even-better-toml",
"Codium.codium",
"ms-azuretools.vscode-docker",
"ryanluker.vscode-coverage-gutters",
"jjjermiah.pixi-vscode"
]
}
"recommendations": [
"ms-python.python",
"ms-python.vscode-pylance",
"ms-python.pylint",
"ms-python.black-formatter",
"njpwerner.autodocstring",
"charliermarsh.ruff",
"mhutchie.git-graph",
"eamodio.gitlens",
"tamasfe.even-better-toml",
"Codium.codium",
"ms-azuretools.vscode-docker",
"ryanluker.vscode-coverage-gutters",
"jjjermiah.pixi-vscode"
]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"/home/vscode/.local/lib/python3.10/site-packages/python_template/**": true
},
"python.analysis.autoImportCompletions": false //vscode gets it wrong more than right and mostly gets in the way
}
}
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
## python_template

## [0.0.0]


5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ If you don't want to install rocker on your system but want to use vscode, you c

## Troubleshooting

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.
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.

## vscode tasks

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

This runs python with the file set in \<cfg\>



2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sphinxcontrib-napoleon
sphinx-rtd-theme
sphinx-autoapi
sphinx-autoapi
Loading

0 comments on commit 2ebae3a

Please sign in to comment.