diff --git a/README.md b/README.md index ae0e103..b2712a5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # tomlantic > [!WARNING] -> tomlantic is at 0.1.1 and currently, only i use it myself. it isn't battle tested, +> tomlantic is at 0.1.2 and currently, only i use it myself. it isn't battle tested, > so issues may arise. > if you're willing to run into potential bugs and issues, feel free to use it! diff --git a/pyproject.toml b/pyproject.toml index fae18ea..ada23ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "tomlantic" -version = "0.1.1" +version = "0.1.2" description = "marrying pydantic models and tomlkit documents" authors = ["Mark Joshwel "] license = "Unlicense" diff --git a/test.py b/test.py index 9ea6c2a..107b5d0 100644 --- a/test.py +++ b/test.py @@ -26,6 +26,8 @@ class File(pydantic.BaseModel): # where tomlantic becomes handy toml = ModelBoundTOML(File, toml_doc) +print(toml) + # access the model with .model and change the model freely model: File = toml.model model.project.typechecked = True diff --git a/tomlantic/__pycache__/__init__.cpython-38.pyc b/tomlantic/__pycache__/__init__.cpython-38.pyc index 45a2c8c..6055f01 100644 Binary files a/tomlantic/__pycache__/__init__.cpython-38.pyc and b/tomlantic/__pycache__/__init__.cpython-38.pyc differ diff --git a/tomlantic/__pycache__/tomlantic.cpython-38.pyc b/tomlantic/__pycache__/tomlantic.cpython-38.pyc index 67515bb..0739d26 100644 Binary files a/tomlantic/__pycache__/tomlantic.cpython-38.pyc and b/tomlantic/__pycache__/tomlantic.cpython-38.pyc differ diff --git a/tomlantic/tomlantic.py b/tomlantic/tomlantic.py index c273311..90aedfa 100644 --- a/tomlantic/tomlantic.py +++ b/tomlantic/tomlantic.py @@ -231,6 +231,11 @@ class ModelBoundTOML(Generic[M]): __original_model: M __document: TOMLDocument + + def __repr__(self) -> str: + return f"{self.__class__.__name__}(model={self.model.__repr__()})" + + def __init__( self, model: Type[M],