mirror of
https://github.com/pstrueb/piper.git
synced 2026-04-19 14:54:50 +00:00
Starting on Python inference
This commit is contained in:
29
src/python_run/scripts/check.sh
Executable file
29
src/python_run/scripts/check.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Runs formatters, linters, and type checkers on Python code.
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
# Directory of *this* script
|
||||
this_dir="$( cd "$( dirname "$0" )" && pwd )"
|
||||
|
||||
base_dir="$(realpath "${this_dir}/..")"
|
||||
|
||||
# Path to virtual environment
|
||||
: "${venv:=${base_dir}/.venv}"
|
||||
|
||||
if [ -d "${venv}" ]; then
|
||||
# Activate virtual environment if available
|
||||
source "${venv}/bin/activate"
|
||||
fi
|
||||
|
||||
python_files=("${base_dir}/larynx")
|
||||
|
||||
# Format code
|
||||
black "${python_files[@]}"
|
||||
isort "${python_files[@]}"
|
||||
|
||||
# Check
|
||||
flake8 "${python_files[@]}"
|
||||
pylint "${python_files[@]}"
|
||||
mypy "${python_files[@]}"
|
||||
17
src/python_run/scripts/larynx
Executable file
17
src/python_run/scripts/larynx
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
# Directory of *this* script
|
||||
this_dir="$( cd "$( dirname "$0" )" && pwd )"
|
||||
|
||||
base_dir="$(realpath "${this_dir}/..")"
|
||||
|
||||
# Path to virtual environment
|
||||
: "${venv:=${base_dir}/.venv}"
|
||||
|
||||
if [ -d "${venv}" ]; then
|
||||
# Activate virtual environment if available
|
||||
source "${venv}/bin/activate"
|
||||
fi
|
||||
|
||||
python3 -m larynx "$@"
|
||||
33
src/python_run/scripts/setup.sh
Executable file
33
src/python_run/scripts/setup.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
# Directory of *this* script
|
||||
this_dir="$( cd "$( dirname "$0" )" && pwd )"
|
||||
|
||||
# Base directory of repo
|
||||
base_dir="$(realpath "${this_dir}/..")"
|
||||
|
||||
# Path to virtual environment
|
||||
: "${venv:=${base_dir}/.venv}"
|
||||
|
||||
# Python binary to use
|
||||
: "${PYTHON=python3}"
|
||||
|
||||
python_version="$(${PYTHON} --version)"
|
||||
|
||||
# Create virtual environment
|
||||
echo "Creating virtual environment at ${venv} (${python_version})"
|
||||
rm -rf "${venv}"
|
||||
"${PYTHON}" -m venv "${venv}"
|
||||
source "${venv}/bin/activate"
|
||||
|
||||
# Install Python dependencies
|
||||
echo 'Installing Python dependencies'
|
||||
pip3 install --upgrade pip
|
||||
pip3 install --upgrade wheel setuptools
|
||||
|
||||
pip3 install -r "${base_dir}/requirements.txt"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
echo "OK"
|
||||
Reference in New Issue
Block a user