Tags: br3ndonland/fastenv
Tags
0.5.0 ### Changes **Document and test FastAPI integration** (#32, 7362541) One of the goals of this project as shown in the README is to unify settings management for FastAPI. It would be helpful to provide a simple example of how to integrate fastenv with a FastAPI app. The most common use case for fastenv would be to load environment variables and settings when the FastAPI app starts up. The recommended way to customize app startup and shutdown is with lifespan events. This release will add an example to the quickstart in the README that uses [lifespan events](https://fastapi.tiangolo.com/advanced/events/) with [lifespan state](https://www.starlette.io/lifespan/#lifespan-state). Lifespan state is the recommended way to share objects between the lifespan function and API endpoints. Currently, the lifespan function can only have one required argument for the FastAPI or Starlette app instance. This is because of the way Starlette runs the lifespan function, as seen in the source code [here](https://github.com/encode/starlette/blob/4e453ce91940cc7c995e6c728e3fdf341c039056/starlette/routing.py#L732). This is shown, but not explained, in the [FastAPI docs on lifespan events](https://fastapi.tiangolo.com/advanced/events/) - the code examples use objects from outside the lifespan function by instantiating them at the top-level of the module. Unfortunately this limits lifespan event customization. For example, an application might want a way to customize the dotenv file path or the object storage bucket from which the dotenv file needs to be downloaded. One way to customize the dotenv file path is to set an environment variable with the dotenv file path, then pass the environment variable value into `fastenv.load_dotenv()`. This is demonstrated in the new tests. The new tests will build on the example in the README by loading a dotenv file into a FastAPI app instance with `fastenv.load_dotenv()`. The resultant `DotEnv` instance will then be accessed within an API endpoint by reading the lifespan state on `request.state`. As explained in the [Starlette lifespan docs](https://www.starlette.io/lifespan/), the `TestClient` must be used as a context manager to trigger lifespan. Thanks to @clabnet for prompting this change in [#28](#28). **Add support for Python 3.12** (#31, 5346486) This release will add [Python 3.12](https://docs.python.org/3/whatsnew/3.12.html) support to fastenv. - fastenv will now include a Python 3.12 classifier in its PyPI package - fastenv will now build and publish its PyPI package using Python 3.12 - fastenv will now run tests with Python 3.12, in addition to 3.8-3.11 ### Commits - Bump version from 0.4.2 to 0.5.0 (26fd927) - Document and test FastAPI integration (#32) (7362541) - Update to pytest 8 (1e8b896) - Update path to contributing.md in PR template (d51c035) - Update contact info in code of conduct (41bc76c) - Add support for Python 3.12 (#31) (5346486) - Update changelog for version 0.4.2 (#30) (ed436f9)
0.4.2 ### Changes **Avoid auto-inactivating GitHub Actions deployments** (6d6f5c9) Version 0.4.1 and commit 6e532c6 configured Python package publication to use PyPI OIDC with GitHub Actions deployment environments. This commit provides a small update to deployment environment usage. Each use of a deployment environment creates a deployment that can be either active or inactive. GitHub Actions auto-inactivates deployments, and although this behavior is not configurable or documented, there are some possible workarounds/hacks suggested by a community discussion [comment](https://github.com/orgs/community/discussions/67982#discussioncomment-7086962). The workaround used here will be to provide each deployment with its own unique URL. ### Commits - Bump version from 0.4.1 to 0.4.2 (ff9d56f) - Avoid auto-inactivating GitHub Actions deployments (6d6f5c9) - Reset `peter-evans/create-pull-request@v6` author (845e8b2) - Update changelog for version 0.4.1 (#29) (b60a73d)
0.4.1 ### Changes **Publish to PyPI with OIDC trusted publisher** (6e532c6) This commit will update Python package publishing to the newest format recommended by PyPI. This project previously published packages with a project-scoped PyPI API token (token only valid for this project) stored in GitHub Secrets and the `hatch publish` command. The project will now publish packages using a [PyPI OIDC](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-pypi) (OpenID Connect) trusted publisher with the [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) action. This is the method that Hatch itself uses (pypa/hatch#891) (Hatch does not "dogfood" its own `hatch publish` feature). The advantage to OIDC is that authentication is performed with temporary API tokens (only valid for 15 minutes) instead of persistent tokens that must be manually generated on PyPI and pasted into GitHub Secrets. The disadvantage is that authentication is more complicated. To use PyPI OIDC, a trusted publisher was set up for the PyPI project as shown in the [PyPI docs](https://docs.pypi.org/trusted-publishers/). Next, a dedicated [GitHub Actions deployment environment](https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment) was created for PyPI, with protection rules that only allow use of the environment with workflow runs triggered by Git tags. The environment protection rules combine with tag protection rules in existing [GitHub rulesets](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets) to ensure PyPI packages can only be published when a maintainer pushes a Git tag. The GitHub Actions workflow will be updated to use the deployment environment. Deployment environments must be selected at the job level before the job begins, so a setup job will be added that selects the appropriate deployment environment and passes it to the PyPI job. Finally, after `hatch build` outputs the package build files to the `dist/` directory, pypa/gh-action-pypi-publish will be used to publish the package to PyPI. The pypa/gh-action-pypi-publish action publishes exact version tags like pypa/[email protected], and offers Git branches for major and minor version numbers like pypa/gh-action-pypi-publish@release/v1.8. ### Commits - Bump version from 0.4.0 to 0.4.1 (d668549) - Publish to PyPI with OIDC trusted publisher (6e532c6) - Update to `peter-evans/create-pull-request@v6` (0918b9e) - Add support for AnyIO 4 (b33e84e) - Update to Ruff 0.3 (658fb4b) - Update to `mypy==1.9.0` (64adf48) - Update to `hatch==1.9.4` (6c60f7e) - Update to `pipx==1.5.0` (795e1d2) - Update comparisons docs for Starlette 0.37 (99e233f) - Disable CodeQL `setup-python-dependencies` (11d8d60) - Update to Node.js 20 actions (a6d2e06) - Update changelog for version 0.4.0 (#27) (649cc4c)
0.4.0 ### Changes **Add support for Cloudflare R2 object storage** (#26, 6b06299) The fastenv object storage client supports AWS S3 and Backblaze B2. This release will add support for the [Cloudflare R2](https://developers.cloudflare.com/r2/) object storage platform. Cloudflare R2 buckets can be supplied as "virtual-hosted-style" URLs, like `<BUCKET>.<ACCOUNT_ID>.r2.cloudflarestorage.com`. **Add PUT uploads to object storage client** (#25, 6968353) Dotenv files are commonly kept in cloud object storage. fastenv provides an object storage client for downloading and uploading dotenv files. S3-compatible object storage allows uploads with either `POST` or `PUT`. This release will add an implementation of uploads with `PUT`, and `PUT` will now be the default because `PUT` uploads are more widely-supported and standardized. Backblaze B2 does not currently support single-part uploads with `POST` to their S3 API (the [B2 native API](https://www.backblaze.com/apidocs/b2-upload-file) must be used instead). [Cloudflare R2](https://developers.cloudflare.com/r2/api/s3/presigned-urls/) does not support uploads with `POST` at all. **Use Ruff for linting and formatting** (e635c33) [Ruff](https://docs.astral.sh/ruff/) is a Python linter and formatter that has gained popularity due to its high performance and numerous capabilities. Now that Ruff has released its [first minor version series](https://astral.sh/blog/ruff-v0.1.0) (0.1) and has a [versioning policy](https://docs.astral.sh/ruff/versioning/), it's a good time to consider adopting it. As of this release, the project's Python linting and formatting checks will be migrated from the previous tools (Black, Flake8, isort) to Ruff. ### Commits - Bump version from 0.3.0 to 0.4.0 (620af5e) - Add support for Cloudflare R2 object storage (#26) (6b06299) - Add PUT uploads to object storage client (#25) (6968353) - Remove trailing slash from `bucket_host` (8492656) - Update test info in CONTRIBUTING.md (69bdf05) - Update to `peter-evans/create-pull-request@v5` (4ddb5b5) - Update to `aws-actions/configure-aws-credentials@v4` (e59316e) - Update to `actions/checkout@v4` (ebdea31) - Update CodeQL workflow actions (03e80cc) - Address CodeQL URL substring sanitization error (a822a86) - Remove scheme from `bucket_host` (aaf3f1d) - Remove curly quote (0f2c1bb) - Use Ruff for linting and formatting (e635c33) - Add wheel build target to avoid Hatch `ValueError` (a7fffb7) - Update to `pipx==1.4.1` (a53eb2b) - Update to `mypy==1.8.0` (16c6329) - Update to `hatch==1.9.1` (2ab4bff) - Update to `pipx==1.4.0` (31c9854) - Update to `pipx==1.3.3` (f5ddd6d) - Remove unneeded stale workflow (d86b4ba) - Switch from pre-commit to Hatch scripts (0f60779) - Finish configuring code block copy (34fbe9a) - Add docs deployment info to contributing.md (70b358e) - Remove Material for MkDocs version from README (380f364) - Configure Material for MkDocs code block copy (5c8b6ea) - Update to Material for MkDocs 9 (a1349d4) - Relax upper bound on HTTPX (ab0e909) - Update to `mypy==1.7.0` (27549f5) - Prepend `$HATCH_ENV` in GitHub Actions workflow (c5cf02d) - Update to `hatch==1.7.0` (d8ee4e6) - Remove Sourcery configuration file (9f61678) - Update Black in pre-commit (6fd48d6) - Update to `mypy==1.3.0` (e1a0e09) - Update to coverage 7 (8702743) - Update to `pipx==1.2.0` (dcbe73b) - Update to mypy 1.1.1 (f666fdb) - Update to configure-aws-credentials@v2 (5d20126) - Update changelog for version 0.3.0 (#23) (d13a924)
0.3.0 ### Changes **Add Python 3.11 support** (#15) This release will add [Python 3.11](https://docs.python.org/3/whatsnew/3.11.html) support to fastenv. - fastenv will now include a Python 3.11 classifier in its PyPI package - fastenv will now build and publish its PyPI package using Python 3.11 - fastenv will now run tests with Python 3.11, in addition to 3.8-3.10 **Migrate from Poetry 1.1 to Hatch** (#14, f0c6882, 78755e7, e2f8d04, 85b8e79, 903a7de) fastenv has been migrated to [Hatch](https://hatch.pypa.io/latest/). See br3ndonland/inboard#56 for more details and context around the motivations for this. The Python package version will now be available at `fastenv.__version__`. **Auto-generate changelog from Git tags** (c7aa765) A changelog will now be provided at [CHANGELOG.md](https://github.com/br3ndonland/fastenv/blob/develop/CHANGELOG.md) for viewing on GitHub, and [in the docs at the `/changelog` endpoint](https://fastenv.bws.bio/changelog). **Enable mypy strict mode** (7fbb89f) Mypy will run in strict mode on all Python code (source code and tests). In terms of user-facing improvements, this update will add a new module `fastenv.types` for cloud object storage upload policy types. The contributing.md will be updated with instructions for type checking. ### Commits `0.2.5..0.3.0` - Bump version from 0.3.0-beta.0 to 0.3.0 (2864bee) - Update to mypy 1 (4df9eac) - Update to Black 23 (bccad2c) - Update isort to avoid poetry-core breaking change (e417e07) - Update changelog for version 0.3.0-beta.0 (#22) (f6f2ce9) - Bump version from 0.3.0-alpha.0 to 0.3.0-beta.0 (cc56f8d) - Fix upper bound on HTTPX optional dependency (903a7de) - Alphabetize Hatch commands in contributing.md (85b8e79) - Regroup testing info in contributing.md (e2f8d04) - Remove PEP 631 references from README (4f1e57c) - Add trailing comma to `pyproject.toml` classifiers (78755e7) - Alphabetize fields in `pyproject.toml` (f0c6882) - Update changelog for version 0.3.0-alpha.0 (#16) (69487f9) - Bump version from 0.2.5 to 0.3.0-alpha.0 (f83b3e0) - Add Python 3.11 support (#15) (0fcbc5f) - Remove unused `.prettierrc` (6d2c8c3) - Merge pull request #14 from br3ndonland/hatch (801e256) - Update docs for Hatch (3e7e049) - Update GitHub Actions workflows for Hatch (e5fb5d6) - Update configuration files for Hatch (5d409be) - Add spell check with CSpell (e2df8c0) - Auto-generate changelog from Git tags (c7aa765) - Enable mypy strict mode (7fbb89f) - Update pre-commit dependencies (8324d2c) - Update dependencies (2d0793c)
0.3.0-beta.0 ### Changes **Add Python 3.11 support** (#15) This release will add [Python 3.11](https://docs.python.org/3/whatsnew/3.11.html) support to fastenv. - fastenv will now include a Python 3.11 classifier in its PyPI package - fastenv will now build and publish its PyPI package using Python 3.11 - fastenv will now run tests with Python 3.11, in addition to 3.8-3.10 **Migrate from Poetry 1.1 to Hatch** (#14, f0c6882, 78755e7, e2f8d04, 85b8e79, 903a7de) fastenv has been migrated to [Hatch](https://hatch.pypa.io/latest/). See br3ndonland/inboard#56 for more details and context around the motivations for this. The Python package version will now be available at `fastenv.__version__`. **Auto-generate changelog from Git tags** (c7aa765) A changelog will now be provided at [CHANGELOG.md](https://github.com/br3ndonland/fastenv/blob/develop/CHANGELOG.md) for viewing on GitHub, and [in the docs at the `/changelog` endpoint](https://fastenv.bws.bio/changelog). **Enable mypy strict mode** (7fbb89f) Mypy will run in strict mode on all Python code (source code and tests). In terms of user-facing improvements, this update will add a new module `fastenv.types` for cloud object storage upload policy types. The contributing.md will be updated with instructions for type checking. ### Commits - Bump version from 0.3.0-alpha.0 to 0.3.0-beta.0 (cc56f8d) - Fix upper bound on HTTPX optional dependency (903a7de) - Alphabetize Hatch commands in contributing.md (85b8e79) - Regroup testing info in contributing.md (e2f8d04) - Remove PEP 631 references from README (4f1e57c) - Add trailing comma to `pyproject.toml` classifiers (78755e7) - Alphabetize fields in `pyproject.toml` (f0c6882) - Update changelog for version 0.3.0-alpha.0 (#16) (69487f9) - Bump version from 0.2.5 to 0.3.0-alpha.0 (f83b3e0) - Add Python 3.11 support (#15) (0fcbc5f) - Remove unused `.prettierrc` (6d2c8c3) - Merge pull request #14 from br3ndonland/hatch (801e256) - Update docs for Hatch (3e7e049) - Update GitHub Actions workflows for Hatch (e5fb5d6) - Update configuration files for Hatch (5d409be) - Add spell check with CSpell (e2df8c0) - Auto-generate changelog from Git tags (c7aa765) - Enable mypy strict mode (7fbb89f) - Update pre-commit dependencies (8324d2c) - Update dependencies (2d0793c)
0.3.0-alpha.0 Changes: **Add Python 3.11 support** (#15) This release will add [Python 3.11](https://docs.python.org/3/whatsnew/3.11.html) support to fastenv. - fastenv will now include a Python 3.11 classifier in its PyPI package - fastenv will now build and publish its PyPI package using Python 3.11 - fastenv will now run tests with Python 3.11, in addition to 3.8-3.10 **Migrate from Poetry 1.1 to Hatch** (#14) fastenv has been migrated to [Hatch](https://hatch.pypa.io/latest/). See br3ndonland/inboard#56 for more details and context around the motivations for this. The Python package version will now be available at `fastenv.__version__`. **Auto-generate changelog from Git tags** (c7aa765) A changelog will now be provided at [CHANGELOG.md](https://github.com/br3ndonland/fastenv/blob/develop/CHANGELOG.md) for viewing on GitHub, and [in the docs at the `/changelog` endpoint](https://fastenv.bws.bio/changelog). **Enable mypy strict mode** (7fbb89f) Mypy will run in strict mode on all Python code (source code and tests). In terms of user-facing improvements, this update will add a new module `fastenv.types` for cloud object storage upload policy types. The contributing.md will be updated with instructions for type checking. Commits: - Bump version from 0.2.5 to 0.3.0-alpha.0 (f83b3e0) - Add Python 3.11 support (#15) (0fcbc5f) - Remove unused `.prettierrc` (6d2c8c3) - Merge pull request #14 from br3ndonland/hatch (801e256) - Update docs for Hatch (3e7e049) - Update GitHub Actions workflows for Hatch (e5fb5d6) - Update configuration files for Hatch (5d409be) - Add spell check with CSpell (e2df8c0) - Auto-generate changelog from Git tags (c7aa765) - Enable mypy strict mode (7fbb89f) - Update pre-commit dependencies (8324d2c) - Update dependencies (2d0793c)
0.2.5 Commits: - Bump version from 0.2.4 to 0.2.5 (92bc9dc) - Update to Flake8 6 (23503a5) - Update type annotations for PEP 484 (20eb205) - Update dependencies (8e99ff4) Note about Git commit and tag verification: The email address [email protected] and associated GPG key 783DBAF23C1D6478 have been used to sign Git commits and tags since 0.1.0 - 2021-07-27. Git and GitHub now support commit signing and verification with SSH. The SSH key fingerprint SHA256:w+KL3qQKtku1MfLFSZLCl93kSgxH3O4OvtcxHG5k0Go will also be used to sign Git commits and tags going forward. See https://github.com/br3ndonland and br3ndonland/br3ndonland@08257e6 for corroboration of the new info.
PreviousNext