Environs

Latest version: v14.1.1

Safety actively analyzes 722491 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 9

14.1.1

Bug fixes:

- Typing: Fix typing for `env.list` and `env.dict` to properly handle
`default` and `subcast` arguments ([406](https://github.com/sloria/environs/issues/406)).
Thanks [lucas-bremond](https://github.com/lucas-bremond) for the PR.
- Add `env` to `__all__` ([396](https://github.com/sloria/environs/issues/396)).
Thanks [daveflr](https://github.com/daveflr) for reporting.

Changes:

- _Backwards-incompatible_: `recurse`, `verbose`, `override`,
and `return_path` parameters to `Env.read_env` are now keyword-only.
- _Backwards-incompatible_: The `required` argument to parser methods
is removed. Call a parser method without a default value to make it required.

14.1.0

Features:

- Add `prefix` parameter to `Env` constructor ([384](https://github.com/sloria/environs/issues/384)).
Thanks [arthurc0102](https://github.com/sloria/environs/issues/384)
for the suggestion.
- Re-export `validate` module from marshmallow ([385](https://github.com/sloria/environs/issues/385)).

Bug fixes:

- Typing: Fix typing for `Env.enum` to allow `by_value` to be passed ([386](https://github.com/sloria/environs/issues/386)).

14.0.0

Features:

- Add `env` singleton ([194]).
Thanks [AndBondStyle](https://github.com/AndBondStyle) for the suggestion.

python
from environs import env


Changes:

- `default` values are expected to be their in their deserialized form.
_Backwards-incompatible_: Passing serialized values to `default`
is no longer supported.

python
from datetime import date, timedelta
import environs

DO
enable_login = env.bool("ENABLE_LOGIN", True)
ttl = env.timedelta("TTL", default=timedelta(seconds=600))
release_date = env.date("RELEASE", date(2025, 1, 7))
numbers = env.list("FOO", [1.0, 2.0, 3.0], subcast=float)

DON'T
enable_login = env.bool("ENABLE_LOGIN", "true")
ttl = env.timedelta("TTL", default=600)
release_date = env.date("RELEASE", "2025-01-07")
numbers = env.list("NUMBERS", "1,2,42", subcast=float)


The exceptions to this rule are the Django-related functions, which
accept string defaults.

python
DATABASE_URL = env.dj_db_url("DATABASE_URL", default="postgresql://localhost:5432/mydb")


This fixes [297](https://github.com/sloria/environs/issues/297)
and [270](https://github.com/sloria/environs/issues/270).

13.0.0

Features:

- Typing: Add type hints for parser methods ([367](https://github.com/sloria/environs/issues/367)).
Thanks [OkeyDev](https://github/OkeyDev) for the PR.
- Add `by_value` param to `Env.enum`. Pass `by_value=True` to parse Enum by values instead of names.

Other changes:

- Drop support for marshmallow<3.18.0.
- _Backwards-incompatible_: Remove `load_default` param from parser methods. Use `default` instead.
- _Backwards-incompatible_: Rename `Env.enum`'s `type` param to `enum`.
- _Backwards-incompatible_: Remove `ignore_case` param from `Env.enum`.
- _Backwards-incompatible_: Remove
`allow_none`, `error_messages`, and `metadata` params from parser methods.

12.0.0

Features:

- `Env.enum` allows passing an `Enum` as `default`.

Other changes:

- Support marshmallow 4.
- Support Python 3.9-3.13.
- _Backwards-incompatible_: Make `Field` classes private. Users should
not need to access these.

11.2.1

Bug fixes:

- Fix passing non-string default values to `Env.timedelta` ([369](https://github.com/sloria/environs/pull/369)).
Thanks [tcleonard](https://github.com/tcleonard) for reporting and
thanks [ddelange](https://github.com/ddelange) for the PR.
- Fix `Env.read_env(recurse=True)` so that it returns as soon as a `.env`
file is found ([370](https://github.com/sloria/environs/pull/370)).
Thanks [senese](https://github.com/senese) for the PR.

Page 1 of 9

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.