dataleon 0.1.0a8__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.

Potentially problematic release.


This version of dataleon might be problematic. Click here for more details.

Files changed (60) hide show
  1. dataleon/__init__.py +102 -0
  2. dataleon/_base_client.py +1995 -0
  3. dataleon/_client.py +412 -0
  4. dataleon/_compat.py +219 -0
  5. dataleon/_constants.py +14 -0
  6. dataleon/_exceptions.py +108 -0
  7. dataleon/_files.py +123 -0
  8. dataleon/_models.py +840 -0
  9. dataleon/_qs.py +150 -0
  10. dataleon/_resource.py +43 -0
  11. dataleon/_response.py +830 -0
  12. dataleon/_streaming.py +331 -0
  13. dataleon/_types.py +260 -0
  14. dataleon/_utils/__init__.py +64 -0
  15. dataleon/_utils/_compat.py +45 -0
  16. dataleon/_utils/_datetime_parse.py +136 -0
  17. dataleon/_utils/_logs.py +25 -0
  18. dataleon/_utils/_proxy.py +65 -0
  19. dataleon/_utils/_reflection.py +42 -0
  20. dataleon/_utils/_resources_proxy.py +24 -0
  21. dataleon/_utils/_streams.py +12 -0
  22. dataleon/_utils/_sync.py +58 -0
  23. dataleon/_utils/_transform.py +457 -0
  24. dataleon/_utils/_typing.py +156 -0
  25. dataleon/_utils/_utils.py +421 -0
  26. dataleon/_version.py +4 -0
  27. dataleon/lib/.keep +4 -0
  28. dataleon/py.typed +0 -0
  29. dataleon/resources/__init__.py +33 -0
  30. dataleon/resources/companies/__init__.py +33 -0
  31. dataleon/resources/companies/companies.py +706 -0
  32. dataleon/resources/companies/documents.py +361 -0
  33. dataleon/resources/individuals/__init__.py +33 -0
  34. dataleon/resources/individuals/documents.py +361 -0
  35. dataleon/resources/individuals/individuals.py +711 -0
  36. dataleon/types/__init__.py +17 -0
  37. dataleon/types/companies/__init__.py +5 -0
  38. dataleon/types/companies/document_upload_params.py +56 -0
  39. dataleon/types/company_create_params.py +101 -0
  40. dataleon/types/company_list_params.py +37 -0
  41. dataleon/types/company_list_response.py +10 -0
  42. dataleon/types/company_registration.py +439 -0
  43. dataleon/types/company_retrieve_params.py +15 -0
  44. dataleon/types/company_update_params.py +101 -0
  45. dataleon/types/individual.py +336 -0
  46. dataleon/types/individual_create_params.py +78 -0
  47. dataleon/types/individual_list_params.py +37 -0
  48. dataleon/types/individual_list_response.py +10 -0
  49. dataleon/types/individual_retrieve_params.py +15 -0
  50. dataleon/types/individual_update_params.py +78 -0
  51. dataleon/types/individuals/__init__.py +7 -0
  52. dataleon/types/individuals/document_response.py +41 -0
  53. dataleon/types/individuals/document_upload_params.py +56 -0
  54. dataleon/types/individuals/generic_document.py +57 -0
  55. dataleon/types/shared/__init__.py +3 -0
  56. dataleon/types/shared/check.py +26 -0
  57. dataleon-0.1.0a8.dist-info/METADATA +448 -0
  58. dataleon-0.1.0a8.dist-info/RECORD +60 -0
  59. dataleon-0.1.0a8.dist-info/WHEEL +4 -0
  60. dataleon-0.1.0a8.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,41 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import List, Optional
4
+
5
+ from ..._models import BaseModel
6
+
7
+ __all__ = ["DocumentResponse", "Document"]
8
+
9
+
10
+ class Document(BaseModel):
11
+ id: Optional[str] = None
12
+ """Unique identifier of the document."""
13
+
14
+ document_type: Optional[str] = None
15
+ """Functional type of the document (e.g., identity document, invoice)."""
16
+
17
+ filename: Optional[str] = None
18
+ """Original filename of the uploaded document."""
19
+
20
+ name: Optional[str] = None
21
+ """Human-readable name of the document."""
22
+
23
+ signed_url: Optional[str] = None
24
+ """Secure URL to access the document."""
25
+
26
+ state: Optional[str] = None
27
+ """Processing state of the document (e.g., WAITING, STARTED, RUNNING, PROCESSED)."""
28
+
29
+ status: Optional[str] = None
30
+ """Validation status of the document (e.g., need_review, approved, rejected)."""
31
+
32
+ workspace_id: Optional[str] = None
33
+ """Identifier of the workspace to which the document belongs."""
34
+
35
+
36
+ class DocumentResponse(BaseModel):
37
+ documents: Optional[List[Document]] = None
38
+ """List of documents associated with the response."""
39
+
40
+ total_document: Optional[int] = None
41
+ """Total number of documents available in the response."""
@@ -0,0 +1,56 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Literal, Required, TypedDict
6
+
7
+ from ..._types import FileTypes
8
+
9
+ __all__ = ["DocumentUploadParams"]
10
+
11
+
12
+ class DocumentUploadParams(TypedDict, total=False):
13
+ document_type: Required[
14
+ Literal[
15
+ "liasse_fiscale",
16
+ "amortised_loan_schedule",
17
+ "invoice",
18
+ "receipt",
19
+ "company_statuts",
20
+ "registration_company_certificate",
21
+ "kbis",
22
+ "rib",
23
+ "livret_famille",
24
+ "birth_certificate",
25
+ "payslip",
26
+ "social_security_card",
27
+ "vehicle_registration_certificate",
28
+ "carte_grise",
29
+ "criminal_record_extract",
30
+ "proof_of_address",
31
+ "identity_card_front",
32
+ "identity_card_back",
33
+ "driver_license_front",
34
+ "driver_license_back",
35
+ "identity_document",
36
+ "driver_license",
37
+ "passport",
38
+ "tax",
39
+ "certificate_of_incorporation",
40
+ "certificate_of_good_standing",
41
+ "lcb_ft_lab_aml_policies",
42
+ "niu_entreprise",
43
+ "financial_statements",
44
+ "rccm",
45
+ "proof_of_source_funds",
46
+ "organizational_chart",
47
+ "risk_policies",
48
+ ]
49
+ ]
50
+ """Filter by document type for upload (must be one of the allowed values)"""
51
+
52
+ file: FileTypes
53
+ """File to upload (required)"""
54
+
55
+ url: str
56
+ """URL of the file to upload (either `file` or `url` is required)"""
@@ -0,0 +1,57 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import List, Optional
4
+ from datetime import datetime
5
+
6
+ from ..._models import BaseModel
7
+ from ..shared.check import Check
8
+
9
+ __all__ = ["GenericDocument", "Table", "Value"]
10
+
11
+
12
+ class Table(BaseModel):
13
+ operation: Optional[List[object]] = None
14
+ """List of operations or actions associated with the table."""
15
+
16
+
17
+ class Value(BaseModel):
18
+ confidence: Optional[float] = None
19
+ """Confidence score (between 0 and 1) for the extracted value."""
20
+
21
+ name: Optional[str] = None
22
+ """Name or label of the extracted field."""
23
+
24
+ value: Optional[List[int]] = None
25
+ """List of integer values related to the field (e.g., bounding box coordinates)."""
26
+
27
+
28
+ class GenericDocument(BaseModel):
29
+ id: Optional[str] = None
30
+ """Unique identifier of the document."""
31
+
32
+ checks: Optional[List[Check]] = None
33
+ """List of verification checks performed on the document."""
34
+
35
+ created_at: Optional[datetime] = None
36
+ """Timestamp when the document was created or uploaded."""
37
+
38
+ document_type: Optional[str] = None
39
+ """Type/category of the document."""
40
+
41
+ name: Optional[str] = None
42
+ """Name or label for the document."""
43
+
44
+ signed_url: Optional[str] = None
45
+ """Signed URL for accessing the document file."""
46
+
47
+ state: Optional[str] = None
48
+ """Current processing state of the document (e.g., WAITING, PROCESSED)."""
49
+
50
+ status: Optional[str] = None
51
+ """Status of the document reception or approval."""
52
+
53
+ tables: Optional[List[Table]] = None
54
+ """List of tables extracted from the document, each containing operations."""
55
+
56
+ values: Optional[List[Value]] = None
57
+ """Extracted key-value pairs from the document, including confidence scores."""
@@ -0,0 +1,3 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .check import Check as Check
@@ -0,0 +1,26 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+
5
+ from pydantic import Field as FieldInfo
6
+
7
+ from ..._models import BaseModel
8
+
9
+ __all__ = ["Check"]
10
+
11
+
12
+ class Check(BaseModel):
13
+ masked: Optional[bool] = None
14
+ """Indicates whether the result or data is masked/hidden."""
15
+
16
+ message: Optional[str] = None
17
+ """Additional message or explanation about the check result."""
18
+
19
+ name: Optional[str] = None
20
+ """Name or type of the check performed."""
21
+
22
+ validate_: Optional[bool] = FieldInfo(alias="validate", default=None)
23
+ """Result of the check, true if passed."""
24
+
25
+ weight: Optional[int] = None
26
+ """Importance or weight of the check, often used in scoring."""
@@ -0,0 +1,448 @@
1
+ Metadata-Version: 2.3
2
+ Name: dataleon
3
+ Version: 0.1.0a8
4
+ Summary: The official Python library for the dataleon API
5
+ Project-URL: Homepage, https://github.com/dataleonlabs/dataleon-python
6
+ Project-URL: Repository, https://github.com/dataleonlabs/dataleon-python
7
+ Author-email: Dataleon <support@dataleon.ai>
8
+ License: Apache-2.0
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Operating System :: MacOS
12
+ Classifier: Operating System :: Microsoft :: Windows
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Operating System :: POSIX
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.9
24
+ Requires-Dist: anyio<5,>=3.5.0
25
+ Requires-Dist: distro<2,>=1.7.0
26
+ Requires-Dist: httpx<1,>=0.23.0
27
+ Requires-Dist: pydantic<3,>=1.9.0
28
+ Requires-Dist: sniffio
29
+ Requires-Dist: typing-extensions<5,>=4.10
30
+ Provides-Extra: aiohttp
31
+ Requires-Dist: aiohttp; extra == 'aiohttp'
32
+ Requires-Dist: httpx-aiohttp>=0.1.9; extra == 'aiohttp'
33
+ Description-Content-Type: text/markdown
34
+
35
+ # Dataleon Python API library
36
+
37
+ <!-- prettier-ignore -->
38
+ [![PyPI version](https://img.shields.io/pypi/v/dataleon.svg?label=pypi%20(stable))](https://pypi.org/project/dataleon/)
39
+
40
+ The Dataleon Python library provides convenient access to the Dataleon REST API from any Python 3.9+
41
+ application. The library includes type definitions for all request params and response fields,
42
+ and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
43
+
44
+ It is generated with [Stainless](https://www.stainless.com/).
45
+
46
+ ## Documentation
47
+
48
+ The REST API documentation can be found on [docs.dataleon.ai](https://docs.dataleon.ai). The full API of this library can be found in [api.md](https://github.com/dataleonlabs/dataleon-python/tree/main/api.md).
49
+
50
+ ## Installation
51
+
52
+ ```sh
53
+ # install from PyPI
54
+ pip install --pre dataleon
55
+ ```
56
+
57
+ ## Usage
58
+
59
+ The full API of this library can be found in [api.md](https://github.com/dataleonlabs/dataleon-python/tree/main/api.md).
60
+
61
+ ```python
62
+ import os
63
+ from dataleon import Dataleon
64
+
65
+ client = Dataleon(
66
+ api_key=os.environ.get("DATALEON_API_KEY"), # This is the default and can be omitted
67
+ )
68
+
69
+ individual = client.individuals.create(
70
+ workspace_id="wk_123",
71
+ )
72
+ print(individual.id)
73
+ ```
74
+
75
+ While you can provide an `api_key` keyword argument,
76
+ we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
77
+ to add `DATALEON_API_KEY="My API Key"` to your `.env` file
78
+ so that your API Key is not stored in source control.
79
+
80
+ ## Async usage
81
+
82
+ Simply import `AsyncDataleon` instead of `Dataleon` and use `await` with each API call:
83
+
84
+ ```python
85
+ import os
86
+ import asyncio
87
+ from dataleon import AsyncDataleon
88
+
89
+ client = AsyncDataleon(
90
+ api_key=os.environ.get("DATALEON_API_KEY"), # This is the default and can be omitted
91
+ )
92
+
93
+
94
+ async def main() -> None:
95
+ individual = await client.individuals.create(
96
+ workspace_id="wk_123",
97
+ )
98
+ print(individual.id)
99
+
100
+
101
+ asyncio.run(main())
102
+ ```
103
+
104
+ Functionality between the synchronous and asynchronous clients is otherwise identical.
105
+
106
+ ### With aiohttp
107
+
108
+ By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.
109
+
110
+ You can enable this by installing `aiohttp`:
111
+
112
+ ```sh
113
+ # install from PyPI
114
+ pip install --pre dataleon[aiohttp]
115
+ ```
116
+
117
+ Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
118
+
119
+ ```python
120
+ import asyncio
121
+ from dataleon import DefaultAioHttpClient
122
+ from dataleon import AsyncDataleon
123
+
124
+
125
+ async def main() -> None:
126
+ async with AsyncDataleon(
127
+ api_key="My API Key",
128
+ http_client=DefaultAioHttpClient(),
129
+ ) as client:
130
+ individual = await client.individuals.create(
131
+ workspace_id="wk_123",
132
+ )
133
+ print(individual.id)
134
+
135
+
136
+ asyncio.run(main())
137
+ ```
138
+
139
+ ## Using types
140
+
141
+ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
142
+
143
+ - Serializing back into JSON, `model.to_json()`
144
+ - Converting to a dictionary, `model.to_dict()`
145
+
146
+ Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
147
+
148
+ ## Nested params
149
+
150
+ Nested parameters are dictionaries, typed using `TypedDict`, for example:
151
+
152
+ ```python
153
+ from dataleon import Dataleon
154
+
155
+ client = Dataleon()
156
+
157
+ individual = client.individuals.create(
158
+ workspace_id="wk_123",
159
+ person={},
160
+ )
161
+ print(individual.person)
162
+ ```
163
+
164
+ ## File uploads
165
+
166
+ Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.
167
+
168
+ ```python
169
+ from pathlib import Path
170
+ from dataleon import Dataleon
171
+
172
+ client = Dataleon()
173
+
174
+ client.individuals.documents.upload(
175
+ individual_id="individual_id",
176
+ document_type="liasse_fiscale",
177
+ file=Path("/path/to/file"),
178
+ )
179
+ ```
180
+
181
+ The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.
182
+
183
+ ## Handling errors
184
+
185
+ When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `dataleon.APIConnectionError` is raised.
186
+
187
+ When the API returns a non-success status code (that is, 4xx or 5xx
188
+ response), a subclass of `dataleon.APIStatusError` is raised, containing `status_code` and `response` properties.
189
+
190
+ All errors inherit from `dataleon.APIError`.
191
+
192
+ ```python
193
+ import dataleon
194
+ from dataleon import Dataleon
195
+
196
+ client = Dataleon()
197
+
198
+ try:
199
+ client.individuals.create(
200
+ workspace_id="wk_123",
201
+ )
202
+ except dataleon.APIConnectionError as e:
203
+ print("The server could not be reached")
204
+ print(e.__cause__) # an underlying Exception, likely raised within httpx.
205
+ except dataleon.RateLimitError as e:
206
+ print("A 429 status code was received; we should back off a bit.")
207
+ except dataleon.APIStatusError as e:
208
+ print("Another non-200-range status code was received")
209
+ print(e.status_code)
210
+ print(e.response)
211
+ ```
212
+
213
+ Error codes are as follows:
214
+
215
+ | Status Code | Error Type |
216
+ | ----------- | -------------------------- |
217
+ | 400 | `BadRequestError` |
218
+ | 401 | `AuthenticationError` |
219
+ | 403 | `PermissionDeniedError` |
220
+ | 404 | `NotFoundError` |
221
+ | 422 | `UnprocessableEntityError` |
222
+ | 429 | `RateLimitError` |
223
+ | >=500 | `InternalServerError` |
224
+ | N/A | `APIConnectionError` |
225
+
226
+ ### Retries
227
+
228
+ Certain errors are automatically retried 2 times by default, with a short exponential backoff.
229
+ Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
230
+ 429 Rate Limit, and >=500 Internal errors are all retried by default.
231
+
232
+ You can use the `max_retries` option to configure or disable retry settings:
233
+
234
+ ```python
235
+ from dataleon import Dataleon
236
+
237
+ # Configure the default for all requests:
238
+ client = Dataleon(
239
+ # default is 2
240
+ max_retries=0,
241
+ )
242
+
243
+ # Or, configure per-request:
244
+ client.with_options(max_retries=5).individuals.create(
245
+ workspace_id="wk_123",
246
+ )
247
+ ```
248
+
249
+ ### Timeouts
250
+
251
+ By default requests time out after 1 minute. You can configure this with a `timeout` option,
252
+ which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
253
+
254
+ ```python
255
+ from dataleon import Dataleon
256
+
257
+ # Configure the default for all requests:
258
+ client = Dataleon(
259
+ # 20 seconds (default is 1 minute)
260
+ timeout=20.0,
261
+ )
262
+
263
+ # More granular control:
264
+ client = Dataleon(
265
+ timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
266
+ )
267
+
268
+ # Override per-request:
269
+ client.with_options(timeout=5.0).individuals.create(
270
+ workspace_id="wk_123",
271
+ )
272
+ ```
273
+
274
+ On timeout, an `APITimeoutError` is thrown.
275
+
276
+ Note that requests that time out are [retried twice by default](https://github.com/dataleonlabs/dataleon-python/tree/main/#retries).
277
+
278
+ ## Advanced
279
+
280
+ ### Logging
281
+
282
+ We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.
283
+
284
+ You can enable logging by setting the environment variable `DATALEON_LOG` to `info`.
285
+
286
+ ```shell
287
+ $ export DATALEON_LOG=info
288
+ ```
289
+
290
+ Or to `debug` for more verbose logging.
291
+
292
+ ### How to tell whether `None` means `null` or missing
293
+
294
+ In an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:
295
+
296
+ ```py
297
+ if response.my_field is None:
298
+ if 'my_field' not in response.model_fields_set:
299
+ print('Got json like {}, without a "my_field" key present at all.')
300
+ else:
301
+ print('Got json like {"my_field": null}.')
302
+ ```
303
+
304
+ ### Accessing raw response data (e.g. headers)
305
+
306
+ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
307
+
308
+ ```py
309
+ from dataleon import Dataleon
310
+
311
+ client = Dataleon()
312
+ response = client.individuals.with_raw_response.create(
313
+ workspace_id="wk_123",
314
+ )
315
+ print(response.headers.get('X-My-Header'))
316
+
317
+ individual = response.parse() # get the object that `individuals.create()` would have returned
318
+ print(individual.id)
319
+ ```
320
+
321
+ These methods return an [`APIResponse`](https://github.com/dataleonlabs/dataleon-python/tree/main/src/dataleon/_response.py) object.
322
+
323
+ The async client returns an [`AsyncAPIResponse`](https://github.com/dataleonlabs/dataleon-python/tree/main/src/dataleon/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
324
+
325
+ #### `.with_streaming_response`
326
+
327
+ The above interface eagerly reads the full response body when you make the request, which may not always be what you want.
328
+
329
+ To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
330
+
331
+ ```python
332
+ with client.individuals.with_streaming_response.create(
333
+ workspace_id="wk_123",
334
+ ) as response:
335
+ print(response.headers.get("X-My-Header"))
336
+
337
+ for line in response.iter_lines():
338
+ print(line)
339
+ ```
340
+
341
+ The context manager is required so that the response will reliably be closed.
342
+
343
+ ### Making custom/undocumented requests
344
+
345
+ This library is typed for convenient access to the documented API.
346
+
347
+ If you need to access undocumented endpoints, params, or response properties, the library can still be used.
348
+
349
+ #### Undocumented endpoints
350
+
351
+ To make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other
352
+ http verbs. Options on the client will be respected (such as retries) when making this request.
353
+
354
+ ```py
355
+ import httpx
356
+
357
+ response = client.post(
358
+ "/foo",
359
+ cast_to=httpx.Response,
360
+ body={"my_param": True},
361
+ )
362
+
363
+ print(response.headers.get("x-foo"))
364
+ ```
365
+
366
+ #### Undocumented request params
367
+
368
+ If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request
369
+ options.
370
+
371
+ #### Undocumented response properties
372
+
373
+ To access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You
374
+ can also get all the extra fields on the Pydantic model as a dict with
375
+ [`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).
376
+
377
+ ### Configuring the HTTP client
378
+
379
+ You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:
380
+
381
+ - Support for [proxies](https://www.python-httpx.org/advanced/proxies/)
382
+ - Custom [transports](https://www.python-httpx.org/advanced/transports/)
383
+ - Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality
384
+
385
+ ```python
386
+ import httpx
387
+ from dataleon import Dataleon, DefaultHttpxClient
388
+
389
+ client = Dataleon(
390
+ # Or use the `DATALEON_BASE_URL` env var
391
+ base_url="http://my.test.server.example.com:8083",
392
+ http_client=DefaultHttpxClient(
393
+ proxy="http://my.test.proxy.example.com",
394
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
395
+ ),
396
+ )
397
+ ```
398
+
399
+ You can also customize the client on a per-request basis by using `with_options()`:
400
+
401
+ ```python
402
+ client.with_options(http_client=DefaultHttpxClient(...))
403
+ ```
404
+
405
+ ### Managing HTTP resources
406
+
407
+ By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
408
+
409
+ ```py
410
+ from dataleon import Dataleon
411
+
412
+ with Dataleon() as client:
413
+ # make requests here
414
+ ...
415
+
416
+ # HTTP client is now closed
417
+ ```
418
+
419
+ ## Versioning
420
+
421
+ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
422
+
423
+ 1. Changes that only affect static types, without breaking runtime behavior.
424
+ 2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
425
+ 3. Changes that we do not expect to impact the vast majority of users in practice.
426
+
427
+ We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
428
+
429
+ We are keen for your feedback; please open an [issue](https://www.github.com/dataleonlabs/dataleon-python/issues) with questions, bugs, or suggestions.
430
+
431
+ ### Determining the installed version
432
+
433
+ If you've upgraded to the latest version but aren't seeing any new features you were expecting then your python environment is likely still using an older version.
434
+
435
+ You can determine the version that is being used at runtime with:
436
+
437
+ ```py
438
+ import dataleon
439
+ print(dataleon.__version__)
440
+ ```
441
+
442
+ ## Requirements
443
+
444
+ Python 3.9 or higher.
445
+
446
+ ## Contributing
447
+
448
+ See [the contributing documentation](https://github.com/dataleonlabs/dataleon-python/tree/main/./CONTRIBUTING.md).