Skip to content

Python demo to display the examples in the talk Good scinetific software for free

Notifications You must be signed in to change notification settings

sunnivin/good-scientific-software-for-free-python-demo

Repository files navigation

Pre-commit hooks with Python

This repo contains an example set-up for using pre-commit hooks with your python environment.

The file .pre-commit-config.yaml controls the type of pre-commit you are currently using. There exists several ways to do automatic formatting with Python. This is just an example.

Original documentation for pre-commit.

Usage

Start with activating the virtual environment and installing needed packages from the pyproject.toml file

C:\Users\SuI\pre-commits-python-example (main)
PS>poetry shell
C:\Users\SuI\pre-commits-python-example (main)
(pre-commits-python-example-py3.11) poetry install

Update hook versions

You can automatically update the different versions of the hooks by typing

C:\Users\SuI\pre-commits-python-example (main)
(pre-commits-python-example-py3.11)  pre-commit autoupdate

Automatic run each time you try to commit something

C:\Users\SuI\pre-commits-python-example (main)
(pre-commits-python-example-py3.11) pre-commit install

To later bypass the hook use the --no-verify option

C:\Users\SuI\pre-commits-python-example (main)
(pre-commits-python-example-py3.11) git commit -m "wip: quick fix of data" --no-verify

Manual run

You can do a manual pre-commit run on all files with the command

(C:\Users\SuI\pre-commits-python-example (main)
(pre-commits-python-example-py3.11) pre-commit run --all-files

About

Python demo to display the examples in the talk Good scinetific software for free

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages