2023-06-26 14:50:06 +00:00
|
|
|
# Run tests and linters
|
|
|
|
|
@default: test lint
|
|
|
|
|
|
2023-07-02 19:36:22 +00:00
|
|
|
# Install dependencies and test dependencies
|
|
|
|
|
@init:
|
|
|
|
|
pipenv run pip install -e '.[test]'
|
|
|
|
|
|
2023-06-26 14:50:06 +00:00
|
|
|
# Run pytest with supplied options
|
|
|
|
|
@test *options:
|
|
|
|
|
pipenv run pytest {{options}}
|
|
|
|
|
|
|
|
|
|
# Run linters
|
|
|
|
|
@lint:
|
2023-07-15 17:00:04 +00:00
|
|
|
echo "Linters..."
|
|
|
|
|
echo " Black"
|
2023-06-26 14:50:06 +00:00
|
|
|
pipenv run black . --check
|
2023-07-15 17:00:04 +00:00
|
|
|
echo " cog"
|
2023-08-12 06:19:56 +00:00
|
|
|
pipenv run cog --check \
|
|
|
|
|
-p "import sys, os; sys._called_from_test=True; os.environ['LLM_USER_PATH'] = '/tmp'" \
|
|
|
|
|
README.md docs/*.md
|
2023-07-15 17:00:04 +00:00
|
|
|
echo " mypy"
|
2023-07-02 19:36:22 +00:00
|
|
|
pipenv run mypy llm
|
2023-07-15 17:00:04 +00:00
|
|
|
echo " ruff"
|
2024-07-18 19:06:41 +00:00
|
|
|
pipenv run ruff check .
|
2023-06-26 14:50:06 +00:00
|
|
|
|
2023-09-09 19:19:59 +00:00
|
|
|
# Run mypy
|
|
|
|
|
@mypy:
|
|
|
|
|
pipenv run mypy llm
|
|
|
|
|
|
2023-06-26 14:50:06 +00:00
|
|
|
# Rebuild docs with cog
|
|
|
|
|
@cog:
|
2025-05-25 02:43:22 +00:00
|
|
|
pipenv run cog -r -p "import sys, os; sys._called_from_test=True; os.environ['LLM_USER_PATH'] = '/tmp'" docs/**/*.md docs/*.md README.md
|
2023-06-26 14:50:06 +00:00
|
|
|
|
|
|
|
|
# Serve live docs on localhost:8000
|
|
|
|
|
@docs: cog
|
2023-08-21 05:16:33 +00:00
|
|
|
rm -rf docs/_build
|
2023-06-26 14:50:06 +00:00
|
|
|
cd docs && pipenv run make livehtml
|
|
|
|
|
|
|
|
|
|
# Apply Black
|
|
|
|
|
@black:
|
|
|
|
|
pipenv run black .
|
2023-07-03 00:40:45 +00:00
|
|
|
|
|
|
|
|
# Run automatic fixes
|
2023-07-10 14:41:49 +00:00
|
|
|
@fix: cog
|
2024-07-18 19:06:41 +00:00
|
|
|
pipenv run ruff check . --fix
|
2023-07-10 14:41:49 +00:00
|
|
|
pipenv run black .
|
2023-08-28 03:20:32 +00:00
|
|
|
|
|
|
|
|
# Push commit if tests pass
|
|
|
|
|
@push: test lint
|
|
|
|
|
git push
|