Skip to content

Commit 0d125b1

Browse files
Add files via upload
1 parent 99a8396 commit 0d125b1

File tree

18 files changed

+1766
-0
lines changed

18 files changed

+1766
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 LangChain
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
.PHONY: all format lint test tests test_watch integration_tests docker_tests help extended_tests
2+
3+
# Default target executed when no arguments are given to make.
4+
all: help
5+
6+
# Define a variable for the test file path.
7+
TEST_FILE ?= tests/unit_tests/
8+
9+
test:
10+
python -m pytest $(TEST_FILE)
11+
12+
test_watch:
13+
python -m ptw --snapshot-update --now . -- -vv tests/unit_tests
14+
15+
test_profile:
16+
python -m pytest -vv tests/unit_tests/ --profile-svg
17+
18+
extended_tests:
19+
python -m pytest --only-extended $(TEST_FILE)
20+
21+
22+
######################
23+
# LINTING AND FORMATTING
24+
######################
25+
26+
# Define a variable for Python and notebook files.
27+
PYTHON_FILES=src/
28+
MYPY_CACHE=.mypy_cache
29+
lint format: PYTHON_FILES=.
30+
lint_diff format_diff: PYTHON_FILES=$(shell git diff --name-only --diff-filter=d main | grep -E '\.py$$|\.ipynb$$')
31+
lint_package: PYTHON_FILES=src
32+
lint_tests: PYTHON_FILES=tests
33+
lint_tests: MYPY_CACHE=.mypy_cache_test
34+
35+
lint lint_diff lint_package lint_tests:
36+
python -m ruff check .
37+
[ "$(PYTHON_FILES)" = "" ] || python -m ruff format $(PYTHON_FILES) --diff
38+
[ "$(PYTHON_FILES)" = "" ] || python -m ruff check --select I $(PYTHON_FILES)
39+
[ "$(PYTHON_FILES)" = "" ] || python -m mypy --strict $(PYTHON_FILES)
40+
[ "$(PYTHON_FILES)" = "" ] || mkdir -p $(MYPY_CACHE) && python -m mypy --strict $(PYTHON_FILES) --cache-dir $(MYPY_CACHE)
41+
42+
format format_diff:
43+
ruff format $(PYTHON_FILES)
44+
ruff check --select I --fix $(PYTHON_FILES)
45+
46+
spell_check:
47+
codespell --toml pyproject.toml
48+
49+
spell_fix:
50+
codespell --toml pyproject.toml -w
51+
52+
######################
53+
# HELP
54+
######################
55+
56+
help:
57+
@echo '----'
58+
@echo 'format - run code formatters'
59+
@echo 'lint - run linters'
60+
@echo 'test - run unit tests'
61+
@echo 'tests - run unit tests'
62+
@echo 'test TEST_FILE=<test_file> - run all tests in file'
63+
@echo 'test_watch - run unit tests in watch mode'
64+

0 commit comments

Comments
 (0)