forked from guardrails-ai/guardrails
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
79 lines (59 loc) · 2.23 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
MKDOCS_SERVE_ADDR ?= localhost:8000 # Default address for mkdocs serve, format: <host>:<port>, override with `make docs-serve MKDOCS_SERVE_ADDR=<host>:<port>`
autoformat:
poetry run black guardrails/ tests/
poetry run isort --atomic guardrails/ tests/
poetry run docformatter --in-place --recursive guardrails tests
type:
poetry run pyright guardrails/
type-pydantic-v1-openai-v0:
echo '{"exclude": ["guardrails/utils/pydantic_utils/v2.py", "guardrails/utils/openai_utils/v1.py"]}' > pyrightconfig.json
poetry run pyright guardrails/
rm pyrightconfig.json
type-pydantic-v1-openai-v1:
echo '{"exclude": ["guardrails/utils/pydantic_utils/v2.py", "guardrails/utils/openai_utils/v0.py"]}' > pyrightconfig.json
poetry run pyright guardrails/
rm pyrightconfig.json
type-pydantic-v2-openai-v0:
echo '{"exclude": ["guardrails/utils/pydantic_utils/v1.py", "guardrails/utils/openai_utils/v1.py"]}' > pyrightconfig.json
poetry run pyright guardrails/
rm pyrightconfig.json
type-pydantic-v2-openai-v1:
echo '{"exclude": ["guardrails/utils/pydantic_utils/v1.py", "guardrails/utils/openai_utils/v0.py"]}' > pyrightconfig.json
poetry run pyright guardrails/
rm pyrightconfig.json
lint:
poetry run isort -c guardrails/ tests/
poetry run black guardrails/ tests/ --check
poetry run flake8 guardrails/ tests/
test:
poetry run pytest tests/
test-basic:
set -e
python -c "import guardrails as gd"
python -c "import guardrails.version as mversion"
test-cov:
poetry run pytest tests/ --cov=./guardrails/ --cov-report=xml
view-test-cov:
poetry run pytest tests/ --cov=./guardrails/ --cov-report html && open htmlcov/index.html
view-test-cov-file:
poetry run pytest tests/unit_tests/test_logger.py --cov=./guardrails/ --cov-report html && open htmlcov/index.html
docs-serve:
poetry run mkdocs serve -a $(MKDOCS_SERVE_ADDR)
docs-deploy:
poetry run mkdocs gh-deploy
dev:
poetry install
full:
poetry install --all-extras
docs-gen:
poetry run python ./docs/pydocs/generate_pydocs.py
cp -r docs docs-build
poetry run nbdoc_build --force_all True --srcdir ./docs-build
self-install:
pip install -e .
all: autoformat type lint docs test
precommit:
# pytest -x -q --no-summary
pyright guardrails/
make lint
./github/workflows/scripts/update_notebook_matrix.sh