typeship 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
typeship-0.1.0/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 typeship
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,101 @@
1
+ Metadata-Version: 2.4
2
+ Name: typeship
3
+ Version: 0.1.0
4
+ Summary: Typed, zero-dependency Python SDK for typeship. Generated by typeship.
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://typeship.dev
7
+ Project-URL: Repository, https://github.com/typeship-ax/python
8
+ Keywords: typeship,sdk,api,api-client,client,python,openapi,typed
9
+ Requires-Python: >=3.11
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Dynamic: license-file
13
+
14
+ # typeship
15
+
16
+ Typed, zero-dependency Python SDK for **typeship** (v0.1.0).
17
+
18
+ Generated by [typeship](https://typeship.dev) from the OpenAPI spec — do not edit by hand; regenerate instead.
19
+
20
+ - **Zero runtime dependencies** — built on the standard library, nothing to install but Python
21
+ - **Typed payloads** — `TypedDict` models and `Literal` enums, with a `py.typed` marker so type checkers see them
22
+ - **Typed exceptions** — every documented error response has a class you can catch by name
23
+ - **Retries built in** — idempotent requests retry with exponential backoff and `Retry-After` support
24
+
25
+ ## Install
26
+
27
+ ```sh
28
+ pip install . # or copy the package directory into your project
29
+ ```
30
+
31
+ ## Quickstart
32
+
33
+ ```python
34
+ import os
35
+
36
+ from typeship import TypeshipClient
37
+
38
+ client = TypeshipClient(bearer_token=os.environ["TYPESHIP_TOKEN"])
39
+
40
+ for item in client.projects.list():
41
+ print(item)
42
+ ```
43
+
44
+ ## Authentication
45
+
46
+ - **Bearer token** — `bearer_token=` (a string, or a callable for tokens that expire), sent as `Authorization: Bearer <token>`.
47
+
48
+ `default_headers=` adds headers to every request (API version headers, tenant ids).
49
+
50
+ ## Async
51
+
52
+ `AsyncTypeshipClient` has the same methods, awaitable — pages and streams are `async for`. Requests run on the event loop's default executor, so nothing blocks the loop and there is still nothing to install:
53
+
54
+ ```python
55
+ from typeship import AsyncTypeshipClient
56
+
57
+ async with AsyncTypeshipClient(bearer_token=os.environ["TYPESHIP_TOKEN"]) as client:
58
+ async for item in client.projects.list():
59
+ print(item)
60
+ ```
61
+
62
+ ## Errors
63
+
64
+ Methods raise rather than returning a result, which is how Python SDKs read:
65
+
66
+ ```python
67
+ from typeship import ApiError, TransportError
68
+
69
+ try:
70
+ result = client.projects.get("id_123")
71
+ except ApiError as exc:
72
+ exc.status # the HTTP status
73
+ exc.body # the parsed error payload
74
+ exc.request_id # the API's request id, when it sent one
75
+ except TransportError:
76
+ ... # no response at all: network, DNS, timeout
77
+ ```
78
+
79
+ ## Runtime validation
80
+
81
+ Types catch mistakes when you compile; they cannot see an API that has drifted from its spec at runtime. `validate=True` checks JSON request and response bodies against the spec's own schemas — with no dependencies, since the schema tables ship as plain data in this package:
82
+
83
+ ```python
84
+ client = TypeshipClient(validate=True) # raises ValidationError on mismatch
85
+ client = TypeshipClient(validate="warn") # logs a warning and proceeds
86
+ ```
87
+
88
+ A request body is checked before it reaches the wire, so a call that would have been rejected never leaves the process. `ValidationError.violations` lists each path and what was wrong with it. Off by default: validation costs a walk of every body.
89
+
90
+ ## Configuration
91
+
92
+ ```python
93
+ client = TypeshipClient(
94
+ base_url=..., # overrides the default, https://typeship.dev/api/v1
95
+ timeout=30.0, # per attempt
96
+ max_retries=2, # retries after the first attempt
97
+ debug=True, # one line per attempt on stderr, never headers or bodies
98
+ )
99
+ ```
100
+
101
+ Configuration also reads from the environment (`TYPESHIP_BASE_URL`, `TYPESHIP_TOKEN`).
@@ -0,0 +1,88 @@
1
+ # typeship
2
+
3
+ Typed, zero-dependency Python SDK for **typeship** (v0.1.0).
4
+
5
+ Generated by [typeship](https://typeship.dev) from the OpenAPI spec — do not edit by hand; regenerate instead.
6
+
7
+ - **Zero runtime dependencies** — built on the standard library, nothing to install but Python
8
+ - **Typed payloads** — `TypedDict` models and `Literal` enums, with a `py.typed` marker so type checkers see them
9
+ - **Typed exceptions** — every documented error response has a class you can catch by name
10
+ - **Retries built in** — idempotent requests retry with exponential backoff and `Retry-After` support
11
+
12
+ ## Install
13
+
14
+ ```sh
15
+ pip install . # or copy the package directory into your project
16
+ ```
17
+
18
+ ## Quickstart
19
+
20
+ ```python
21
+ import os
22
+
23
+ from typeship import TypeshipClient
24
+
25
+ client = TypeshipClient(bearer_token=os.environ["TYPESHIP_TOKEN"])
26
+
27
+ for item in client.projects.list():
28
+ print(item)
29
+ ```
30
+
31
+ ## Authentication
32
+
33
+ - **Bearer token** — `bearer_token=` (a string, or a callable for tokens that expire), sent as `Authorization: Bearer <token>`.
34
+
35
+ `default_headers=` adds headers to every request (API version headers, tenant ids).
36
+
37
+ ## Async
38
+
39
+ `AsyncTypeshipClient` has the same methods, awaitable — pages and streams are `async for`. Requests run on the event loop's default executor, so nothing blocks the loop and there is still nothing to install:
40
+
41
+ ```python
42
+ from typeship import AsyncTypeshipClient
43
+
44
+ async with AsyncTypeshipClient(bearer_token=os.environ["TYPESHIP_TOKEN"]) as client:
45
+ async for item in client.projects.list():
46
+ print(item)
47
+ ```
48
+
49
+ ## Errors
50
+
51
+ Methods raise rather than returning a result, which is how Python SDKs read:
52
+
53
+ ```python
54
+ from typeship import ApiError, TransportError
55
+
56
+ try:
57
+ result = client.projects.get("id_123")
58
+ except ApiError as exc:
59
+ exc.status # the HTTP status
60
+ exc.body # the parsed error payload
61
+ exc.request_id # the API's request id, when it sent one
62
+ except TransportError:
63
+ ... # no response at all: network, DNS, timeout
64
+ ```
65
+
66
+ ## Runtime validation
67
+
68
+ Types catch mistakes when you compile; they cannot see an API that has drifted from its spec at runtime. `validate=True` checks JSON request and response bodies against the spec's own schemas — with no dependencies, since the schema tables ship as plain data in this package:
69
+
70
+ ```python
71
+ client = TypeshipClient(validate=True) # raises ValidationError on mismatch
72
+ client = TypeshipClient(validate="warn") # logs a warning and proceeds
73
+ ```
74
+
75
+ A request body is checked before it reaches the wire, so a call that would have been rejected never leaves the process. `ValidationError.violations` lists each path and what was wrong with it. Off by default: validation costs a walk of every body.
76
+
77
+ ## Configuration
78
+
79
+ ```python
80
+ client = TypeshipClient(
81
+ base_url=..., # overrides the default, https://typeship.dev/api/v1
82
+ timeout=30.0, # per attempt
83
+ max_retries=2, # retries after the first attempt
84
+ debug=True, # one line per attempt on stderr, never headers or bodies
85
+ )
86
+ ```
87
+
88
+ Configuration also reads from the environment (`TYPESHIP_BASE_URL`, `TYPESHIP_TOKEN`).
@@ -0,0 +1,25 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "typeship"
7
+ version = "0.1.0"
8
+ description = "Typed, zero-dependency Python SDK for typeship. Generated by typeship."
9
+ readme = "README.md"
10
+ keywords = ["typeship", "sdk", "api", "api-client", "client", "python", "openapi", "typed"]
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ requires-python = ">=3.11"
14
+ # No runtime dependencies, by design: everything rides on the standard library.
15
+ dependencies = []
16
+
17
+ [project.urls]
18
+ Homepage = "https://typeship.dev"
19
+ Repository = "https://github.com/typeship-ax/python"
20
+
21
+ [tool.setuptools]
22
+ packages = ["typeship", "typeship.resources"]
23
+
24
+ [tool.setuptools.package-data]
25
+ "typeship" = ["py.typed"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,28 @@
1
+ """typeship — a typed, zero-dependency Python SDK.
2
+
3
+ Generated by typeship — https://typeship.dev — do not edit by hand.
4
+ """
5
+ from ._client import VERSION, TypeshipClient, AsyncTypeshipClient
6
+ from ._core import RequestOptions, Transport
7
+ from ._validate import ValidationError, Violation
8
+ from ._errors import ApiError, TransportError, TypeshipError, UnexpectedApiError, UnauthorizedError, PayloadTooLargeError, UnprocessableEntityError, ApiResponseError, BadRequestError, PaymentRequiredError, NotFoundError
9
+ from .models import * # noqa: F401,F403
10
+
11
+ __all__ = [
12
+ "TypeshipClient",
13
+ "AsyncTypeshipClient",
14
+ "VERSION",
15
+ "RequestOptions",
16
+ "Transport",
17
+ "TypeshipError",
18
+ "ApiError",
19
+ "TransportError",
20
+ "UnexpectedApiError",
21
+ "UnauthorizedError",
22
+ "PayloadTooLargeError",
23
+ "UnprocessableEntityError",
24
+ "ApiResponseError",
25
+ "BadRequestError",
26
+ "PaymentRequiredError",
27
+ "NotFoundError",
28
+ ]
@@ -0,0 +1,145 @@
1
+ """typeship — client.
2
+
3
+ Generated by typeship — https://typeship.dev — do not edit by hand.
4
+ """
5
+ from __future__ import annotations
6
+
7
+ import os
8
+ from typing import Any, Callable, Dict, Literal, Mapping, Optional, Union
9
+
10
+ from ._core import DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT, HttpCore, RequestOptions, Transport
11
+ from .resources.generate import GenerateResource, AsyncGenerateResource
12
+ from .resources.projects import ProjectsResource, AsyncProjectsResource
13
+ from .resources.generations import GenerationsResource, AsyncGenerationsResource
14
+ from .resources.spec_versions import SpecVersionsResource, AsyncSpecVersionsResource
15
+ from .resources.account import AccountResource, AsyncAccountResource
16
+ from .resources.usage import UsageResource, AsyncUsageResource
17
+ from .resources.api_keys import ApiKeysResource, AsyncApiKeysResource
18
+
19
+ VERSION = "0.1.0"
20
+ USER_AGENT = "typeship/0.1.0 (typeship)"
21
+
22
+
23
+ def _configure(
24
+ *,
25
+ base_url: Optional[str] = None,
26
+ bearer_token: Optional[Union[str, Callable[[], str]]] = None,
27
+ timeout: float = DEFAULT_TIMEOUT,
28
+ max_retries: int = DEFAULT_MAX_RETRIES,
29
+ debug: Optional[Union[bool, Callable[[Dict[str, Any]], None]]] = None,
30
+ default_headers: Optional[Dict[str, str]] = None,
31
+ transport: Optional[Transport] = None,
32
+ on_request: Optional[Callable[[str, str, Dict[str, str]], None]] = None,
33
+ on_response: Optional[Callable[[int, Mapping[str, str], bytes], None]] = None,
34
+ on_error: Optional[Callable[[BaseException, str, str], None]] = None,
35
+ validate: Union[bool, Literal["warn"], None] = None,
36
+ ) -> HttpCore:
37
+ headers: Dict[str, Any] = dict(default_headers or {})
38
+ query: Dict[str, Any] = {}
39
+ bearer = bearer_token if bearer_token is not None else os.environ.get("TYPESHIP_TOKEN")
40
+ if bearer is not None:
41
+ headers["Authorization"] = (lambda: "Bearer " + bearer()) if callable(bearer) else "Bearer " + bearer
42
+ resolved_base = base_url or os.environ.get("TYPESHIP_BASE_URL") or "https://typeship.dev/api/v1"
43
+ if not resolved_base:
44
+ raise ValueError("No base URL: pass base_url or set TYPESHIP_BASE_URL.")
45
+ if debug is None:
46
+ debug = os.environ.get("TYPESHIP_DEBUG") == "1"
47
+ return HttpCore(
48
+ base_url=resolved_base,
49
+ headers=headers,
50
+ query=query,
51
+ timeout=timeout,
52
+ max_retries=max_retries,
53
+ user_agent=USER_AGENT,
54
+ debug=debug,
55
+ transport=transport,
56
+ on_request=on_request,
57
+ on_response=on_response,
58
+ on_error=on_error,
59
+ validate=validate,
60
+ )
61
+
62
+
63
+ class TypeshipClient:
64
+ """typeship — v0.1.0.
65
+
66
+ Methods raise on failure: a documented error response raises its typed
67
+ exception, and a network failure raises TransportError.
68
+ """
69
+
70
+ def __init__(
71
+ self,
72
+ *,
73
+ base_url: Optional[str] = None,
74
+ bearer_token: Optional[Union[str, Callable[[], str]]] = None,
75
+ timeout: float = DEFAULT_TIMEOUT,
76
+ max_retries: int = DEFAULT_MAX_RETRIES,
77
+ debug: Optional[Union[bool, Callable[[Dict[str, Any]], None]]] = None,
78
+ default_headers: Optional[Dict[str, str]] = None,
79
+ transport: Optional[Transport] = None,
80
+ on_request: Optional[Callable[[str, str, Dict[str, str]], None]] = None,
81
+ on_response: Optional[Callable[[int, Mapping[str, str], bytes], None]] = None,
82
+ on_error: Optional[Callable[[BaseException, str, str], None]] = None,
83
+ validate: Union[bool, Literal["warn"], None] = None,
84
+ ) -> None:
85
+ self._core = _configure(base_url=base_url, bearer_token=bearer_token, timeout=timeout, max_retries=max_retries, debug=debug, default_headers=default_headers, transport=transport, on_request=on_request, on_response=on_response, on_error=on_error, validate=validate)
86
+ self.generate = GenerateResource(self._core)
87
+ self.projects = ProjectsResource(self._core)
88
+ self.generations = GenerationsResource(self._core)
89
+ self.spec_versions = SpecVersionsResource(self._core)
90
+ self.account = AccountResource(self._core)
91
+ self.usage = UsageResource(self._core)
92
+ self.api_keys = ApiKeysResource(self._core)
93
+
94
+ def close(self) -> None:
95
+ """Release pooled connections."""
96
+ self._core.close()
97
+
98
+ def __enter__(self) -> "TypeshipClient":
99
+ return self
100
+
101
+ def __exit__(self, *exc: Any) -> None:
102
+ self.close()
103
+
104
+
105
+ class AsyncTypeshipClient:
106
+ """typeship — v0.1.0, awaitable.
107
+
108
+ The same surface as the synchronous client: await each call, and
109
+ async-iterate pages and streams. Requests run on the event loop's
110
+ default executor, so nothing blocks the loop.
111
+ """
112
+
113
+ def __init__(
114
+ self,
115
+ *,
116
+ base_url: Optional[str] = None,
117
+ bearer_token: Optional[Union[str, Callable[[], str]]] = None,
118
+ timeout: float = DEFAULT_TIMEOUT,
119
+ max_retries: int = DEFAULT_MAX_RETRIES,
120
+ debug: Optional[Union[bool, Callable[[Dict[str, Any]], None]]] = None,
121
+ default_headers: Optional[Dict[str, str]] = None,
122
+ transport: Optional[Transport] = None,
123
+ on_request: Optional[Callable[[str, str, Dict[str, str]], None]] = None,
124
+ on_response: Optional[Callable[[int, Mapping[str, str], bytes], None]] = None,
125
+ on_error: Optional[Callable[[BaseException, str, str], None]] = None,
126
+ validate: Union[bool, Literal["warn"], None] = None,
127
+ ) -> None:
128
+ self._core = _configure(base_url=base_url, bearer_token=bearer_token, timeout=timeout, max_retries=max_retries, debug=debug, default_headers=default_headers, transport=transport, on_request=on_request, on_response=on_response, on_error=on_error, validate=validate)
129
+ self.generate = AsyncGenerateResource(self._core)
130
+ self.projects = AsyncProjectsResource(self._core)
131
+ self.generations = AsyncGenerationsResource(self._core)
132
+ self.spec_versions = AsyncSpecVersionsResource(self._core)
133
+ self.account = AsyncAccountResource(self._core)
134
+ self.usage = AsyncUsageResource(self._core)
135
+ self.api_keys = AsyncApiKeysResource(self._core)
136
+
137
+ async def aclose(self) -> None:
138
+ """Release pooled connections."""
139
+ self._core.close()
140
+
141
+ async def __aenter__(self) -> "AsyncTypeshipClient":
142
+ return self
143
+
144
+ async def __aexit__(self, *exc: Any) -> None:
145
+ await self.aclose()