Pydantic BaseModel Annotations for Qt
Project description
qt-pydantic
The qt-pydantic package adds support for Qt types in Pydantic BaseModels.
Using these annotations allows for easy serialization and deserialization of Qt types.
Installation
Install using pip:
pip install qt-pydantic
Usage
from PySide6 import QtCore, QtGui
from pydantic import BaseModel
from qt_pydantic import QSize, QColor, QDate
# Define a model with Qt types
class Settings(BaseModel):
size: QSize
date: QDate
color: QColor
# Parse json string into model
json_data = '{"size": [720, 480], "date": "2021-01-01", "color": [255, 95, 135]}'
settings = Settings.model_validate_json(json_data)
# Model types are actual Qt types
assert isinstance(settings.size, QtCore.QSize)
assert isinstance(settings.date, QtCore.QDate)
assert isinstance(settings.color, QtGui.QColor)
# Turn model into json string
data = settings.model_dump_json(indent=2)
Contributing
To contribute please refer to the Contributing Guide.
License
MIT License. Copyright 2024 - Beat Reichenbach. See the License file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qt_pydantic-0.1.1.tar.gz.
File metadata
- Download URL: qt_pydantic-0.1.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19e72680ed66ebc7cf24d060e8ee6336dccfd51869e79a03954e81c1a121a073
|
|
| MD5 |
4831930232e7483e5ab352119247b4d9
|
|
| BLAKE2b-256 |
3d976e209e8a38b3f8681928498f7ac8f666366e97d17a7943744c0278c003a3
|
Provenance
The following attestation bundles were made for qt_pydantic-0.1.1.tar.gz:
Publisher:
publish.yml on beatreichenbach/qt-pydantic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qt_pydantic-0.1.1.tar.gz -
Subject digest:
19e72680ed66ebc7cf24d060e8ee6336dccfd51869e79a03954e81c1a121a073 - Sigstore transparency entry: 219861630
- Sigstore integration time:
-
Permalink:
beatreichenbach/qt-pydantic@5164ec026e17756a9feefe888fd93ca1e22586bb -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/beatreichenbach
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5164ec026e17756a9feefe888fd93ca1e22586bb -
Trigger Event:
release
-
Statement type:
File details
Details for the file qt_pydantic-0.1.1-py3-none-any.whl.
File metadata
- Download URL: qt_pydantic-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c816cd0c8b80f83a1f0e6d1650abdf3cd6928eb3bbc2b63ea63c4a3777552c7
|
|
| MD5 |
47cfc1dffe07634aa974f2277dd481d7
|
|
| BLAKE2b-256 |
142bef5af14983f4d1d1ffe553386bec84d4e592458c3fb2594326d0f951fef3
|
Provenance
The following attestation bundles were made for qt_pydantic-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on beatreichenbach/qt-pydantic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qt_pydantic-0.1.1-py3-none-any.whl -
Subject digest:
5c816cd0c8b80f83a1f0e6d1650abdf3cd6928eb3bbc2b63ea63c4a3777552c7 - Sigstore transparency entry: 219861632
- Sigstore integration time:
-
Permalink:
beatreichenbach/qt-pydantic@5164ec026e17756a9feefe888fd93ca1e22586bb -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/beatreichenbach
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5164ec026e17756a9feefe888fd93ca1e22586bb -
Trigger Event:
release
-
Statement type: