|
1 |
| -.PHONY: all clean docs_build docs_clean docs_linkcheck api_docs_build api_docs_clean api_docs_linkcheck |
| 1 | +.PHONY: all clean help docs_build docs_clean docs_linkcheck api_docs_build api_docs_clean api_docs_linkcheck spell_check spell_fix lint lint_package lint_tests format format_diff |
2 | 2 |
|
3 |
| -# Default target executed when no arguments are given to make. |
| 3 | +## help: Show this help info. |
| 4 | +help: Makefile |
| 5 | + @printf "\n\033[1mUsage: make <TARGETS> ...\033[0m\n\n\033[1mTargets:\033[0m\n\n" |
| 6 | + @sed -n 's/^##//p' $< | awk -F':' '{printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | sort | sed -e 's/^/ /' |
| 7 | + |
| 8 | +## all: Default target, shows help. |
4 | 9 | all: help
|
5 | 10 |
|
| 11 | +## clean: Clean documentation and API documentation artifacts. |
| 12 | +clean: docs_clean api_docs_clean |
6 | 13 |
|
7 | 14 | ######################
|
8 | 15 | # DOCUMENTATION
|
9 | 16 | ######################
|
10 | 17 |
|
11 |
| -clean: docs_clean api_docs_clean |
12 |
| - |
13 |
| - |
| 18 | +## docs_build: Build the documentation. |
14 | 19 | docs_build:
|
15 | 20 | docs/.local_build.sh
|
16 | 21 |
|
| 22 | +## docs_clean: Clean the documentation build artifacts. |
17 | 23 | docs_clean:
|
18 | 24 | @if [ -d _dist ]; then \
|
19 |
| - rm -r _dist; \ |
20 |
| - echo "Directory _dist has been cleaned."; \ |
| 25 | + rm -r _dist; \ |
| 26 | + echo "Directory _dist has been cleaned."; \ |
21 | 27 | else \
|
22 |
| - echo "Nothing to clean."; \ |
| 28 | + echo "Nothing to clean."; \ |
23 | 29 | fi
|
24 | 30 |
|
| 31 | +## docs_linkcheck: Run linkchecker on the documentation. |
25 | 32 | docs_linkcheck:
|
26 | 33 | poetry run linkchecker _dist/docs/ --ignore-url node_modules
|
27 | 34 |
|
| 35 | +## api_docs_build: Build the API Reference documentation. |
28 | 36 | api_docs_build:
|
29 | 37 | poetry run python docs/api_reference/create_api_rst.py
|
30 | 38 | cd docs/api_reference && poetry run make html
|
31 | 39 |
|
| 40 | +## api_docs_clean: Clean the API Reference documentation build artifacts. |
32 | 41 | api_docs_clean:
|
33 | 42 | find ./docs/api_reference -name '*_api_reference.rst' -delete
|
34 | 43 | cd docs/api_reference && poetry run make clean
|
35 | 44 |
|
| 45 | +## api_docs_linkcheck: Run linkchecker on the API Reference documentation. |
36 | 46 | api_docs_linkcheck:
|
37 | 47 | poetry run linkchecker docs/api_reference/_build/html/index.html
|
38 | 48 |
|
| 49 | +## spell_check: Run codespell on the project. |
39 | 50 | spell_check:
|
40 | 51 | poetry run codespell --toml pyproject.toml
|
41 | 52 |
|
| 53 | +## spell_fix: Run codespell on the project and fix the errors. |
42 | 54 | spell_fix:
|
43 | 55 | poetry run codespell --toml pyproject.toml -w
|
44 | 56 |
|
45 | 57 | ######################
|
46 | 58 | # LINTING AND FORMATTING
|
47 | 59 | ######################
|
48 | 60 |
|
| 61 | +## lint: Run linting on the project. |
49 | 62 | lint lint_package lint_tests:
|
50 | 63 | poetry run ruff docs templates cookbook
|
51 | 64 | poetry run ruff format docs templates cookbook --diff
|
52 | 65 | poetry run ruff --select I docs templates cookbook
|
53 | 66 | git grep 'from langchain import' docs/docs templates cookbook | grep -vE 'from langchain import (hub)' && exit 1 || exit 0
|
54 | 67 |
|
| 68 | +## format: Format the project files. |
55 | 69 | format format_diff:
|
56 | 70 | poetry run ruff format docs templates cookbook
|
57 | 71 | poetry run ruff --select I --fix docs templates cookbook
|
58 |
| - |
59 |
| - |
60 |
| -###################### |
61 |
| -# HELP |
62 |
| -###################### |
63 |
| - |
64 |
| -help: |
65 |
| - @echo '====================' |
66 |
| - @echo '-- DOCUMENTATION --' |
67 |
| - @echo 'clean - run docs_clean and api_docs_clean' |
68 |
| - @echo 'docs_build - build the documentation' |
69 |
| - @echo 'docs_clean - clean the documentation build artifacts' |
70 |
| - @echo 'docs_linkcheck - run linkchecker on the documentation' |
71 |
| - @echo 'api_docs_build - build the API Reference documentation' |
72 |
| - @echo 'api_docs_clean - clean the API Reference documentation build artifacts' |
73 |
| - @echo 'api_docs_linkcheck - run linkchecker on the API Reference documentation' |
74 |
| - @echo 'spell_check - run codespell on the project' |
75 |
| - @echo 'spell_fix - run codespell on the project and fix the errors' |
76 |
| - @echo '-- TEST and LINT tasks are within libs/*/ per-package --' |
0 commit comments