Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

dotenv-rs

A Python dotenv package with a Rust parser, PyO3 bindings, and maturin packaging. An independent implementation of the core python-dotenv loading APIs. Pre-release: not yet published on PyPI. Requires CPython 3.10+.

from dotenv_rs import dotenv_values, load_dotenv

load_dotenv(".env")
config = dotenv_values(".env")

The Rust core parses quoted and unquoted values, export directives, comments, multiline quoted values, escapes, and keys without values. Python handles file I/O, ${NAME} / ${NAME:-default} expansion, and environment updates. It has no Python runtime dependencies.

Benchmarks

Measured 2026-10-24 UTC on Apple M4 Pro, macOS-26.2-arm64-arm-64bit-Mach-O, CPython 3.13.2; python-dotenv 1.2.4 and dotenv-rs 0.1.0a1. Rust release build.

Workload Bindings python-dotenv dotenv-rs Speedup
plain 10 136.5 µs 11.2 µs 12.2×
plain 100 1,444.1 µs 42.7 µs 33.8×
plain 1,000 19,157.1 µs 364.3 µs 52.6×
quoted 10 146.8 µs 11.7 µs 12.6×
quoted 100 1,506.0 µs 46.0 µs 32.8×
quoted 1,000 20,107.5 µs 393.2 µs 51.1×
interpolation 10 145.7 µs 14.7 µs 9.9×
interpolation 100 1,556.0 µs 79.3 µs 19.6×
interpolation 1,000 19,415.0 µs 732.0 µs 26.5×
unicode_multiline 10 148.8 µs 12.6 µs 11.8×
unicode_multiline 100 1,516.2 µs 52.6 µs 28.8×
unicode_multiline 1,000 20,078.0 µs 461.3 µs 43.5×

Median time per dotenv_values(stream=StringIO(...)) call, including Python/Rust conversion and interpolation. Seven repeats per workload; implementation order is shuffled with a fixed seed. Both implementations receive identical data and 40 synthetic environment variables; outputs are checked for equality first. File I/O, interpreter startup, and package import are excluded. These are synthetic single-machine measurements, not guarantees for every .env file or evidence that application startup becomes proportionally faster.

Reproduce (requires Rust):

uv sync --locked
uv run maturin develop --release
uv run python benchmarks/compare.py --update-readme

Raw timings and environment · Benchmark source

Development

Requires Rust 1.86+, Python 3.10+, and uv. After changing Rust code, run uv run maturin develop --release to rebuild the extension.

uv sync
uv run pytest
cargo test
cargo fmt --check
cargo clippy --all-targets -- -D warnings
uv run maturin develop --release
uv run python benchmarks/compare.py --update-readme
uv run maturin build --release --out dist
uv run maturin sdist --out dist

Compatibility

Inspired by python-dotenv; this is an independent implementation. Import using dotenv_rs, leaving the upstream dotenv namespace available for comparisons. Compatibility is checked against python-dotenv 1.2.4, pinned in development dependencies:

  • All upstream parameterized parser cases and value/interpolation cases are retained as fixtures, with their original license and source provenance in tests/upstream.
  • Hypothesis runs 2,000 parser comparisons and 1,000 public API comparisons per suite, including malformed input, Unicode, escapes, and duplicate bindings.
  • Tests compare environment precedence, return values, error line numbers, and discovery from scripts launched outside their working directory.
  • CI checks Linux, macOS, and Windows, plus clean installations of built wheels.

Scope: load_dotenv, dotenv_values, and find_dotenv. Import from dotenv_rs. The internal DotEnv class, get_key/set_key/unset_key, CLI, and IPython integration are not implemented. The original dotenv namespace stays available. Returned mappings are ordinary insertion-ordered Python dictionaries rather than OrderedDict. Text containing unpaired Unicode surrogates is unsupported. Diagnostics use the dotenv_rs logger, with upstream message text. This is an alpha, not a claim of complete drop-in compatibility or zero bugs. See COMPATIBILITY.md for the release criteria.

Publishing

The release workflow builds portable wheels, runs clean-install checks, validates metadata, and uploads through PyPI Trusted Publishing. RELEASING.md has the one-time setup and release commands. Releases remain alpha until the compatibility criteria pass.

Portfolio

An accurate description of the current project: “Built a Python dotenv package with a Rust parser, PyO3 bindings, maturin packaging, and differential tests.” Add publication and measured performance results only once achieved.

License

Original code: MIT. Adapted upstream portions: BSD-3-Clause. See LICENSE and third-party notices.

Metadata

Release files for dotenv-rs 0.1.0a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dotenv-rs 0.1.0a1
File Size Uploaded Provenance
dotenv_rs-0.1.0a1.tar.gz 86.7 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for dotenv-rs 0.1.0a1
File
dotenv_rs-0.1.0a1-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
dotenv_rs-0.1.0a1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
dotenv_rs-0.1.0a1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
dotenv_rs-0.1.0a1-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
dotenv_rs-0.1.0a1-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 1.1 MB

Release files / dotenv_rs-0.1.0a1.tar.gz

Download URL dotenv_rs-0.1.0a1.tar.gz
Size 86.7 kB
Tags Source
SHA-256 checksum
How to use checksums
db3c65f83812fc9e431d51fdc6ac4f973d4ef9a26647f14114e176f96c273f42
BLAKE2b-256 checksum
How to use checksums
10ab7eab1eb352ba23c36304998b1c69aad033ad4ccdc8b2adb3b86b3d04dfa5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 24, 2026.

Transparency log

Release files / dotenv_rs-0.1.0a1-cp310-abi3-win_amd64.whl

Download URL dotenv_rs-0.1.0a1-cp310-abi3-win_amd64.whl
Size 116.2 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
bef4a51ba83ae6866581d573d732da899ef0861018a1bb69868bb19dbbeefa1c
BLAKE2b-256 checksum
How to use checksums
6be9c52d19d05888d98f8e2f43ab5b0e500a86a7e5530228a73ffeb97bc015c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 24, 2026.

Transparency log

Release files / dotenv_rs-0.1.0a1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL dotenv_rs-0.1.0a1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 251.4 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
bd24b43a9c22ed31861835e0d0450a91fd42407f22105cc347a4ec8f95aa5937
BLAKE2b-256 checksum
How to use checksums
226d6c9588ff0c4dec76b8bc9f766e959df0d29e414251fe5c838d4afaf78bc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 24, 2026.

Transparency log

Release files / dotenv_rs-0.1.0a1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL dotenv_rs-0.1.0a1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 243.9 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
289b760b7736f315cec5fda37c79eeae1dbf83c5b5186cbcd2a19bf3de86fb56
BLAKE2b-256 checksum
How to use checksums
29a0e6bb49dcfc58df994e310fdacaefc4007eddce73628e69183647963bfd3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 24, 2026.

Transparency log

Release files / dotenv_rs-0.1.0a1-cp310-abi3-macosx_11_0_arm64.whl

Download URL dotenv_rs-0.1.0a1-cp310-abi3-macosx_11_0_arm64.whl
Size 217.8 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b441791c0ce749f9a84573cc01fe393435e58d7f51670c44856e4ed104539837
BLAKE2b-256 checksum
How to use checksums
e7ee95118ffdbd5ea366c8bf345a40db89314a631e471c20e99e6956155e54e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 24, 2026.

Transparency log

Release files / dotenv_rs-0.1.0a1-cp310-abi3-macosx_10_12_x86_64.whl

Download URL dotenv_rs-0.1.0a1-cp310-abi3-macosx_10_12_x86_64.whl
Size 220.8 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
885fafa6bbf0005da955c1836f43f525f74ff118c3120814cc9187d637227b37
BLAKE2b-256 checksum
How to use checksums
572aee23e433111facc44e894a65886790f16f21fc88b64de17be9a594af091c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 24, 2026.

Transparency log

Security for dotenv-rs 0.1.0a1

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 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for dotenv_rs-0.1.0a1.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 Oct 24, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page