Skip to content

Commit

Permalink
↗️ migrate poetry to rye
Browse files Browse the repository at this point in the history
  • Loading branch information
shroominic committed Dec 12, 2023
1 parent 8987cda commit 1f62d1d
Show file tree
Hide file tree
Showing 27 changed files with 388 additions and 4,325 deletions.
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cpython@3.11.6
21 changes: 21 additions & 0 deletions dev-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# AUTO DEV SETUP

# check if rye is installed
if ! command -v rye &> /dev/null
then
echo "rye could not be found: installing now ..."
curl -sSf https://rye-up.com/get | bash
echo "Check the rye docs for more info: https://rye-up.com/"
fi

echo "SYNC: setup .venv"
rye sync

echo "ACTIVATE: activate .venv"
rye shell

echo "SETUP: install pre-commit hooks"
pre-commit install

echo "TESTING ..."
pytest
4,243 changes: 0 additions & 4,243 deletions poetry.lock

This file was deleted.

113 changes: 76 additions & 37 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,45 +1,84 @@
[tool.poetry]
[project]
name = "codeinterpreterapi"
version = "0.0.14"
authors = ["Shroominic <contact@shroominic.com>"]
license = "MIT"
description = "CodeInterpreterAPI is an (unofficial) open source python interface for the ChatGPT CodeInterpreter."
keywords = ["codeinterpreter", "chatgpt", "codeinterpreterapi", "api", "langchain", "codeboxapi"]
authors = [
{ name = "Shroominic", email = "contact@shroominic.com" }
]
dependencies = [
"openai",
"langchain",
"codeboxapi>=0.0.19",
"python-dotenv",
"pydantic>=2",
"pydantic-settings>=2",
]
license = { file = "LICENSE" }
readme = "README.md"
repository = "https://github.com/shroominic/codeinterpreter-api"

[tool.poetry.dependencies]
python = ">=3.9.7,<4.0"
langchain = ">=0.0.312"
codeboxapi = ">=0.0.19"
openai = "*"
python-dotenv = "*"
pydantic = "^2"
pydantic-settings = "^2"
mkdocs-material = ">=9.2.7"
streamlit = { version = "^1", optional = true }
jupyter-kernel-gateway = { version = "^2", optional = true }
Pillow = { version = ">=9,<11", optional = true }

[tool.poetry.extras]
all = ["jupyter-kernel-gateway", "streamlit", "Pillow"]
localbox = ["jupyter-kernel-gateway"]
frontend = ["streamlit"]
image_support = ["Pillow"]

[tool.poetry.group.dev]
optional = true
requires-python = ">= 3.9.7, <3.12"
keywords = ["codeinterpreter", "chatgpt", "codeinterpreterapi", "api", "langchain", "codeboxapi"]
classifiers = [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]

[project.urls]
Code = "https://github.com/shroominic/codeinterpreter-api"
Docs = "https://shroominic.github.io/codeinterpreter-api"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.rye]
managed = true
dev-dependencies = [
"ruff",
"mypy",
"isort",
"pytest",
"ipython",
"pre-commit",
"codeinterpreterapi[all]",
"mkdocs-material>=9.4",
]

[project.optional-dependencies]
localbox = [
"jupyter-kernel-gateway",
]
frontend = [
"streamlit",
]
image_support = [
"Pillow",
]
all = [
"jupyter-kernel-gateway",
"streamlit",
"Pillow",
]

[tool.hatch.metadata]
allow-direct-references = true

[tool.pytest.ini_options]
filterwarnings = "ignore::DeprecationWarning"
addopts = "-p no:warnings"

[tool.poetry.group.dev.dependencies]
pytest = ">=7.3"
mypy = ">=1.4"
black = "^23"
flake8 = "^6"
pre-commit = ">=3.3"
[tool.isort]
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
line_length = 120

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.flake8]
max-line-length = 120

[tool.mypy]
ignore_missing_imports = true
disallow_untyped_defs = true
disallow_untyped_calls = true
disallow_incomplete_defs = true
178 changes: 178 additions & 0 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
# generated by rye
# use `rye lock` or `rye sync` to update this lockfile
#
# last locked with the following flags:
# pre: false
# features: []
# all-features: false

-e file:.
aiohttp==3.9.1
aiosignal==1.3.1
altair==5.2.0
annotated-types==0.6.0
anyio==4.1.0
appnope==0.1.3
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==2.4.1
attrs==23.1.0
babel==2.13.1
beautifulsoup4==4.12.2
bleach==6.1.0
blinker==1.7.0
cachetools==5.3.2
certifi==2023.11.17
cffi==1.16.0
cfgv==3.4.0
charset-normalizer==3.3.2
click==8.1.7
codeboxapi==0.0.19
colorama==0.4.6
comm==0.2.0
dataclasses-json==0.6.3
debugpy==1.8.0
decorator==5.1.1
defusedxml==0.7.1
distlib==0.3.8
distro==1.8.0
entrypoints==0.4
executing==2.0.1
fastjsonschema==2.19.0
filelock==3.13.1
fqdn==1.5.1
frozenlist==1.4.0
ghp-import==2.1.0
gitdb==4.0.11
gitpython==3.1.40
h11==0.14.0
httpcore==1.0.2
httpx==0.25.2
identify==2.5.33
idna==3.6
importlib-metadata==6.11.0
iniconfig==2.0.0
ipykernel==6.27.1
ipython==8.18.1
ipython-genutils==0.2.0
isoduration==20.11.0
isort==5.13.1
jedi==0.19.1
jinja2==3.1.2
jsonpatch==1.33
jsonpointer==2.4
jsonschema==4.20.0
jsonschema-specifications==2023.11.2
jupyter-client==7.4.9
jupyter-core==5.5.0
jupyter-events==0.9.0
jupyter-kernel-gateway==2.5.2
jupyter-server==2.12.1
jupyter-server-terminals==0.5.0
jupyterlab-pygments==0.3.0
langchain==0.0.349
langchain-community==0.0.1
langchain-core==0.0.13
langsmith==0.0.69
markdown==3.5.1
markdown-it-py==3.0.0
markupsafe==2.1.3
marshmallow==3.20.1
matplotlib-inline==0.1.6
mdurl==0.1.2
mergedeep==1.3.4
mistune==3.0.2
mkdocs==1.5.3
mkdocs-material==9.5.2
mkdocs-material-extensions==1.3.1
multidict==6.0.4
mypy==1.7.1
mypy-extensions==1.0.0
nbclassic==1.0.0
nbclient==0.9.0
nbconvert==7.12.0
nbformat==5.9.2
nest-asyncio==1.5.8
nodeenv==1.8.0
notebook==6.5.6
notebook-shim==0.2.3
numpy==1.26.2
openai==1.3.8
overrides==7.4.0
packaging==23.2
paginate==0.5.6
pandas==2.1.4
pandocfilters==1.5.0
parso==0.8.3
pathspec==0.12.1
pexpect==4.9.0
pillow==10.1.0
platformdirs==4.1.0
pluggy==1.3.0
pre-commit==3.6.0
prometheus-client==0.19.0
prompt-toolkit==3.0.41
protobuf==4.25.1
psutil==5.9.6
ptyprocess==0.7.0
pure-eval==0.2.2
pyarrow==14.0.1
pycparser==2.21
pydantic==2.5.2
pydantic-core==2.14.5
pydantic-settings==2.1.0
pydeck==0.8.1b0
pygments==2.17.2
pymdown-extensions==10.5
pytest==7.4.3
python-dateutil==2.8.2
python-dotenv==1.0.0
python-json-logger==2.0.7
pytz==2023.3.post1
pyyaml==6.0.1
pyyaml-env-tag==0.1
pyzmq==24.0.1
referencing==0.32.0
regex==2023.10.3
requests==2.31.0
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rich==13.7.0
rpds-py==0.13.2
ruff==0.1.7
send2trash==1.8.2
six==1.16.0
smmap==5.0.1
sniffio==1.3.0
soupsieve==2.5
sqlalchemy==2.0.23
stack-data==0.6.3
streamlit==1.29.0
tenacity==8.2.3
terminado==0.18.0
tinycss2==1.2.1
toml==0.10.2
toolz==0.12.0
tornado==6.4
tqdm==4.66.1
traitlets==5.14.0
types-python-dateutil==2.8.19.14
typing-extensions==4.9.0
typing-inspect==0.9.0
tzdata==2023.3
tzlocal==5.2
uri-template==1.3.0
urllib3==2.1.0
validators==0.22.0
virtualenv==20.25.0
watchdog==3.0.0
wcwidth==0.2.12
webcolors==1.13
webencodings==0.5.1
websocket-client==1.7.0
websockets==11.0.3
yarl==1.9.4
zipp==3.17.0
# The following packages are considered to be unsafe in a requirements file:
setuptools==69.0.2
51 changes: 51 additions & 0 deletions requirements.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# generated by rye
# use `rye lock` or `rye sync` to update this lockfile
#
# last locked with the following flags:
# pre: false
# features: []
# all-features: false

-e file:.
aiohttp==3.9.1
aiosignal==1.3.1
annotated-types==0.6.0
anyio==4.1.0
attrs==23.1.0
certifi==2023.11.17
charset-normalizer==3.3.2
codeboxapi==0.0.19
dataclasses-json==0.6.3
distro==1.8.0
frozenlist==1.4.0
h11==0.14.0
httpcore==1.0.2
httpx==0.25.2
idna==3.6
jsonpatch==1.33
jsonpointer==2.4
langchain==0.0.349
langchain-community==0.0.1
langchain-core==0.0.13
langsmith==0.0.69
marshmallow==3.20.1
multidict==6.0.4
mypy-extensions==1.0.0
numpy==1.26.2
openai==1.3.8
packaging==23.2
pydantic==2.5.2
pydantic-core==2.14.5
pydantic-settings==2.1.0
python-dotenv==1.0.0
pyyaml==6.0.1
requests==2.31.0
sniffio==1.3.0
sqlalchemy==2.0.23
tenacity==8.2.3
tqdm==4.66.1
typing-extensions==4.9.0
typing-inspect==0.9.0
urllib3==2.1.0
websockets==11.0.3
yarl==1.9.4
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ def _parse_ai_message(message: BaseMessage) -> Union[AgentAction, AgentFinish]:
)

return AgentFinish(
return_values={"output": message.content}, log=message.content
return_values={"output": message.content}, log=message.content # type: ignore
)

def parse_result(self, result: List[Generation]) -> Union[AgentAction, AgentFinish]:
def parse_result(self, result: List[Generation]) -> Union[AgentAction, AgentFinish]: # type: ignore
if not isinstance(result[0], ChatGeneration):
raise ValueError("This output parser only works on ChatGeneration output")
message = result[0].message
Expand Down
File renamed without changes.
Loading

0 comments on commit 1f62d1d

Please sign in to comment.