All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Improve the
Secretclass to always encode strings before comparing tostr.
- Add a
Secretclass to handle secrets in code instead of using plainstr. This approach offers several advantages:
- It encourages loading secrets from environment variables, and discourages programmers from hardcoding secrets in source code.
- Avoids accidental exposure of secrets in logs or error messages, by overriding str and repr.
- It causes exception if someone tries to JSON encode it using the built-in JSON
module, unlike
str. - For convenience, it can be compared directly to strings. It uses constant-time
comparison to prevent timing attacks, with the built-in
secrets.compare_digest. - Environment variables can be changed at runtime, using this class applications can pick up secret changes without needing to be restarted.
- Add an
EnvironmentVariableNotFoundexception that can be used when an expected env variable is not set. - Handle
timedeltaobjects in theFriendlyEncoderclass, by @arthurbrenno. - Improve the order of
ifstatements in theFriendlyEncoderclass to prioritize the most frequently encountered types first, which should provide better performance in typical use cases.
- Drop Python 3.6 and Python 3.7 support.
- Use
obj.model_dumpinstead ofobj.dictfor Pydantic V2. - Add support for
DecimalinFriendlyEncoder. - Apply
black,flake8,isort,mypy. - Replace
setup.pywithpyproject.toml. - Workflow maintenance.
- Add
py.typedfile. - Add
ConflictException.
- Migrate to GitHub Workflows.
- Improve build to test Python 3.6 and 3.9.
- Improve the
json.FriendlyEncoderclass to handle built-indataclasses. - Add a changelog.
- Improve badges.