Conf as pydantic
See original GitHub issueHi,
I just wonder if there any possible transform configuration as pydantic.BaseSettings type?
There are some frameworks are dependency on pydantic settings.
This is weird to import pydantic to DI’s config then to provide it as pydantic again
Or can I use like
from dependency_injector import containers
from pydantic import BaseSettings
class Settings(BaseSettings):
...
class Contrainer(containers.DeclarativeContainer):
settings = providers.Singleton(Settings)
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Settings management - pydantic
Create a clearly-defined, type-hinted application configuration class; Automatically read modifications to the configuration from environment variables ...
Read more >Pedantic Configuration Management with Pydantic
The class GlobalConfig inherits from Pydantic's BaseSettings which helps to load and read the variables from the .env file. The .env file itself ......
Read more >Pydantic Model Config with Examples | by ukyen | Dec, 2022
Pydantic is a powerful parsing library that validates input data during runtime. It brings a series configuration options in the Config ...
Read more >Configuration management in Python like a Boss(Pydantic ...
Let's modify our configuration to have a different environment and some more configurations. 1. Class-based config. config.py. import os from typing import ...
Read more >Model Config - pydantic
Behaviour of pydantic can be controlled via the Config class on a model or a pydantic dataclass. Python 3.7 and above. from pydantic...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’d like to second this concern- my current use case would benefit from a passed pydantic object rather than the dict:
I have the same issue but managed to work around it by
This works, although I would prefer to get the pydantic object from the start when using the
pydantic_settings
option 😅