Skip to content

Commit 6cf5ff8

Browse files
committed
update
1 parent ffbfcb5 commit 6cf5ff8

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

confdantic/confdantic.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import json
22
import os
3-
from typing import Literal
3+
from typing import Any, Literal
44

55
import toml
66
import tomlkit
@@ -73,7 +73,7 @@ def to_commented_yaml(self) -> CommentedMap | CommentedSeq:
7373
"""
7474
return self._to_commented_yaml(self)
7575

76-
def _to_commented_yaml(self, obj: T.Any) -> CommentedMap | CommentedSeq | T.Any:
76+
def _to_commented_yaml(self, obj: Any) -> CommentedMap | CommentedSeq | Any:
7777
if issubclass(obj.__class__, BaseModel):
7878
cm = CommentedMap()
7979
for field_name, field in obj.model_fields.items():
@@ -207,7 +207,7 @@ def save_toml(self, filepath: str, overwrite: bool = True, comments: bool = True
207207
except TypeError:
208208
is_base_model = False
209209

210-
if is_base_model:
210+
if is_base_model and field.annotation:
211211
subfield = field.annotation
212212
for subfname, f in subfield.model_fields.items():
213213
table: Table = toml_doc[name]

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[project]
22
name = "confdantic"
3-
version = "0.0.5"
3+
version = "0.0.6"
44
description = "Confdantic is a Python library that enhances Pydantic's capabilities for working with JSON, YAML, and TOML formats. It preserves field descriptions as comments when serializing to YAML or TOML, making it great for generating user-friendly configuration files."
55
authors = [{ name = "Žiga Ivanšek", email = "ziga.ivansek@gmail.com" }]
66
license = { file = "LICENSE.txt" }
77
readme = "README.md"
88
requires-python = ">=3.10"
99
dependencies = [
1010
"pydantic>=2.8.2",
11-
"objinspect>=0.2.13",
11+
"objinspect>=0.2.15",
1212
"tomlkit>=0.12.3",
1313
"toml==0.10.2",
1414
"ruamel.yaml>=0.18.6",

0 commit comments

Comments
 (0)