Skip to main content

Hatch plugin that enables dotenv support

Project description

hatch-dotenv

PyPI - Version PyPI - Python Version

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 .env files override existing env-vars in 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

hatch_dotenv-0.1.2.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hatch_dotenv-0.1.2-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file hatch_dotenv-0.1.2.tar.gz.

File metadata

  • Download URL: hatch_dotenv-0.1.2.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hatch_dotenv-0.1.2.tar.gz
Algorithm Hash digest
SHA256 bcdbc853bb228e35b1beda8d9a1e9fdb5e122ec614df84f3c976e78fcdc53569
MD5 86b6c7b21c5edd9321559d22c5e011fc
BLAKE2b-256 9723feb73f60b29c156d1225a260634e9d8c584e402fab90a9f5d4df0d21407f

See more details on using hashes here.

Provenance

The following attestation bundles were made for hatch_dotenv-0.1.2.tar.gz:

Publisher: release.yml on Dniskk/hatch-dotenv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hatch_dotenv-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: hatch_dotenv-0.1.2-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.7

File hashes

Hashes for hatch_dotenv-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5ce42f083e656a12a23acfbda66f6f24b4454f4191dfea2a7f054986d370ede4
MD5 c658e8915c35a6ef5342216da35e1ab5
BLAKE2b-256 417058cc620a5ffdae9e73ffd30915a91d16cc0e244543c8433530432bf91f12

See more details on using hashes here.

Provenance

The following attestation bundles were made for hatch_dotenv-0.1.2-py3-none-any.whl:

Publisher: release.yml on Dniskk/hatch-dotenv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page