matelab-python-sdk 0.2.0a9__py3-none-any.whl → 0.3.0a1__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.
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # @generated by datamodel-codegen:
4
4
  # filename: openapi.yaml
5
- # version: 0.87.0
5
+ # version: 0.90.0
6
6
 
7
7
  from enum import StrEnum
8
8
  from typing import Annotated, Any, Literal
@@ -11,7 +11,7 @@ from pydantic import ConfigDict, Field, RootModel, SecretStr, StrictBool, Strict
11
11
 
12
12
  from matelab._wire_validation import WireModel
13
13
 
14
- OPENAPI_INFO_VERSION = "2026.11.1"
14
+ OPENAPI_INFO_VERSION = "2026.11.2"
15
15
 
16
16
 
17
17
  class ResponseEnvelope(WireModel):
@@ -2759,9 +2759,9 @@ class StageTemporaryFileRequest(WireModel):
2759
2759
  """
2760
2760
  file: bytes | None = None
2761
2761
  """
2762
- Required for upload branches and omitted for abort. The multipart
2763
- filename's sanitized final extension selects the temporary bytes;
2764
- keep that extension unchanged throughout continuation.
2762
+ Required for upload branches and omitted for abort. Filename and
2763
+ extension may change between fragments in the same uid/tempid
2764
+ session. Completion uses the final fragment's source filename.
2765
2765
 
2766
2766
  """
2767
2767
 
matelab/_transport.py CHANGED
@@ -5,11 +5,10 @@ from collections.abc import AsyncIterator, Mapping
5
5
  from contextlib import suppress
6
6
  from dataclasses import dataclass
7
7
  from enum import StrEnum
8
- from typing import IO, Generic, TypeAlias, TypeVar, cast
8
+ from typing import IO, cast, override
9
9
 
10
10
  from httpx2 import AsyncByteStream, AsyncClient, Request, RequestError, Response, SyncByteStream
11
11
  from pydantic import BaseModel, JsonValue, SecretStr, ValidationError
12
- from typing_extensions import override
13
12
 
14
13
  from matelab._generated import models as wire_models
15
14
  from matelab.errors import (
@@ -23,10 +22,9 @@ from matelab.errors import (
23
22
  from matelab.session import Session, Token
24
23
  from matelab.streaming import ByteRange, DownloadStream
25
24
 
26
- WireResponse = TypeVar("WireResponse", bound=BaseModel)
27
25
  _ACCESS_EXPIRY_SKEW_MS = 30_000
28
- _ParameterValue: TypeAlias = str | int | float | bool | None
29
- _Files: TypeAlias = Mapping[str, tuple[str, IO[bytes] | bytes, str]]
26
+ type _ParameterValue = str | int | float | bool | None
27
+ type _Files = Mapping[str, tuple[str, IO[bytes] | bytes, str]]
30
28
  _CONTENT_RANGE_PATTERN = re.compile(r"^bytes [0-9]+-[0-9]+/[0-9]+$")
31
29
 
32
30
 
@@ -100,7 +98,7 @@ class Encoding(StrEnum):
100
98
 
101
99
 
102
100
  @dataclass(frozen=True, slots=True)
103
- class Operation(Generic[WireResponse]):
101
+ class Operation[WireResponse: BaseModel]:
104
102
  method: str
105
103
  path: str
106
104
  encoding: Encoding
@@ -177,7 +175,7 @@ class SessionTransport:
177
175
  )
178
176
  return self.session
179
177
 
180
- async def _send_multipart(
178
+ async def _send_multipart[WireResponse: BaseModel](
181
179
  self,
182
180
  operation: Operation[WireResponse],
183
181
  *,
@@ -205,7 +203,7 @@ class SessionTransport:
205
203
  request.stream = _ThreadedMultipartStream(request.stream)
206
204
  return await self._http.send(request)
207
205
 
208
- async def request(
206
+ async def request[WireResponse: BaseModel](
209
207
  self, operation: Operation[WireResponse], *, payload: BaseModel | None = None, files: _Files | None = None
210
208
  ) -> WireResponse:
211
209
  if (
@@ -1,6 +1,6 @@
1
1
  import json
2
2
  from collections.abc import Callable, Collection, Iterator, Mapping
3
- from typing import TypeAlias, TypeVar, cast
3
+ from typing import cast
4
4
 
5
5
  from jsonschema import Draft202012Validator
6
6
  from jsonschema.exceptions import ValidationError as JsonSchemaValidationError
@@ -15,8 +15,7 @@ from matelab.errors import MatelabUsageError
15
15
 
16
16
  _RUNTIME_RULES_KEY = "matelab-runtime-rules"
17
17
  JsonObject = dict[str, JsonValue]
18
- WireValue: TypeAlias = JsonValue | bytes | Mapping[str, "WireValue"]
19
- ModelT = TypeVar("ModelT", bound=BaseModel)
18
+ type WireValue = JsonValue | bytes | Mapping[str, WireValue]
20
19
 
21
20
 
22
21
  def _reject_json_constant(_value: str) -> None:
@@ -44,7 +43,7 @@ _ContractValidator = cast(
44
43
  )
45
44
 
46
45
 
47
- def validate_request(model: type[ModelT], data: Mapping[str, WireValue], message: str) -> ModelT:
46
+ def validate_request[ModelT: BaseModel](model: type[ModelT], data: Mapping[str, WireValue], message: str) -> ModelT:
48
47
  """Validate caller input without exposing it in the public exception."""
49
48
  try:
50
49
  return model.model_validate(data)
@@ -52,7 +51,7 @@ def validate_request(model: type[ModelT], data: Mapping[str, WireValue], message
52
51
  raise MatelabUsageError(message) from None
53
52
 
54
53
 
55
- def validate_multipart_request(
54
+ def validate_multipart_request[ModelT: BaseModel](
56
55
  model: type[ModelT], data: Mapping[str, WireValue], file_fields: Collection[str], message: str
57
56
  ) -> ModelT:
58
57
  """Validate multipart fields whose binary content is transported separately."""
@@ -5,11 +5,10 @@ from copy import deepcopy
5
5
  from dataclasses import dataclass, field
6
6
  from html.parser import HTMLParser
7
7
  from types import MappingProxyType
8
- from typing import IO, Literal, Self, TypeAlias, cast
8
+ from typing import IO, Literal, Self, cast, override
9
9
  from urllib.parse import unquote
10
10
 
11
11
  from pydantic import BaseModel, JsonValue, model_validator
12
- from typing_extensions import override
13
12
 
14
13
  from matelab._generated import models as wire_models
15
14
  from matelab._hashes import LOWERCASE_SHA256_PATTERN
@@ -426,7 +425,7 @@ class StagedAttachment:
426
425
  raise ValueError("Staged attachment metadata is invalid.")
427
426
 
428
427
 
429
- RecordImportValue: TypeAlias = (
428
+ type RecordImportValue = (
430
429
  str
431
430
  | int
432
431
  | float
@@ -434,9 +433,9 @@ RecordImportValue: TypeAlias = (
434
433
  | None
435
434
  | StagedAttachment
436
435
  | CloudFile
437
- | Mapping[str, "RecordImportValue"]
438
- | list["RecordImportValue"]
439
- | tuple["RecordImportValue", ...]
436
+ | Mapping[str, RecordImportValue]
437
+ | list[RecordImportValue]
438
+ | tuple[RecordImportValue, ...]
440
439
  )
441
440
 
442
441
 
@@ -563,7 +562,7 @@ class RecordTableFileColumnDeletion:
563
562
  name: str
564
563
 
565
564
 
566
- RecordChange: TypeAlias = (
565
+ type RecordChange = (
567
566
  RecordValueUpdate
568
567
  | RecordValueDeletion
569
568
  | RecordModuleCreation
@@ -79,7 +79,7 @@ class Uploads:
79
79
  complete_sha256: str | None = None,
80
80
  content_type: str = "application/octet-stream",
81
81
  ) -> StagedUploadSession | StagedFile:
82
- """Stage bytes; preserve the sanitized, case-sensitive filename extension when resuming."""
82
+ """Stage bytes; continuation filenames may change, and completion uses the final filename."""
83
83
  if session is None:
84
84
  session = StagedUploadSession(
85
85
  binding=UploadBindingRef.new(), upload_session_id=f"tmp-{secrets.token_urlsafe(24)}"
@@ -163,7 +163,7 @@ class Uploads:
163
163
  )
164
164
 
165
165
  async def abort(self, upload: StagedUploadSession | StagedFile) -> None:
166
- """Cancel incomplete extension variants; completed staging identities remain untouched (PVD-052)."""
166
+ """Cancel extensionless incomplete bytes; completed staging identities remain untouched (PVD-052)."""
167
167
  if isinstance(upload, StagedFile):
168
168
  # The completed file keeps this Provider identity private except for same-module cleanup.
169
169
  upload_session_id = upload._upload_session_id # pyright: ignore[reportPrivateUsage]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: matelab-python-sdk
3
- Version: 0.2.0a9
3
+ Version: 0.3.0a1
4
4
  Summary: Reusable async Python client for the Matelab Integration Contract
5
5
  Author: CMPDC, Institute of Physics, Chinese Academy of Sciences
6
6
  License-Expression: Apache-2.0
@@ -12,24 +12,24 @@ Classifier: Framework :: AsyncIO
12
12
  Classifier: Operating System :: OS Independent
13
13
  Classifier: Programming Language :: Python :: 3
14
14
  Classifier: Programming Language :: Python :: 3 :: Only
15
- Classifier: Programming Language :: Python :: 3.11
16
15
  Classifier: Programming Language :: Python :: 3.12
17
16
  Classifier: Programming Language :: Python :: 3.13
18
17
  Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Programming Language :: Python :: 3.15
19
19
  Classifier: Topic :: Scientific/Engineering
20
20
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
21
  Classifier: Typing :: Typed
22
- Requires-Python: >=3.11
22
+ Requires-Python: >=3.12
23
23
  Requires-Dist: httpx2>=2.16.0
24
24
  Requires-Dist: jsonschema>=4.26.0
25
- Requires-Dist: pydantic>=2.14.1
25
+ Requires-Dist: pydantic>=2.14.3
26
26
  Requires-Dist: typing-extensions>=4.16.0
27
27
  Description-Content-Type: text/markdown
28
28
 
29
29
  # matelab-python-sdk
30
30
 
31
31
  Async Python client for the Matelab Integration Contract, with typed interfaces for authentication,
32
- notebooks, records, attachments, cloud files, templates, and literature. Requires Python 3.11 or newer.
32
+ notebooks, records, attachments, cloud files, templates, and literature. Requires Python 3.12 or newer.
33
33
 
34
34
  ## Installation
35
35
 
@@ -64,6 +64,6 @@ asyncio.run(main())
64
64
 
65
65
  ## Documentation
66
66
 
67
- - [API reference](https://github.com/tiannianzhu/matelab-python-sdk/blob/main/docs/api.md): Session persistence, errors, examples, and Provider limits.
68
- - [Operation coverage](https://github.com/tiannianzhu/matelab-python-sdk/blob/main/docs/operation-coverage.yaml): supported operations.
69
- - [Development and releases](https://github.com/tiannianzhu/matelab-python-sdk/blob/main/docs/development.md): checks, Provider smoke, versioning, and builds.
67
+ - [API reference](https://gitee.com/mat-code/matelab-python-sdk/blob/main/docs/api.md): Session persistence, errors, examples, and Provider limits.
68
+ - [Operation coverage](https://gitee.com/mat-code/matelab-python-sdk/blob/main/docs/operation-coverage.yaml): supported operations.
69
+ - [Development and releases](https://gitee.com/mat-code/matelab-python-sdk/blob/main/docs/development.md): checks, Provider smoke, versioning, and builds.
@@ -1,26 +1,26 @@
1
1
  matelab/__init__.py,sha256=cJgzpDJiKJ9-XANRfRAjiRNoFVc3EovfxO-M2vu-HwU,5093
2
2
  matelab/_hashes.py,sha256=ImrLHx9wvcU6R-xGOrUCVDN_30sYA2UMn-NLwFrmFtU,163
3
- matelab/_transport.py,sha256=hdDxNsVnEYoZvhtkD4hQLzsVhlOTKsU4wvCdOpHVDuI,14863
4
- matelab/_wire_validation.py,sha256=nGXANykegIy7kvBcsCdFjdOHTj6py_jwMNST87At1xU,4790
3
+ matelab/_transport.py,sha256=PP5zsU__ZMbEdME3bS0Hfx9AKtMF8P2tTyknviYlQzE,14789
4
+ matelab/_wire_validation.py,sha256=yRZdsh3mM0EzCew4iOLqZTBSaihoo6ke8VKHIsLp_XA,4756
5
5
  matelab/client.py,sha256=SXlrTX8ekf7ympTxCXlrt4tE3UHqM5adDj4EFUXGwWg,5068
6
6
  matelab/errors.py,sha256=CJjZH12nca_-41msyLYMrIDpIaQO4CDgz2LaQRVBzpQ,1630
7
7
  matelab/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
8
8
  matelab/session.py,sha256=D8i9uyAt32-bADotS-Lrb7RpmWRNYNIkIpZUijTYvy4,899
9
9
  matelab/streaming.py,sha256=36epH2josWk87Ors_JY0YsjNmtiq3NZa2iB9djLmlnY,3792
10
10
  matelab/_generated/__init__.py,sha256=jmGbXLLe3JorsGU7OUdF8iKGewFMRqkCzgyFAw7C15w,79
11
- matelab/_generated/models.py,sha256=VhE1ixBb-qflSTEO8VEbixnB6jtHshXqCd9gAgJBGQ8,179704
11
+ matelab/_generated/models.py,sha256=Q19JccPYKBzXXEf6Rr1N4L9zKKh0itmfHKhTEmqAJAo,179707
12
12
  matelab/domains/__init__.py,sha256=C34IWsGoCAwP7r6uYKJ79DJkToZyrZ4LWA87ufc1i0Q,65
13
13
  matelab/domains/_attachment_content.py,sha256=z26hwFpdgAk2x1w8EGe00XBLtJ3QFDX8BPS35Zc5SoE,1461
14
14
  matelab/domains/cloud_drive.py,sha256=EoqAYWvLVUfVOsic3g-TxsQEtAI3wTp5h0_vB79KpwY,10406
15
15
  matelab/domains/groups.py,sha256=H8-Da2WTm2Ui4m3Nr1bhMNMn7stbzbRa3EmpkTRmkBU,1300
16
16
  matelab/domains/literature.py,sha256=xpdHuFCR1RpEPB_Lk8VOaddlIpGQ2rnp4kxl5a8Bk4M,27473
17
17
  matelab/domains/notebooks.py,sha256=_SvffaViECSEOkN5iwXtSv6El3fK2OYaR4RJvUCXfGk,13477
18
- matelab/domains/records.py,sha256=U3zOLwTjJ1YbnuayGXKroEKhUZLhsmjRCYtnFaDyJzQ,95614
18
+ matelab/domains/records.py,sha256=0R8MdA-HJQqy0cBKrFWxesOyshGF9cisg7RyIU9Y0pg,95556
19
19
  matelab/domains/templates.py,sha256=-x7RqRLhrRnAK3HGK3c4I3C-SsAk7zpicIcvzoVd414,17698
20
- matelab/domains/uploads.py,sha256=6y4i85UWGxumasWw9HAubcgtK_fqgZLnBUbX0oghxQU,7699
20
+ matelab/domains/uploads.py,sha256=NcOSJg5Q54e-rv7WIBRz3us4qUU9U4rmYvkkKiKq_tI,7702
21
21
  matelab/domains/users.py,sha256=ZhlLzC_AadwYqNqxQrqkUBgIUqL7MJ6FgMyxwq-az8s,1445
22
- matelab_python_sdk-0.2.0a9.dist-info/METADATA,sha256=l5luHe5D2BRV0uAUoy1EusPL6A_bpCGQSlqHEp08_Ro,2436
23
- matelab_python_sdk-0.2.0a9.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
24
- matelab_python_sdk-0.2.0a9.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
25
- matelab_python_sdk-0.2.0a9.dist-info/licenses/NOTICE,sha256=Hc4scCJTof5VL3JCPI2aaewnnzCejIHUGuBVYBf-klc,98
26
- matelab_python_sdk-0.2.0a9.dist-info/RECORD,,
22
+ matelab_python_sdk-0.3.0a1.dist-info/METADATA,sha256=5pGcaed3-KRhwA_j66kouW_gC6-UUWkDY-kZoXHTjv0,2424
23
+ matelab_python_sdk-0.3.0a1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
24
+ matelab_python_sdk-0.3.0a1.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
25
+ matelab_python_sdk-0.3.0a1.dist-info/licenses/NOTICE,sha256=Hc4scCJTof5VL3JCPI2aaewnnzCejIHUGuBVYBf-klc,98
26
+ matelab_python_sdk-0.3.0a1.dist-info/RECORD,,