Skip to content

Commit

Permalink
migration guide
Browse files Browse the repository at this point in the history
  • Loading branch information
silvanmelchior-zuehlke committed Jul 14, 2023
1 parent 82801db commit 46e93cc
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ It furthermore supports you in common use cases like:
* Config changes for unit tests
* Custom config sources

**UPDATE**: ConfZ 2 is here, with support for pydantic 2 and improved naming conventions.
Check out the [migration guide](https://confz.readthedocs.io/en/latest/migration_guide.html).

## :package: Installation

Expand Down
2 changes: 1 addition & 1 deletion confz/base_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __call__(cls, config_sources: Optional[ConfigSources] = None, **kwargs):


class BaseConfig(BaseModel, metaclass=BaseConfigMetaclass, frozen=True):
"""Base class, parent of every config class. Internally wraps :class:`BaseModel`of
"""Base class, parent of every config class. Internally wraps :class:`BaseModel` of
pydantic and behaves transparent except for two cases:
- If the constructor gets `config_sources` as kwarg, these sources are used as
Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Contents
:maxdepth: 2

usage/usage
migration_guide
reference/reference


Expand Down
35 changes: 35 additions & 0 deletions docs/source/migration_guide.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Migration Guide
===============

This guide helps you to easily migrate to ConfZ 2, which supports pydantic 2 and
improves naming conventions.

New Class Names
---------------

We renamed many classes to better reflect their purpose instead of being tied to the
package name. The following table summarizes all changes. Please make sure you adjust
your imports accordingly.

==================== ===============
ConfZ v1 ConfZ v2
==================== ===============
ConfZ BaseConfig
ConfZSource ConfigSource
ConfZSources ConfigSources
ConfZCLArgSource CLArgSource
ConfZDataSource DataSource
ConfZEnvSource EnvSource
ConfZFileSource FileSource
ConfZException ConfigException
ConfZUpdateException UpdateException
ConfZFileException FileException
==================== ===============

Pydantic v2
-----------

Once initialized, a confz BaseConfig class behaves mostly like a regular pydantic
BaseModel class. Pydantic 2 comes with quite some changes, which might affect your code,
depending on the used functionalities. Check out the
`migration guide <https://docs.pydantic.dev/latest/migration/>`_.

0 comments on commit 46e93cc

Please sign in to comment.