Skip to content

[bug] Setting auto_cast in instance options is ignored #772

@pvmm

Description

@pvmm

Affected version: 3.1.9

Describe the bug
Setting auto_cast option inside config.py to False is ignored, even though the docs say otherwise.

To Reproduce
Add auto_cast to Dynaconf initialization.

from dynaconf import Dynaconf

settings = Dynaconf(
    settings_files=["settings.toml", ".secrets.toml"],
    auto_cast=False,
    **more_options
)

Add the following to the settings.toml:

foo="@int 32"

Check value of foo in your program.py:

from config import settings

foo = settings.get('foo', False)
print(f"{foo=}", type(foo))

Executing program.py will return:

foo=32 <class 'int'>

when it should return:

foo='@int 32' <class 'str'>

Running program.py with AUTO_CAST_FOR_DYNACONF=false works as expected.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions