Skip to content

Instantly share code, notes, and snippets.

@thingsiplay
Created March 25, 2022 13:59
Show Gist options
  • Save thingsiplay/556d0b5a7933c3d202536203e317bfcd to your computer and use it in GitHub Desktop.
Save thingsiplay/556d0b5a7933c3d202536203e317bfcd to your computer and use it in GitHub Desktop.
py - check Python script with mypy and flake8, then execute it
#!/bin/env bash
# py - check Python script with mypy and flake8, then execute it
export PATH=".:$PATH"
file=$(/usr/bin/which --skip-alias --skip-functions "$1")
shift
export MYPY_CACHE_DIR="/tmp/.mypy_cache"
mkdir -p "$MYPY_CACHE_DIR"
mypy "$file" \
&& flake8 "$file" \
&& python3 "$file" "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment