streamlit-pydantic icon indicating copy to clipboard operation
streamlit-pydantic copied to clipboard

Basic Demo does not appear up to date

Open DominiquePaul opened this issue 1 year ago • 4 comments

Describe the bug:

Hi all, love the idea of the package.

I am trying to run the basic example in the readme:

import streamlit as st
from pydantic import BaseModel

import streamlit_pydantic as sp


class ExampleModel(BaseModel):
    some_text: str
    some_number: int
    some_boolean: bool


data = sp.pydantic_form(key="my_form", model=ExampleModel)
if data:
    st.json(data.json())

But I get the error:

PydanticImportError: BaseSettings has been moved to the pydantic-settings package. See https://docs.pydantic.dev/2.5/migration/#basesettings-has-moved-to-pydantic-settings for more details. For further information visit https://errors.pydantic.dev/2.5/u/import-error

I initially thought this might be duplicate of #52 or #38, but I the settings aren't directly imported in the code. Maybe it's easiest to update the code in the readme so the newbie's like me understand how to use this module :)

Technical details:

I am using python 3.11.7 and these package versions:

pydantic 2.5.3 pydantic_core 2.14.6 pydantic-settings 2.1.0 streamlit-pydantic 0.6.0

DominiquePaul avatar Jan 24 '24 19:01 DominiquePaul

Still reporting the same error as above.

Great to see this repo updated, though!

PlebeiusGaragicus avatar Apr 24 '24 03:04 PlebeiusGaragicus

It works fine in master branch. Just do this: pip install git+https://github.com/LukasMasuch/streamlit-pydantic.git@main

BGFGB avatar May 11 '24 03:05 BGFGB

@BGFGB Thanks. That's the issue. The pypi package is not up to date at the moment, but the git is.

danilo-css avatar May 17 '24 15:05 danilo-css