diff --git a/config_state/config_state.py b/config_state/config_state.py index 6318266..7645bc8 100644 --- a/config_state/config_state.py +++ b/config_state/config_state.py @@ -1167,8 +1167,8 @@ def config_summary(self): def get_nested_config(object: Any): if isinstance(object, ConfigState): - config = dict([(k, get_nested_config(getattr(object, k))) - for k in object._config_fields.keys()]) + config = dict([(k, get_nested_config(v._value_)) + for k, v in object._config_fields.items()]) return config else: return str(object) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..13652f1 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,29 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "config-state" +version = "1.0.2" +authors = [ + { name = "Nicolas Pinchaud", email = "nicolas.pinchaud@gmail.com" }, +] +description = """ +config-state is a Python module that helps implement classes using the ConfigState pattern. +This pattern enhances classes by: + 1.Adding structured configuration management + 2.Providing state handling capabilities + 3.Enabling object creation from configuration files + 4.Offering fine-grained control over how objects are serialized and deserialized""" +readme = "README.md" +requires-python = ">=3.7" +dependencies = [ + "pyyaml", +] +classifiers = [ + "Programming Language :: Python :: 3", + "Operating System :: OS Independent", +] + +[tool.setuptools.packages.find] +exclude = ["tests", "examples"] \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index e81b80b..0000000 --- a/setup.py +++ /dev/null @@ -1,26 +0,0 @@ -import setuptools - -with open("README.md", "r") as fh: - long_description = fh.read() - -setuptools.setup( - name="config-state", - version="1.0.2", - author="Nicolas Pinchaud", - author_email="nicolas.pinchaud@gmail.com", - description="config-state is a Python module for implementing classes with " - "the `ConfigState` pattern. The pattern augments classes with " - "configuration and state semantics enabling their " - "instantiation through configuration files together with an " - "improved control over their (de)serialization logics.", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/nicolaspi/config-state", - packages=setuptools.find_packages(exclude=('tests', 'examples')), - classifiers=[ - "Programming Language :: Python :: 3", - "Operating System :: OS Independent", - ], - python_requires='>=3.7', - install_requires=['pyyaml'], -)