Hatch plugin that enables dotenv support
Project description
hatch-dotenv
A Hatch plugin that loads environment variables from .env files.
Installation
pip install hatch-dotenv
Usage
Add hatch-dotenv to your environment requirements and configure the collector for each environment:
[tool.hatch.env]
requires = ["hatch-dotenv"]
# Configure env-files for the default environment
[tool.hatch.env.collectors.dotenv.default]
env-files = [".env", ".env.local"]
# Configure env-files for other environments
[tool.hatch.env.collectors.dotenv.dev]
env-files = [".env", ".env.local", ".env.development"]
[tool.hatch.env.collectors.dotenv.production]
env-files = [".env", ".env.production"]
Works with any environment type:
[tool.hatch.env]
requires = ["hatch-dotenv", "hatch-pip-compile"]
[tool.hatch.envs.locked]
type = "pip-compile"
[tool.hatch.env.collectors.dotenv.locked]
env-files = [".env", ".env.local"]
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
env-files |
list[str] | [] |
List of .env file paths to load |
fail-on-missing |
bool | false |
Raise an error if a file is missing |
Strict mode
To fail when an env file is missing, set fail-on-missing = true:
[tool.hatch.env.collectors.dotenv.default]
env-files = [".env"]
fail-on-missing = true
Behavior
- Files are loaded in order; later files override earlier ones
- Missing files are silently skipped (unless
fail-on-missing = true) - Variables from
.envfiles override existingenv-varsin config
License
hatch-dotenv is distributed under the terms of the MIT license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hatch_dotenv-0.1.3.tar.gz.
File metadata
- Download URL: hatch_dotenv-0.1.3.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
403da9e075fb261ba50b682b56ea22005be8d6278c2b49be053f3b69ccdd4f50
|
|
| MD5 |
51904d63f879a90dcb7ee7812223c377
|
|
| BLAKE2b-256 |
c4fd0de6ca8b731f00b2d515f7891e092759d9290c9c9250e0ec9f78ecfbca83
|
Provenance
The following attestation bundles were made for hatch_dotenv-0.1.3.tar.gz:
Publisher:
release.yml on Dniskk/hatch-dotenv
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hatch_dotenv-0.1.3.tar.gz -
Subject digest:
403da9e075fb261ba50b682b56ea22005be8d6278c2b49be053f3b69ccdd4f50 - Sigstore transparency entry: 1280965217
- Sigstore integration time:
-
Permalink:
Dniskk/hatch-dotenv@069c22deea0efee8f79e7f66a0eaad99ddb8f9dd -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/Dniskk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@069c22deea0efee8f79e7f66a0eaad99ddb8f9dd -
Trigger Event:
push
-
Statement type:
File details
Details for the file hatch_dotenv-0.1.3-py3-none-any.whl.
File metadata
- Download URL: hatch_dotenv-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1265f99578f7b87d17876b49c04734d8649f7baeb007fbaaec786a23f510b201
|
|
| MD5 |
3b7efadbc92df5357e032e730cb834ab
|
|
| BLAKE2b-256 |
3abf670edffe2d6216babde00b017f30720d44b3ed1faa6a1dce902e04febfc3
|
Provenance
The following attestation bundles were made for hatch_dotenv-0.1.3-py3-none-any.whl:
Publisher:
release.yml on Dniskk/hatch-dotenv
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hatch_dotenv-0.1.3-py3-none-any.whl -
Subject digest:
1265f99578f7b87d17876b49c04734d8649f7baeb007fbaaec786a23f510b201 - Sigstore transparency entry: 1280965221
- Sigstore integration time:
-
Permalink:
Dniskk/hatch-dotenv@069c22deea0efee8f79e7f66a0eaad99ddb8f9dd -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/Dniskk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@069c22deea0efee8f79e7f66a0eaad99ddb8f9dd -
Trigger Event:
push
-
Statement type: