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.
Metadata
Release files for hatch-dotenv 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hatch_dotenv-0.1.4.tar.gz | 12.4 kB | With provenance | Details for hatch_dotenv-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hatch_dotenv-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for hatch_dotenv-0.1.4-py3-none-any.whl |
Total release size: 18.2 kB
Release files / hatch_dotenv-0.1.4.tar.gz
| Download URL | hatch_dotenv-0.1.4.tar.gz |
|---|---|
| Size | 12.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cded30479d30c82d8e607bf0350803e673c97b2d97e194119ac7ffb333417e2b
|
|
BLAKE2b-256 checksum How to use checksums |
ba6cc8a27ac188d7c490120bc323633f500af10895076bd551992709a27ec8be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 19, 2026.
Transparency logRelease files / hatch_dotenv-0.1.4-py3-none-any.whl
| Download URL | hatch_dotenv-0.1.4-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e4d2809c89ebefd422171981796139b9281937cd001da6566d66f004c6b19fe8
|
|
BLAKE2b-256 checksum How to use checksums |
86862e03a58808ea42034541d06382adcb0c0df54fa40e009d68ce8389ac07f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 19, 2026.
Transparency logSecurity for hatch-dotenv 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for hatch_dotenv-0.1.4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 19, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.