log_level
accepts lower-cased log level names and rejects invalid names (#138). Thanks gnarvaja for the PR.
- Add
dj_cache_url
for caching Django cache URLs (requires installing with[django]
) (#126). Thanks epicserve for the suggestion and PR.
- Improve typings and run mypy with dependencies type annotations (#115).
- Distribute types per PEP 561 (#116).
Thanks hukkinj1 for the PRs.
- Backwards-incompatible: Remove
stream
argument fromread_env
, since it had no effect (#114). - Backwards-incompatible:
Env.read_env
consistently returnsNone
(#111). - Remove unnecessary
__str__
definition (#112).
Thanks hukkinj1 for the PRs.
Features:
- Add deferred validation via the
eager
parameter andenv.seal()
(#56). Thanks robertlagrant for the suggestion.
Other changes:
- Test against Python 3.8 (#108).
Features:
- Default parser methods are now defined as bound methods. This enables static analysis features, e.g. autocomplete (#103). Thanks rugleb for the suggestion. Backwards-incompatible: As a result of this change, adding a parser name that is the same as an existing method will result in an error being raised.
import environs
env = environs.Env()
# Below conflicts with built-in `url` method.
# In <6.0.0, this would override the built-in method.
# In >=6.0.0, this raises an error:
# environs.ParserConflictError: Env already has a method with name 'url'. Use a different name.
@env.parser_for("url")
def https_url(value):
return "https://" + value
Bug fixes:
- Fix error message for prefixed variables (#102). Thanks AGeekInside for reporting.
Other changes:
- Backwards-incompatible: Rename
Env.__parser_map__
toEnv.__custom_parsers__
.
Bug fixes:
- Fix behavior when recursively searching for a specified file (#96). Thanks ribeaud for the catch and patch.
Changes:
- Improve typings.
Features:
- Add
env.log_level
(#7). - Use
raise from
to improve tracebacks.
Other changes:
- Improve typings.
Features:
Other changes:
- Backwards-incompatible: Drop support for Python 2. If you use Python 2, you will need to use version 4.2.0 or older.
- Minor optimization.
Bug fixes:
- Reset prefix when an exception is raised within an
env.prefixed()
context (#78). Thanks rcuza for the catch and patch.
Bug fixes:
Support:
- Document how to read a specific file with
env.read_env
(#66). Thanks nvtkaszpir and c-w.
Bug fixes:
- Fix compatibility with marshmallow 3.0.0>=rc6.
Bug fixes:
- Fix accessing proxied envvars when using
env.prefixed
(#72). Thanks Kamforka for the catch and patch. - Fix behavior when an envvar is explicitly set to an empty string (#71). Thanks twosigmajab for reporting and thanks hvtuananh for the PR.
EnvError
subclassesValueError
(#50). Thanks alexpirine.- Test against Python 3.7.
- Use python-dotenv for parsing .env files.
Env.read_env
behaves mostly the same except that a warning isn't raised by default if a .env file isn't found. Passverbose=True
to raise a warning.
Features:
- Backwards-incompatible:
Env.read_env
raises a warning instead of an error when.env
isn't found (#10). Thanks lachlancooper for the suggestion. - Add optional Django support. Install using
pip install environs[django]
, which enablesenv.dj_db_url
andenv.dj_email_url
.
Features:
- Fix compatibility with marshmallow 3 beta.
Features:
Features:
Other changes:
- Backwards-incompatible: Drop support for Python 3.3 and 3.4.
Features:
- Add
url
parser that returns aurllib.parse.ParseResult
(#6). Thanks IlyaSemenov for the suggestion.
Bug fixes:
- Every instance of
Env
gets its own parser map, so callingenv.parser_for
for one instance doesn't affect other instances.
- Add
Env.read_env
method for reading.env
files.
- Support for proxied variables (#2).
- Backwards-incompatible: Remove
env.get
method. Useenv()
instead. - Document how to read
.env
files (#1).
- First PyPI release.