Supported annotation variants
import typing
import ywpi
def fn(
a1: int,
a2: str,
a3: float,
# String as text
a4: typing.Annotated[str, ywpi.Text],
# File content
a5: typing.Annotated[bytes, ywpi.File],
# File reference
a6: typing.Annotated[ywpi.Ref, ywpi.File],
):
pass
Referenced JSON
{
"output_str": {
"type": "str",
"value": ""
},
"output_int": {
"type": "int",
"value": 0
},
"output_url": {
"type": "url",
"value": "https://python.org/"
},
"output_ref": {
"type": "ref",
"value": {
"drive_id": "",
"preview_href": ""
}
}
}
Multiple level of serialization
- Application - regular python dictionary with python objects
- Hub - serialize dictionary in
StartTaskRequestmodel- Referencify
bytesvalues with attachments
- Referencify
- gRPC - serialize
StartTaskRequestto string viaJSONstring +attachmentsmap
Serialization for model with bytes fields
Ywpi pass additional context to pydantic model_validate method.
Context has next format:
{
"attachments": {
"attachment_key": b"binary content"
}
}
class Model(pydantic.BaseModel):
class File(pydantic.BaseModel):
content: bytes
@pydantic.field_validator('content', mode='before')
def validate(data, info: pydantic.ValidationInfo) -> bytes:
print("Validate", data, "\n")
if isinstance(data, dict):
key = data["$attachment"]
if key in info.context["attachments"]:
return info.context["attachments"][key]
else:
raise ValueError(f'conten with key "{key}" does not present in the attachments')
return data
files: list['Model.File'] = []
Metadata
Release files for ywpi 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ywpi-0.1.5.tar.gz | 28.9 kB | Without provenance | Details for ywpi-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ywpi-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for ywpi-0.1.5-py3-none-any.whl |
Total release size: 64.9 kB
Release files / ywpi-0.1.5.tar.gz
| Download URL | ywpi-0.1.5.tar.gz |
|---|---|
| Size | 28.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7322890b20bfa15028c71025e6b08e7e3527c771851a36ee75b3ff468520bd31
|
|
BLAKE2b-256 checksum How to use checksums |
7051c5c188a12824bdaea7d566de9267a8b7740aea33ab351443e2f959a22c6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.14
|
Release files / ywpi-0.1.5-py3-none-any.whl
| Download URL | ywpi-0.1.5-py3-none-any.whl |
|---|---|
| Size | 36.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
25ead8863ca7281bb59fd965adef74f057ede4de9a3dc23612623a4ccb89525b
|
|
BLAKE2b-256 checksum How to use checksums |
5ca53e02f85a1b808c2625e4fea68fde1eb16286c9099986af077c89de15e7ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.14
|
Security for ywpi 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.