diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..0e8a58ece0 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,11 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.2.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - id: mixed-line-ending diff --git a/requirements.txt b/requirements.txt index 5065b4f877..2a4f557e3b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -39,6 +39,7 @@ inventree # Install the latest version of the Inve markdown==3.3.4 # Force particular version of markdown pep8-naming==0.11.1 # PEP naming convention extension pillow==9.0.1 # Image manipulation +pre-commit==2.19.0 # Git pre-commit py-moneyed==0.8.0 # Specific version requirement for py-moneyed pygments==2.7.4 # Syntax highlighting python-barcode[images]==0.13.1 # Barcode generator diff --git a/tasks.py b/tasks.py index 2ed0b4d35e..db3a68d503 100644 --- a/tasks.py +++ b/tasks.py @@ -98,6 +98,19 @@ def install(c): # Install required Python packages with PIP c.run('pip3 install -U -r requirements.txt') +def setup_dev(c): + """ + Sets up everything needed for the dev enviroment + """ + + print("Installing required python packages from 'requirements.txt'") + + # Install required Python packages with PIP + c.run('pip3 install -U -r requirements.txt') + + # Install pre-commit hook + c.run('pre-commit install') + @task def shell(c): """ @@ -253,7 +266,7 @@ def update(c): - static - clean_settings """ - + # Recompile the translation files (.mo) # We do not run 'invoke translate' here, as that will touch the source (.po) files too! manage(c, 'compilemessages', pty=True)