- Backwards Incompatible Release
- Removed the
_config_file
attribute fromGoodConf
. If you previously set this attribute, you are no longer be able to do so.
- Removed the
- Support reading TOML files via
tomllib
on Python 3.11+ - Update Markdown generation, so that output matches v4 output
Backwards Incompatible Release
- Removed official support for Python 3.8
- upgraded to pydantic2
To upgrade from goodconf v4 to goodconf v5:
If subclassing
GoodConf
, replace uses ofclass Config
withmodel_config
.For example goodconf v4 code like this:
from goodconf import GoodConf class AppConfig(GoodConf): "Configuration for My App" DATABASE_URL: PostgresDsn = "postgres://localhost:5432/mydb" class Config: default_files = ["/etc/myproject/myproject.yaml", "myproject.yaml"] config = AppConfig()
should be replaced in goodconf v5 with:
from goodconf import GoodConf class AppConfig(GoodConf): "Configuration for My App" DATABASE_URL: PostgresDsn = "postgres://localhost:5432/mydb" model_config = {"default_files": ["/etc/myproject/myproject.yaml", "myproject.yaml"]} config = AppConfig()
- Release from GitHub Actions
- Another markdown output fix
- Fix for markdown generation generation on Python 3.8 & 3.9
- Fix trailing whitespace in markdown output
- Removed errant print statement
- Removed official support for Python 3.7
- Added support for Python 3.12
- Fixed type display in Markdown generation
- Changed markdown output format (trailing spaces were problematic).
- pin to pydantic < 2 due to breaking changes in 2.0
- TOML files are now supported as configuration source
- Python 3.11 and 3.10 are now officially supported
- Python 3.6 is no longer officially supported
- Requires Pydantic 1.7+
- Variables can now be set during class initialization
- Change to newer syntax for safe loading yaml
- Backwards Incompatible Release
Internals replaced with pydantic. Users can either pin to
1.0.0
or update their code as follows:- Replace
goodconf.Value
withgoodconf.Field
. - Replace
help
keyword argument withdescription
inField
(previouslyValue
). - Remove
cast_as
keyword argument fromField
(previouslyValue
). Standard Python type annotations are now used. - Move
file_env_var
anddefault_files
keyword arguments used in class initialization to a sub-class namedConfig
Given a version
1
class that looks like this:from goodconf import GoodConf, Value class AppConfig(GoodConf): "Configuration for My App" DEBUG = Value(default=False, help="Toggle debugging.") MAX_REQUESTS = Value(cast_as=int) config = AppConfig(default_files=["config.yml"])
A class updated for version 2 would be:
from goodconf import GoodConf, Field class AppConfig(GoodConf): "Configuration for My App" DEBUG: bool = Field(default=False, description="Toggle debugging.") MAX_REQUESTS: int class Config: default_files=["config.yml"] config = AppConfig()
- Replace
- Environment variables take precedence over configuration files in the event of a conflict
- Use null value for initial if allowed
- Store the config file parsed as
GoodConf.Config._config_file
- Backwards Incompatible: Migrated backend to
pydantic
.Value
is replaced by the Field function.help
keyword arg is nowdescription
GoodConf
is now backed by BaseSettings Instead of passing keyword args when instantiating the class, they are now defined on aConfig
class on the object
- Allow overriding of values in the generate_* methods
- Python 3.7 supported
- Explicit
load
method django_manage
method helper onGoodConf
- Fixed a few minor bugs
- Use a declarative class to define GoodConf's values.
- Change description to a docstring of the class.
- Remove the redundant
required
argument fromValues
. To make an value optional, give it a default. - Changed implicit loading to happen during instanciation rather than first
access. Instanciate with
load=False
to avoid loading config initially.
- Implicitly load config if not loaded by first access.
-c
is used by Django'scollectstatic
. Using-C
instead.
- Adds
goodconf.contrib.argparse
to add a config argument to an existing parser.
- Major refactor from
file-or-env
togoodconf
- Fixed packaging issue.
- Fixes bug in stack traversal to find calling file.
- Initial release