spork
Exposing simple ways to render pydantic models in notebooks and other interactive computing environments.
Table of Contents
Installation
pip install spork
Background
I created this module because I wanted a simple way to describe how to render pydantic models, especially when streaming in data to update a model. Wouldn't it be nice to see a visual display of the model as it's being updated?
To explore this space a bit, I've created a View and an AutoView. This lets you update fields and have them update within the notebook.
Usage
You can use existing pydantic models or create new ones by inheriting from AutoView:
from spork import AutoView
from pydantic import BaseModel
class Record(BaseModel):
name: str
age: int
class RecordView(Record, AutoView):
def render(self):
return f"<b>{self.name}</b> is {self.age} years old."
rv = RecordView(name="Kyle", age=35)
rv.display()
When using an AutoView, you can update the fields and the view will update wherever you ran .display()
rv.age = 101
License
spork is distributed under the terms of the MIT license.
Metadata
Release files for spork 1.2.0
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 |
|---|---|---|---|---|
| spork-1.2.0.tar.gz | 8.0 kB | Without provenance | Details for spork-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spork-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for spork-1.2.0-py3-none-any.whl |
Total release size: 15.5 kB
Release files / spork-1.2.0.tar.gz
| Download URL | spork-1.2.0.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b16e8af845bc54b16dfdc96385a0b54a3c10ed6a57bf4d74fe3a65b35255bbb
|
|
BLAKE2b-256 checksum How to use checksums |
03b508c6b7e9bafc450afaa768494e32aece4e79ed50ea1bceb71d5c7a697b77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.26.0
|
Release files / spork-1.2.0-py3-none-any.whl
| Download URL | spork-1.2.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2b970094010cc321aa8dd8c81a763064e977ce8ad8d5eaa7b3d9cdf844a5a50e
|
|
BLAKE2b-256 checksum How to use checksums |
0a81000396016c495c9e80b7f78882b03395fbaaa00530fdb12caee3e762eb7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.26.0
|
Security for spork 1.2.0
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.