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

Feature/pre commit #66

Merged
merged 2 commits into from
Nov 14, 2024
Merged
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
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
Loading