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

Replace requests/aiohttp with httpx #99

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ repos:
hooks:
- id: mypy
args: [--strict]
additional_dependencies: [types-requests, types-tqdm, types-tabulate, types-click, types-filelock, types-Pillow, pyarrow-stubs, pydantic, aiohttp]
additional_dependencies: [types-tqdm, types-tabulate, types-click, types-filelock, types-Pillow, pyarrow-stubs, pydantic, httpx]
exclude: ^tests/
706 changes: 127 additions & 579 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ homepage = "https://github.com/togethercomputer/together-python"
[tool.poetry.dependencies]
python = "^3.8"
typer = ">=0.9,<0.13"
requests = "^2.31.0"
tqdm = "^4.66.2"
tabulate = "^0.9.0"
pydantic = "^2.6.3"
aiohttp = "^3.9.3"
filelock = "^3.13.1"
eval-type-backport = "^0.1.3"
click = "^8.1.7"
Expand All @@ -44,6 +42,7 @@ numpy = [
{ version = ">=1.23.5", python = "<3.12" },
{ version = ">=1.26.0", python = ">=3.12" },
]
httpx = {extras = ["http2"], version = "^0.27.0"}

[tool.poetry.group.quality]
optional = true
Expand All @@ -54,7 +53,6 @@ ruff = "^0.3.2"
types-tqdm = "^4.65.0.0"
types-tabulate = "^0.9.0.3"
pre-commit = "3.5.0"
types-requests = "^2.31.0.20240218"
pyarrow-stubs = "^10.0.1.7"
mypy = "^1.9.0"

Expand Down
12 changes: 5 additions & 7 deletions src/together/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,11 @@
log: str | None = None # Set to either 'debug' or 'info', controls console logging

if TYPE_CHECKING:
import requests
from aiohttp import ClientSession
import httpx

requestssession: "requests.Session" | Callable[[], "requests.Session"] | None = None
http_client: "httpx.Client" | Callable[[], "httpx.Client"] | None = None

aiosession: ContextVar["ClientSession" | None] = ContextVar(
"aiohttp-session", default=None
)
async_http_client: "httpx.AsyncClient" | Callable[[], "httpx.AsyncClient"] | None = None

from together.client import AsyncClient, AsyncTogether, Client, Together

Expand All @@ -46,7 +43,8 @@


__all__ = [
"aiosession",
"http_client",
"async_http_client",
"constants",
"version",
"Together",
Expand Down
Loading