Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update lock file / lint #22

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions docs/source/ast.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,7 @@
"tags": []
},
"outputs": [],
"source": [
"from kork.ast import FunctionCall, FunctionDef"
]
"source": []
},
{
"cell_type": "code",
Expand Down
4 changes: 2 additions & 2 deletions docs/source/calculator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"import math\n",
"import operator\n",
"\n",
"import langchain\n",
"from langchain.llms import OpenAI\n",
"\n",
"from kork import CodeChain\n",
"from kork.parser import parse"
]
Expand Down Expand Up @@ -166,7 +166,7 @@
},
"outputs": [],
"source": [
"from kork.display import display_html_results, as_html_dict"
"from kork.display import as_html_dict, display_html_results"
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions docs/source/examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
},
"outputs": [],
"source": [
"from kork.ast import Program, VarDecl, Literal"
"from kork.ast import Literal, Program, VarDecl"
]
},
{
Expand Down Expand Up @@ -185,8 +185,8 @@
},
"outputs": [],
"source": [
"from kork.examples import format_examples\n",
"from kork import AstPrinter"
"from kork import AstPrinter\n",
"from kork.examples import format_examples"
]
},
{
Expand Down
10 changes: 4 additions & 6 deletions docs/source/examples/image_manipulation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
},
"outputs": [],
"source": [
"from PIL import Image, ImageOps, ImageFilter"
"from PIL import Image, ImageFilter, ImageOps"
]
},
{
Expand Down Expand Up @@ -328,13 +328,10 @@
},
"outputs": [],
"source": [
"from typing import List, Any, Optional\n",
"\n",
"import langchain\n",
"from langchain.llms import OpenAI\n",
"\n",
"from kork.parser import parse\n",
"from kork import InterpreterResult, Environment, run_interpreter, CodeChain"
"from kork import CodeChain, run_interpreter\n",
"from kork.parser import parse"
]
},
{
Expand Down Expand Up @@ -438,6 +435,7 @@
],
"source": [
"from io import BytesIO\n",
"\n",
"import requests\n",
"\n",
"\n",
Expand Down
3 changes: 1 addition & 2 deletions docs/source/introduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"outputs": [],
"source": [
"import langchain\n",
"from langchain.chat_models import ChatOpenAI\n",
"from langchain.llms import OpenAI\n",
"\n",
"from kork import CodeChain"
Expand Down Expand Up @@ -100,7 +99,7 @@
"def output_with_matplotlib(output: str) -> None:\n",
" \"\"\"Function that will output a plot using matplotlib.\"\"\"\n",
" if not isinstance(output, str):\n",
" raise ValueError(f\"LLM failed to produce a string!\")\n",
" raise ValueError(\"LLM failed to produce a string!\")\n",
"\n",
" import matplotlib.pyplot as plt\n",
"\n",
Expand Down
4 changes: 1 addition & 3 deletions docs/source/language.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,7 @@
"tags": []
},
"outputs": [],
"source": [
"from kork import Environment"
]
"source": []
},
{
"cell_type": "code",
Expand Down
11 changes: 4 additions & 7 deletions docs/source/prompt.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,14 @@
"outputs": [],
"source": [
"import math\n",
"import langchain\n",
"\n",
"from langchain import PromptTemplate\n",
"\n",
"from kork import (\n",
" CodeChain,\n",
" ast,\n",
" AstPrinter,\n",
" c_,\n",
" r_,\n",
" run_interpreter,\n",
")\n",
"from langchain import PromptTemplate\n",
"from kork import SimpleContextRetriever"
")"
]
},
{
Expand Down
4 changes: 3 additions & 1 deletion docs/source/query_analyzer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@
},
"outputs": [],
"source": [
"from typing import Any, List\n",
"\n",
"import langchain\n",
"from langchain.llms import OpenAI\n",
"from typing import List, Any\n",
"\n",
"from kork import CodeChain"
]
},
Expand Down
10 changes: 5 additions & 5 deletions docs/source/retrievers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@
},
"outputs": [],
"source": [
"from kork import SimpleContextRetriever\n",
"import math"
"import math\n",
"\n",
"from kork import SimpleContextRetriever"
]
},
{
Expand Down Expand Up @@ -186,7 +187,7 @@
},
"outputs": [],
"source": [
"from kork import c_, r_, AstPrinter, SimpleExampleRetriever"
"from kork import AstPrinter, SimpleExampleRetriever, c_, r_"
]
},
{
Expand Down Expand Up @@ -262,9 +263,8 @@
"outputs": [],
"source": [
"from kork import (\n",
" CodeChain,\n",
" ast,\n",
" AstPrinter,\n",
" CodeChain,\n",
")"
]
},
Expand Down
3,601 changes: 1,944 additions & 1,657 deletions poetry.lock

Large diffs are not rendered by default.

52 changes: 36 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,60 +9,68 @@ repository = "https://github.com/langchain-ai/kork"

[tool.poetry.dependencies]
python = "^3.8.1"
openai = "^0.27"
langchain = ">=0.0.110"
openai = ">=0.27"
langchain = ">=0.0.330"
lark = "^1.1.5"
sphinx-design = "^0.4.1"

[tool.poetry.group.dev.dependencies]
jupyterlab = "^3.6.1"

[tool.poetry.group.test.dependencies]
pytest = "^7.2.1"
black = { version="^23.1.0", extras=["jupyter"] }
poethepoet = "^0.18.1"
ruff = "^0.0.255"
pytest = "^7.2.1"
pytest-cov = "^4.0.0"
pytest-asyncio = "^0.21.1"
pytest-mock = "^3.11.1"
pytest-socket = "^0.6.0"
pytest-watch = "^4.2.0"
pytest-timeout = "^2.2.0"

[tool.poetry.group.lint.dependencies]
ruff = "^0.1.5"


[tool.poetry.group.docs.dependencies]
nbsphinx = "^0.8.9"
sphinx = "^4.5.0"
sphinx-autobuild = "^2021.3.14"
sphinx-design = "^0.4.1"
sphinx_book_theme = "^1.0.0"
myst-nb = "^0.17.1"
linkchecker = "^10.2.1"
toml = "^0.10.2"
sphinx-copybutton = "^0.5.1"

[tool.poetry.group.typing.dependencies]
mypy = "^0.991"
mypy = "^1.7.0"

[tool.poetry.group.types.dependencies]
types-toml = "^0.10.8.5"

[tool.poe.tasks]
black = "black"
ruff = "ruff"
pytest.cmd = "py.test --durations=5 -W error::RuntimeWarning --cov --cov-config=.coveragerc --cov-report xml --cov-report term-missing:skip-covered"
mypy = "mypy . --pretty --show-error-codes"
fix = { shell = "poe black . && poe ruff --fix ." }
fix = { shell = "poe ruff format . && poe ruff --select I --fix ." }
# Using a --preview feature. Commit your code prior to use this fix.
fix_strings = "black kork --preview"
test = { shell = "poe black . --check --diff && poe ruff . && poe pytest && poe mypy" }
test = { shell = "poe ruff . && poe pytest && poe mypy" }
# Use to auto-generate docs
apidoc = "sphinx-apidoc -o docs/source/generated kork"


[tool.ruff]
select = [
"E", # pycodestyle
"F", # pyflakes
"I", # isort
"E", # pycodestyle
"F", # pyflakes
"I", # isort
]
extend-include = ["*.ipynb"]

# Same as Black.
line-length = 88

[tool.ruff.extend-per-file-ignores]
"*.ipynb" = ["E402"]

[tool.mypy]
disallow_untyped_defs = "True"
ignore_missing_imports = "True"
Expand All @@ -74,5 +82,17 @@ omit = [


[build-system]
requires = ["poetry-core>=1.0.0"]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.pytest.ini_options]
# --strict-markers will raise errors on unknown marks.
# https://docs.pytest.org/en/7.1.x/how-to/mark.html#raising-errors-on-unknown-marks
#
# https://docs.pytest.org/en/7.1.x/reference/reference.html
# --strict-config any warnings encountered while parsing the `pytest`
# section of the configuration file raise errors.
addopts = "--strict-markers --strict-config --durations=5 -vv"
# Global timeout for all tests. There shuold be a good reason for a test to
# take more than 5 second
timeout = 5
Loading