mixpeek 0.18.5__py3-none-any.whl → 0.18.7__py3-none-any.whl
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.
mixpeek/_version.py
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
import importlib.metadata
|
4
4
|
|
5
5
|
__title__: str = "mixpeek"
|
6
|
-
__version__: str = "0.18.
|
6
|
+
__version__: str = "0.18.7"
|
7
7
|
__openapi_doc_version__: str = "0.81"
|
8
|
-
__gen_version__: str = "2.
|
9
|
-
__user_agent__: str = "speakeasy-sdk/python 0.18.
|
8
|
+
__gen_version__: str = "2.496.0"
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 0.18.7 2.496.0 0.81 mixpeek"
|
10
10
|
|
11
11
|
try:
|
12
12
|
if __package__ is not None:
|
mixpeek/httpclient.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
2
2
|
|
3
3
|
# pyright: reportReturnType = false
|
4
|
+
import asyncio
|
5
|
+
from concurrent.futures import ThreadPoolExecutor
|
4
6
|
from typing_extensions import Protocol, runtime_checkable
|
5
7
|
import httpx
|
6
8
|
from typing import Any, Optional, Union
|
@@ -82,3 +84,51 @@ class AsyncHttpClient(Protocol):
|
|
82
84
|
|
83
85
|
async def aclose(self) -> None:
|
84
86
|
pass
|
87
|
+
|
88
|
+
|
89
|
+
class ClientOwner(Protocol):
|
90
|
+
client: Union[HttpClient, None]
|
91
|
+
async_client: Union[AsyncHttpClient, None]
|
92
|
+
|
93
|
+
|
94
|
+
def close_clients(
|
95
|
+
owner: ClientOwner,
|
96
|
+
sync_client: Union[HttpClient, None],
|
97
|
+
async_client: Union[AsyncHttpClient, None],
|
98
|
+
) -> None:
|
99
|
+
"""
|
100
|
+
A finalizer function that is meant to be used with weakref.finalize to close
|
101
|
+
httpx clients used by an SDK so that underlying resources can be garbage
|
102
|
+
collected.
|
103
|
+
"""
|
104
|
+
|
105
|
+
# Unset the client/async_client properties so there are no more references
|
106
|
+
# to them from the owning SDK instance and they can be reaped.
|
107
|
+
owner.client = None
|
108
|
+
owner.async_client = None
|
109
|
+
|
110
|
+
if sync_client is not None:
|
111
|
+
try:
|
112
|
+
sync_client.close()
|
113
|
+
except Exception:
|
114
|
+
pass
|
115
|
+
|
116
|
+
if async_client is not None:
|
117
|
+
is_async = False
|
118
|
+
try:
|
119
|
+
asyncio.get_running_loop()
|
120
|
+
is_async = True
|
121
|
+
except RuntimeError:
|
122
|
+
pass
|
123
|
+
|
124
|
+
try:
|
125
|
+
# If this function is called in an async loop then start another
|
126
|
+
# loop in a separate thread to close the async http client.
|
127
|
+
if is_async:
|
128
|
+
with ThreadPoolExecutor(max_workers=1) as executor:
|
129
|
+
future = executor.submit(asyncio.run, async_client.aclose())
|
130
|
+
future.result()
|
131
|
+
else:
|
132
|
+
asyncio.run(async_client.aclose())
|
133
|
+
except Exception:
|
134
|
+
pass
|
mixpeek/sdk.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
2
2
|
|
3
3
|
from .basesdk import BaseSDK
|
4
|
-
from .httpclient import AsyncHttpClient, HttpClient
|
4
|
+
from .httpclient import AsyncHttpClient, ClientOwner, HttpClient, close_clients
|
5
5
|
from .sdkconfiguration import SDKConfiguration
|
6
6
|
from .utils.logger import Logger, get_default_logger
|
7
7
|
from .utils.retries import RetryConfig
|
@@ -22,7 +22,8 @@ from mixpeek.taxonomies import Taxonomies
|
|
22
22
|
from mixpeek.taxonomyentities import TaxonomyEntities
|
23
23
|
from mixpeek.types import OptionalNullable, UNSET
|
24
24
|
from mixpeek.users import Users
|
25
|
-
from typing import Any, Callable, Dict, Optional, Union
|
25
|
+
from typing import Any, Callable, Dict, Optional, Union, cast
|
26
|
+
import weakref
|
26
27
|
|
27
28
|
|
28
29
|
class Mixpeek(BaseSDK):
|
@@ -127,6 +128,14 @@ class Mixpeek(BaseSDK):
|
|
127
128
|
# pylint: disable=protected-access
|
128
129
|
self.sdk_configuration.__dict__["_hooks"] = hooks
|
129
130
|
|
131
|
+
weakref.finalize(
|
132
|
+
self,
|
133
|
+
close_clients,
|
134
|
+
cast(ClientOwner, self.sdk_configuration),
|
135
|
+
self.sdk_configuration.client,
|
136
|
+
self.sdk_configuration.async_client,
|
137
|
+
)
|
138
|
+
|
130
139
|
self._init_sdks()
|
131
140
|
|
132
141
|
def _init_sdks(self):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: mixpeek
|
3
|
-
Version: 0.18.
|
3
|
+
Version: 0.18.7
|
4
4
|
Summary: Python Client SDK Generated by Speakeasy.
|
5
5
|
Author: Speakeasy
|
6
6
|
Requires-Python: >=3.9
|
@@ -42,6 +42,7 @@ Mixpeek API: This is the Mixpeek API, providing access to various endpoints for
|
|
42
42
|
* [Error Handling](https://github.com/mixpeek/python-sdk/blob/master/#error-handling)
|
43
43
|
* [Server Selection](https://github.com/mixpeek/python-sdk/blob/master/#server-selection)
|
44
44
|
* [Custom HTTP Client](https://github.com/mixpeek/python-sdk/blob/master/#custom-http-client)
|
45
|
+
* [Resource Management](https://github.com/mixpeek/python-sdk/blob/master/#resource-management)
|
45
46
|
* [Debugging](https://github.com/mixpeek/python-sdk/blob/master/#debugging)
|
46
47
|
* [Development](https://github.com/mixpeek/python-sdk/blob/master/#development)
|
47
48
|
* [Maturity](https://github.com/mixpeek/python-sdk/blob/master/#maturity)
|
@@ -52,6 +53,11 @@ Mixpeek API: This is the Mixpeek API, providing access to various endpoints for
|
|
52
53
|
<!-- Start SDK Installation [installation] -->
|
53
54
|
## SDK Installation
|
54
55
|
|
56
|
+
> [!NOTE]
|
57
|
+
> **Python version upgrade policy**
|
58
|
+
>
|
59
|
+
> Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.
|
60
|
+
|
55
61
|
The SDK can be installed with either *pip* or *poetry* package managers.
|
56
62
|
|
57
63
|
### PIP
|
@@ -448,6 +454,32 @@ s = Mixpeek(async_client=CustomClient(httpx.AsyncClient()))
|
|
448
454
|
```
|
449
455
|
<!-- End Custom HTTP Client [http-client] -->
|
450
456
|
|
457
|
+
<!-- Start Resource Management [resource-management] -->
|
458
|
+
## Resource Management
|
459
|
+
|
460
|
+
The `Mixpeek` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.
|
461
|
+
|
462
|
+
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
|
463
|
+
|
464
|
+
```python
|
465
|
+
from mixpeek import Mixpeek
|
466
|
+
import os
|
467
|
+
def main():
|
468
|
+
with Mixpeek(
|
469
|
+
token=os.getenv("MIXPEEK_TOKEN", ""),
|
470
|
+
) as mixpeek:
|
471
|
+
# Rest of application here...
|
472
|
+
|
473
|
+
|
474
|
+
# Or when using async:
|
475
|
+
async def amain():
|
476
|
+
async with Mixpeek(
|
477
|
+
token=os.getenv("MIXPEEK_TOKEN", ""),
|
478
|
+
) as mixpeek:
|
479
|
+
# Rest of application here...
|
480
|
+
```
|
481
|
+
<!-- End Resource Management [resource-management] -->
|
482
|
+
|
451
483
|
<!-- Start Debugging [debug] -->
|
452
484
|
## Debugging
|
453
485
|
|
@@ -3,14 +3,14 @@ mixpeek/_hooks/__init__.py,sha256=p5J13DeYuISQyQWirjJAObHIf2VtIlOtFqnIpvjjVwk,11
|
|
3
3
|
mixpeek/_hooks/registration.py,sha256=1QZB41w6If7I9dXiOSQx6dhSc6BPWrnI5Q5bMOr4iVA,624
|
4
4
|
mixpeek/_hooks/sdkhooks.py,sha256=T0xbVPw8mvvFszHZlrZdtFrJBovAqE-JQfw4dS9Xi7Y,2495
|
5
5
|
mixpeek/_hooks/types.py,sha256=Qh9pO5ndynMrWpMLPkJUsOmAJ1AJHntJAXb5Yxe_a4o,2568
|
6
|
-
mixpeek/_version.py,sha256=
|
6
|
+
mixpeek/_version.py,sha256=3v1c4xHsX9ZFegoIHIUnqg9ZtsVhX9Quh4BKwhwMNmo,456
|
7
7
|
mixpeek/assets.py,sha256=cggTlrFg6BAlddsB3TJS67XAO7oaaEZxuXE7rac6ASw,75414
|
8
8
|
mixpeek/basesdk.py,sha256=j_PZqE6WgIfx1cPCK5gAVn-rgPy9iLhUN5ELtefoEU0,11976
|
9
9
|
mixpeek/collections.py,sha256=mh0ypu89kY78Lnfal7OdBrHsCpJ3O54DVR3ejhD5oSo,49021
|
10
10
|
mixpeek/featureextractors.py,sha256=uMZncapRYj7dM_qAJ5hbT86Uyb9x1N1IraNMupGp7UE,9598
|
11
11
|
mixpeek/features.py,sha256=z_JoaD_k_HNcHLrRpdOxcbnNLUjVljZmpnsbiZLHy3I,58748
|
12
12
|
mixpeek/health.py,sha256=4i7KHGS2bYHCAE0nyHDw5g24MXcTZYVaTviQNKPW5o0,6742
|
13
|
-
mixpeek/httpclient.py,sha256=
|
13
|
+
mixpeek/httpclient.py,sha256=N-D-srtDBykpfyVKacTY4upDGvNLqdWlEYqhJvta99E,4194
|
14
14
|
mixpeek/ingestassets.py,sha256=yW6eDg9JpSQzWM1Zl-GqDIpacKrUItXBL6LOOaDo8q8,40442
|
15
15
|
mixpeek/models/__init__.py,sha256=tA15wFp9zSk7e76MF48-to5yygR17id6EGWQjXnQ6W4,31191
|
16
16
|
mixpeek/models/actionusage.py,sha256=WAnnBVTeQ9j0dtIrubfyyJQwbBamxManfS8fc2OFNyo,324
|
@@ -170,7 +170,7 @@ mixpeek/models/videotranscriptionsettings.py,sha256=70EN-PX2QiQAQjDLYaV2coUCnVjR
|
|
170
170
|
mixpeek/namespaces.py,sha256=ED42wsbEksGpW61sUvtnjJPl8O6ktVE7R7K5ZTHiZko,53848
|
171
171
|
mixpeek/organizations.py,sha256=Q0Nu_eg7bXCZniB0a8Gj7Kt8kRkVLzs5h_-T5w4c1Ic,44795
|
172
172
|
mixpeek/py.typed,sha256=zrp19r0G21lr2yRiMC0f8MFkQFGj9wMpSbboePMg8KM,59
|
173
|
-
mixpeek/sdk.py,sha256=
|
173
|
+
mixpeek/sdk.py,sha256=qGyoPseO0ijF5NEWKaXaDRJWtQJ97EHhLYiGmHpsbkI,6349
|
174
174
|
mixpeek/sdkconfiguration.py,sha256=WDFDVblhsi547ZxDPEPR243zKLM1shTDSt9w3nporHc,1703
|
175
175
|
mixpeek/tasks.py,sha256=tQMg5XUINdXAjbTVbJP63zLfRs5eNl5Fk46onDo5yFo,27602
|
176
176
|
mixpeek/taxonomies.py,sha256=M3q8g39M6VK3saT0sIgjsV5vs-4NO7iKdCJ894VxnLk,29553
|
@@ -193,6 +193,6 @@ mixpeek/utils/security.py,sha256=XoK-R2YMyZtVWQte7FoezfGJS-dea9jz4qQ7w5dwNWc,600
|
|
193
193
|
mixpeek/utils/serializers.py,sha256=BSJT7kBOkNBFyP7KREyMoe14JGbgijD1M6AXFMbdmco,4924
|
194
194
|
mixpeek/utils/url.py,sha256=BgGPgcTA6MRK4bF8fjP2dUopN3NzEzxWMXPBVg8NQUA,5254
|
195
195
|
mixpeek/utils/values.py,sha256=_89YXPTI_BU6SXJBzFR4pIzTCBPQW9tsOTN1jeBBIDs,3428
|
196
|
-
mixpeek-0.18.
|
197
|
-
mixpeek-0.18.
|
198
|
-
mixpeek-0.18.
|
196
|
+
mixpeek-0.18.7.dist-info/METADATA,sha256=Kgb3pwHsbmsEiTcwXchpGfsxh5k7SDWZ8WC843K55H0,22186
|
197
|
+
mixpeek-0.18.7.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
198
|
+
mixpeek-0.18.7.dist-info/RECORD,,
|
File without changes
|