Improve scripts to support local library development

This commit is contained in:
Andras Schmelczer 2022-05-26 13:31:52 +02:00
parent b08e064e00
commit b5fb086d52
2 changed files with 21 additions and 13 deletions

View file

@ -1,20 +1,24 @@
#!/bin/bash
#!/bin/sh
set -e
echo "Installing dependencies if necessary"
python3 -m pip install --upgrade autoflake isort black black[jupyter] mypy
python3 -m pip install --upgrade autoflake isort black[jupyter] mypy
echo "Formatting and checking $1"
cd $1
echo Running autoflake
python3 -m autoflake --expand-star-imports --remove-all-unused-imports --ignore-init-module-imports --remove-unused-variables --in-place -r $1
python3 -m autoflake --expand-star-imports --remove-all-unused-imports --ignore-init-module-imports --remove-unused-variables --in-place -r .
echo Running isort
python3 -m isort --profile black --skip .env $1
python3 -m isort --profile black --skip .env .
echo Running black
python3 -m black $1 --exclude .env
python3 -m black . --exclude .env
echo Running mypy
python3 -m mypy --namespace-packages --ignore-missing-imports --install-types --non-interactive --disallow-untyped-defs --disallow-incomplete-defs --pretty --follow-imports=silent --exclude=external/ --exclude=/build/ $1
python3 -m mypy --namespace-packages --ignore-missing-imports --install-types --non-interactive --disallow-untyped-defs --disallow-incomplete-defs --pretty --follow-imports=silent --exclude=external/ --exclude=/build/ .
cd -