Skip to content
Merged
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
22 changes: 11 additions & 11 deletions src/hip/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from . import backends, parsers, transports
from ._client import Client
from ._content import HTML, JSON, Binary, Content, Text
from ._forms import File, Files, Form, MultiPart
from ._headers import Headers
from ._queryparams import QueryParams
from ._request import Method, Request
from ._response import Response, StatusCode
from ._server import Server
from ._streams import Stream
from ._timeouts import sleep, timeout
from ._urls import URL
from .client import Client
from .core.content import HTML, JSON, Binary, Content, Text
from .core.forms import File, Files, Form, MultiPart
from .core.headers import Headers
from .core.queryparams import QueryParams
from .core.request import Method, Request
from .core.response import Response, StatusCode
from .core.streams import Stream
from .core.timeouts import sleep, timeout
from .core.urls import URL
from .server import Server

__all__ = [
"HTML",
Expand Down
4 changes: 2 additions & 2 deletions src/hip/backends/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# Once we drop 3.10 support, we can use 'typing.Self'.
from typing_extensions import Self

from .._streams import Stream
from .._timeouts import get_current_timeout
from ..core.streams import Stream
from ..core.timeouts import get_current_timeout

@lovelydinosaur lovelydinosaur Nov 10, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I (think?) these could go into the sync module, since they're a context managed equivalent of async style timeout-blocks.

Shall we consider that separately?


__all__ = ["NetworkBackend", "NetworkStream"]

Expand Down
2 changes: 1 addition & 1 deletion src/hip/_body.py → src/hip/body.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import io
import zlib

from ._streams import Stream
from .core.streams import Stream
from .parsers import HTTPParser

__all__ = ["GZipStream", "HTTPStream"]
Expand Down
10 changes: 5 additions & 5 deletions src/hip/_client.py → src/hip/client.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import types
import typing

from ._content import HTML, JSON, Binary, Content, Text, select_media
from ._headers import Headers
from ._request import Method, Request
from ._response import Response
from ._urls import URL
from .core.content import HTML, JSON, Binary, Content, Text, select_media
from .core.headers import Headers
from .core.request import Method, Request
from .core.response import Response
from .core.urls import URL
from .transports import ConnectionPool, SendContext, Transport

__all__ = ["Client"]
Expand Down
32 changes: 32 additions & 0 deletions src/hip/core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from .content import HTML, JSON, Binary, Content, Empty, Text
from .forms import File, Files, Form, MultiPart
from .headers import Headers
from .queryparams import QueryParams
from .request import Method, Request
from .response import Response, StatusCode
from .streams import Stream
from .timeouts import sleep, timeout
from .urls import URL

__all__ = [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirely obvious to me if we want these types of export.
I think that's consistent with the rest of the codebase right now, though should they eventually stay or be dropped?

"HTML",
"JSON",
"URL",
"Binary",
"Content",
"Empty",
"File",
"Files",
"Form",
"Headers",
"Method",
"MultiPart",
"QueryParams",
"Request",
"Response",
"StatusCode",
"Stream",
"Text",
"sleep",
"timeout",
]
4 changes: 2 additions & 2 deletions src/hip/_content.py → src/hip/core/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import json
import typing

from ._headers import Headers, parse_opts_header
from ._streams import ByteStream, Stream
from .headers import Headers, parse_opts_header
from .streams import ByteStream, Stream

__all__ = [
"HTML",
Expand Down
8 changes: 4 additions & 4 deletions src/hip/_forms.py → src/hip/core/forms.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import os
import typing

from ._content import Content
from ._headers import Headers
from ._streams import ByteStream, FileStream, MultiPartStream, Stream
from ._urlencode import urldecode, urlencode
from .content import Content
from .headers import Headers
from .streams import ByteStream, FileStream, MultiPartStream, Stream
from .urlencode import urldecode, urlencode

__all__ = ["File", "Files", "Form", "MultiPart"]

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/hip/_queryparams.py → src/hip/core/queryparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import typing

from ._urlencode import urldecode, urlencode
from .urlencode import urldecode, urlencode

__all__ = ["QueryParams"]

Expand Down
6 changes: 3 additions & 3 deletions src/hip/_request.py → src/hip/core/request.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from ._content import Binary, Content, Empty
from ._headers import Headers
from ._urls import URL
from .content import Binary, Content, Empty
from .headers import Headers
from .urls import URL

__all__ = ["Method", "Request"]

Expand Down
4 changes: 2 additions & 2 deletions src/hip/_response.py → src/hip/core/response.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import typing

from ._content import Binary, Content, Empty
from ._headers import Headers
from .content import Binary, Content, Empty
from .headers import Headers

__all__ = ["Response", "StatusCode"]

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/hip/_urls.py → src/hip/core/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import typing

from ._queryparams import QueryParams
from ._urlencode import unquote
from ._urlparse import urlparse
from .queryparams import QueryParams
from .urlencode import unquote
from .urlparse import urlparse

__all__ = ["URL"]

Expand Down
2 changes: 1 addition & 1 deletion src/hip/parsers/http.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import enum
import time

from .._streams import Stream
from ..core.streams import Stream
from .exceptions import ProtocolError
from .readahead import ReadAheadParser

Expand Down
2 changes: 1 addition & 1 deletion src/hip/parsers/readahead.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .._streams import Stream
from ..core.streams import Stream
from .exceptions import ProtocolError


Expand Down
12 changes: 6 additions & 6 deletions src/hip/_server.py → src/hip/server.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import datetime
import logging

from ._body import HTTPStream
from ._content import Text
from ._headers import Headers
from ._request import Request
from ._response import Response
from ._timeouts import sleep
from .backends.sync import NetworkBackend
from .body import HTTPStream
from .core.content import Text
from .core.headers import Headers
from .core.request import Request
from .core.response import Response
from .core.timeouts import sleep
from .parsers import HTTPParser

__all__ = ["Server"]
Expand Down
12 changes: 6 additions & 6 deletions src/hip/transports/base.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import types

from .._content import Content
from .._headers import Headers
from .._request import Method, Request
from .._response import Response, StatusCode
from .._streams import Stream
from .._urls import URL
from ..core.content import Content
from ..core.headers import Headers
from ..core.request import Method, Request
from ..core.response import Response, StatusCode
from ..core.streams import Stream
from ..core.urls import URL

__all__ = ["SendContext", "Transport"]

Expand Down
14 changes: 7 additions & 7 deletions src/hip/transports/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
# Once we drop 3.10 support, we can use 'typing.Self'.
from typing_extensions import Self

from .._body import GZipStream, HTTPStream
from .._content import Content
from .._headers import Headers
from .._request import Method, Request
from .._response import Response, StatusCode
from .._streams import Stream
from .._urls import URL
from ..backends.sync import Lock, NetworkBackend
from ..body import GZipStream, HTTPStream
from ..core.content import Content
from ..core.headers import Headers
from ..core.request import Method, Request
from ..core.response import Response, StatusCode
from ..core.streams import Stream
from ..core.urls import URL
from ..parsers import HTTPParser
from .base import SendContext, Transport

Expand Down
4 changes: 2 additions & 2 deletions src/hip/transports/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# Once we drop 3.10 support, we can use 'typing.Self'.
from typing_extensions import Self

from .._request import Request
from .._urls import URL
from ..backends.sync import NetworkBackend, Semaphore
from ..core.request import Request
from ..core.urls import URL
from .base import SendContext, Transport
from .connection import (
Connection,
Expand Down
Loading