Skip to main content

Streamlit-react-jsonschema

Streamlit component, building form by react-jsonschema-form.

This library is experimental for GhostOS yet.

Installation

install streamlit-react-jsonschema with pip

pip install streamlit_react_jsonschema

Example

see baseline example

from typing import Union, List, Dict
import streamlit as st
import streamlit_react_jsonschema as srj
import inspect
from pydantic import BaseModel, Field


class Student(BaseModel):
    name: str = Field(description="name of the student")
    level: int = Field(description="level of the student")


class SomeClass(BaseModel):
    """
    test class of pydantic model Foo
    """
    name: Union[str, None] = Field(None, description="filed with optional[str]")
    age: int = Field(0, description="bar value")
    some_float: float = Field(description="test about float value")

    students: List[Student] = Field(default_factory=list, description="list of students")
    students_dict: Dict[str, Student] = Field(default_factory=dict, description="dict of students")


st.title("Streamlit-react-jsonschema Example")
with st.expander("source code of the example pydantic class", expanded=True):
    codes = inspect.getsource(SomeClass)
    st.code(codes)

value, submitted = srj.pydantic_form(model=SomeClass)

st.subheader("result:")
st.write(f"submitted: {submitted}")
st.write(f"type of the result: {type(value)}")
st.write(value)
if isinstance(value, BaseModel):
    st.write("model dump value")
    st.write(value.model_dump(exclude_defaults=False))

How to run this example? Check streamlit first~

Dependencies

Metadata

Release files for streamlit_react_jsonschema 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for streamlit_react_jsonschema 0.1.6
File Size Uploaded
streamlit_react_jsonschema-0.1.6.tar.gz 1.6 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for streamlit_react_jsonschema 0.1.6
File Interpreter ABI Platform
streamlit_react_jsonschema-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 3.1 MB

Release files / streamlit_react_jsonschema-0.1.6.tar.gz

Download URL streamlit_react_jsonschema-0.1.6.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
d898501dbf1b9a0081b288ce03af3e398ce2ef6ec52e908aeff55dc3e935d8b3
BLAKE2b-256 checksum
How to use checksums
1d3906f39ba92c10a1e3ea8f9b81e4653f44a35e7ba3f33afcd26349235c01cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.6 Darwin/23.6.0

Release files / streamlit_react_jsonschema-0.1.6-py3-none-any.whl

Download URL streamlit_react_jsonschema-0.1.6-py3-none-any.whl
Size 1.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
0c585fea463620d7dfe259da7915c3d255d06d9379828e0ff16623797d2cd1c7
BLAKE2b-256 checksum
How to use checksums
e209b69a475b3660e750a484f965ebc6ddbe3d3edca37474ed3f94bb55793da0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.6 Darwin/23.6.0

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page