$npx skillfedfor your agent

pytest-env

pytest plugin that allows you to add environment variables.

Worth itPyPI Python ModulesReleased Jul 202624.0M downloads / mopermissive licensePure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — pytest_env-1.7.0-py3-none-any.whl
v1.7.0 · released 2026-07-21 · Python >=3.10 · 3 runtime deps: pytest, python-dotenv, tomli

Yes. This is a mature, actively maintained plugin (first released in 2015, latest in 2026) with no known vulnerabilities, low install friction, and a clear, focused purpose. It solves a real problem—managing test environment variables—in a standard, declarative way. The MIT license imposes no restrictions. Install it if you need to manage environment variables across test suites.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.10 or later.
  • Low install friction with a pure-Python wheel.
  • Actively maintained with a recent release; last commit was 24 days ago.

License · maintenance · safety

permissive license (permissive) — MIT License permits unrestricted use, modification, and distribution with only attribution required. No restrictions on commercial or private use.

last release 2026-07-21 (24 days) · last repo commit 2026-08-10 · 233 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 24,043,458 downloads/mo, #928 on PyPI

Verify before relying

pip install pytest-env

# Add to pyproject.toml:
# [tool.pytest_env]
# DATABASE_URL = "postgresql://localhost/test_db"
# DEBUG = "true"

# In test file:
import os

def test_example():
    assert os.environ["DATABASE_URL"] == "postgresql://localhost/test_db"
Same gist for agents: .md · .json

What it is and what it does

pytest-env is a pytest plugin that automatically injects environment variables into your test session from configuration files or .env files. It reads from pyproject.toml (under [tool.pytest_env]), pytest.toml, .pytest.toml, pytest.ini, or any .env file you specify, and makes those variables available to your tests via os.environ. The plugin supports variable expansion using existing environment variables, conditional assignment (skip if already set), and unsetting variables entirely.

The main use case is eliminating the need to manually set environment variables before running tests or hardcoding them in test files. You define test-specific configuration once in your project's config file, and the plugin ensures it's applied consistently across all test runs. It also supports per-directory configuration overrides, so integration tests can use different settings than unit tests by placing a pytest.toml in a subdirectory.

Use it for

  • Set database connection strings or API endpoints for test suites without modifying shell environment or test code.
  • Load secrets and credentials from .env files during test execution while keeping them out of version control.
  • Override parent-level environment settings for specific test directories (e.g., integration tests vs. unit tests).
  • Expand environment variables in config values using {VAR} placeholders to reference existing system or pytest-set variables.
  • Debug environment variable assignments with --pytest-env-verbose to see exactly what was set and from which config file.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

This is a mature, actively maintained plugin (first released in 2015, latest in 2026) with no known vulnerabilities, low install friction, and a clear, focused purpose. It solves a real problem—managing test environment variables—in a standard, declarative way. The MIT license imposes no restrictions. Install it if you need to manage environment variables across test suites.

Install

pytest-env on PyPI

Before you install

Low install friction with a pure-Python wheel. Actively maintained with a recent release; last commit was 24 days ago. Depends only on pytest, python-dotenv, and tomli—all stable, widely-used packages.

Requires Python 3.10 or later.

License in practice

MIT License permits unrestricted use, modification, and distribution with only attribution required. No restrictions on commercial or private use.

Quickstart

pip install pytest-env

# Add to pyproject.toml:
# [tool.pytest_env]
# DATABASE_URL = "postgresql://localhost/test_db"
# DEBUG = "true"

# In test file:
import os

def test_example():
    assert os.environ["DATABASE_URL"] == "postgresql://localhost/test_db"

Package facts

Licensepermissive license permissive
Python supportSupports the current Python release >=3.10
Install frictionLow. Pure-Python wheel
Runtime dependencies
3 packages
pytestpython-dotenvtomli
MaintenanceActively maintained 24 days since the last release
Last repo commit
First released
Downloads24,043,458 / month, #928 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: Libraries :: Python Modules

Evidence: pytest_env-1.7.0-py3-none-any.whl

Tags

Capabilities
pytest environment variablespytest config env varspytest dotenv pluginpytest .env loadertest environment setup pytestpytest configuration managementpytest env files
Topics
pytest-plugintest-configurationenvironment-management
PyPI keywords
envpytest

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “pytest environment variables”

  • pytest-envA pytest plugin that loads environment variables from configuration…
  • pytest-dotenvA pytest plugin that automatically loads environment variables from…
  • pytest-metadataA pytest plugin that captures and exposes test session…

Give your agent the search over MCP, or paste the wish link into any chat.

More Python Modules packages

idna Worth it
PyPI · Python Modules · released Jun 2026

Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.

Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.

BSD-3-Clausepure Python · 3.9+
1.8Bdownloads / mo
setuptools Worth it
PyPI · Python Modules · released Aug 2026

Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.

MITpure Python · 3.10+
1.6Bdownloads / mo
PyYAML Worth it
PyPI · Python Modules · released Sep 2025

PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.

MITcompiled wheel · 3.8+
1.2Bdownloads / mo
pydantic Worth it
PyPI · Python Modules · released May 2026

Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.

MITpure Python · 3.9+
1.1Bdownloads / mo
annotated-types Worth it
PyPI · Python Modules · released Jul 2026

Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.

Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…

MITpure Python · 3.10+
871.3Mdownloads / mo
typing-inspection Worth it
PyPI · Python Modules · released Aug 2026

Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.

MITpure Python · 3.10+
783.0Mdownloads / mo

See also pytest-dotenv · tempenv · python-decouple · poetry-dotenv-plugin · envsubst · dotenv · python-dotenv · pytest-pythonpath · maison · pytest-variables