-
Notifications
You must be signed in to change notification settings - Fork 1
21 add pre commit hooks #60
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
246db85
adding pre-commit to toml
LevanBokeria fa915a1
adding balck, flake8 and isort packages. creating pre-commit-config.y…
LevanBokeria 8ebf9b4
adding packages to pre-commit file
LevanBokeria 5bb3a75
fixing formatting errors by adding an escape character to backslashes
LevanBokeria bce8516
updating the pre-commit yaml
LevanBokeria 409de95
updating the precommit file name
LevanBokeria 1e8ead5
Merge branch 'dev' into 21-add-pre-commit-hooks.
LevanBokeria ad787a5
Merge branch 'dev' into 21-add-pre-commit-hooks
LevanBokeria b342021
pre-commits unleashed
LevanBokeria 0dc2a1f
fixed pre-commit yaml
LevanBokeria d1b59cc
addint CONTRIBUTING.md
LevanBokeria c70965c
explaining the pre-commit hooks
LevanBokeria fc87fa6
Merge branch 'dev' into 21-add-pre-commit-hooks
LevanBokeria File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -171,4 +171,4 @@ cython_debug/ | |
.pypirc | ||
|
||
# Ignore vscode settings | ||
.vscode/ | ||
.vscode/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
ci: | ||
autoupdate_commit_msg: "chore: update pre-commit hooks" | ||
autofix_commit_msg: "style: pre-commit fixes" | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v5.0.0 | ||
hooks: | ||
- id: trailing-whitespace # remove trailing whitespace | ||
- id: end-of-file-fixer # ensure files end with a newline | ||
- id: check-yaml # check YAML files for syntax errors | ||
- id: check-json # check JSON files for syntax errors | ||
- id: check-added-large-files # check for large files | ||
args: ['--maxkb=500'] # set the max file size to 500KB | ||
- id: check-case-conflict # check for case conflicts in filenames. | ||
- id: check-merge-conflict # This hook checks for merge conflict markers in files. | ||
# It ensures that there are no unresolved merge conflicts in the codebase. | ||
- id: check-symlinks # check for broken symlinks | ||
# - id: debug-statements | ||
- id: mixed-line-ending # check for mixed line endings, meaning that | ||
# a file contains both CRLF and LF line endings. This can cause issues | ||
# when working with files across different operating systems. | ||
|
||
# - repo: https://github.com/psf/black | ||
# rev: 25.1.0 # Use the latest stable version | ||
# hooks: | ||
# - id: black | ||
|
||
# - repo: https://github.com/PyCQA/flake8 | ||
# rev: 7.1.1 # Use the latest stable version | ||
# hooks: | ||
# - id: flake8 | ||
|
||
# - repo: https://github.com/pre-commit/mirrors-isort | ||
# rev: 6.0.0 # Use the latest stable version | ||
# hooks: | ||
# - id: isort | ||
|
||
# - repo: https://github.com/astral-sh/ruff-pre-commit | ||
# rev: "v0.11.5" | ||
# hooks: | ||
# # first, lint + autofix | ||
# - id: ruff | ||
# types_or: [python, pyi, jupyter] | ||
# args: ["--fix", "--show-fixes"] | ||
# # then, format | ||
# - id: ruff-format | ||
|
||
# - repo: https://github.com/pre-commit/mirrors-mypy | ||
# rev: "v1.15.0" | ||
# hooks: | ||
# - id: mypy | ||
# files: src | ||
# args: [] | ||
# additional_dependencies: | ||
# - pytest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
See the [Scientific Python Developer Guide][spc-dev-intro] for a detailed | ||
description of best practices for developing scientific packages. | ||
|
||
[spc-dev-intro]: https://learn.scientific-python.org/development/ | ||
|
||
# Setting up a development environment manually | ||
|
||
You can set up a development environment by running: | ||
|
||
```zsh | ||
python3 -m venv venv # create a virtualenv called venv | ||
source ./venv/bin/activate # now `python` points to the virtualenv python | ||
pip install -v -e ".[dev]" # -v for verbose, -e for editable, [dev] for dev dependencies | ||
``` | ||
|
||
# Post setup | ||
|
||
You should prepare pre-commit, which will help you by checking that commits pass | ||
required checks: | ||
|
||
```bash | ||
pip install pre-commit # or brew install pre-commit on macOS | ||
pre-commit install # this will install a pre-commit hook into the git repo | ||
``` | ||
|
||
You can also/alternatively run `pre-commit run` (changes only) or | ||
`pre-commit run --all-files` to check even without installing the hook. | ||
|
||
# Testing | ||
|
||
This repo uses `unittest` for testing. You can run locally the tests by running the following command: | ||
|
||
```bash | ||
python -m unittest discover -s tests | ||
``` | ||
there is also a autamtated test pipeline that runs the tests on every push to the repository (see [here](.github/workflows/ci.yml)). | ||
|
||
|
||
# Pre-commit | ||
|
||
This project uses pre-commit for all style checking. Install pre-commit and run: | ||
|
||
```bash | ||
pre-commit run -a | ||
``` | ||
|
||
to check all files. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.