$npx skillfedfor your agent

tempenv

Environment Variable Context Manager

With conditionsPyPI UtilitiesReleased Mar 2025181.9K downloads / moApache License 2.0Pure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — tempenv-2.1.0-py3-none-any.whl
v2.1.0 · released 2025-03-23 · Python >=3.9

Yes, if you need scoped environment variable management in tests or credential-sensitive code. The package is stable, has no dependencies, and solves a real problem cleanly. The aging maintenance status (509 days since last release) is not a blocker for a simple, focused tool—check whether the code already handles your Python version and use case before adopting.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python >=3.9
  • Low friction: pure Python wheel with no runtime dependencies.
  • Maintenance is aging—last release was 509 days ago and the repository shows minimal activity (7 stars), though it remains archived=false and the code is marked Production/Stable.

License · maintenance · safety

Apache License 2.0 (permissive) — Apache License 2.0 is permissive; you can use this package freely in commercial and private projects with minimal restrictions, provided you include a copy of the license.

last release 2025-03-23 (509 days) · last repo commit 2025-10-03 · 7 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 181,869 downloads/mo, #10,111 on PyPI

Verify before relying

pip install tempenv

import os
from tempenv import TemporaryEnvironment

with TemporaryEnvironment({"API_KEY": "value"}):
    print(os.environ.get("API_KEY"))
# API_KEY is restored to its previous value
  • Whether the 509-day gap since last release indicates active maintenance or stable-enough code that updates are rare
  • Performance characteristics when managing large numbers of environment variables in nested contexts
Same gist for agents: .md · .json

What it is and what it does

tempenv is a context manager for Python that temporarily sets or unsets environment variables and automatically restores them when the block exits. It's designed for scenarios where credentials or other sensitive configuration must be scoped to a short lifetime—common in testing and in applications that receive secrets via environment variables. The package provides a simple `with TemporaryEnvironment({...})` block that accepts a dictionary of variable names to values; setting a value to `None` unsets the variable. It can optionally warn if code inside the block modifies one of the temporary variables, and can be configured to either restore the original value or leave the modified value in place.

The package has no runtime dependencies, installs as a pure Python wheel, and supports Python 3.9 through 3.13. It can be used as a context manager in regular code or as a decorator on test methods. The main use case is isolating credential or configuration changes to a specific code scope, ensuring they don't leak into the broader process environment.

Use it for

  • Wrap credential injection in tests to ensure secrets are only present during the test and automatically cleaned up afterward
  • Temporarily override configuration variables for a specific function call without affecting the rest of the application
  • Suppress or modify environment variables during unit tests to verify behavior under different configurations
  • Decorate test methods to inject test-specific environment variables without manual setup/teardown
  • Prevent accidental credential leakage in long-running processes by scoping secrets to the exact code block that uses them

Worth the install?

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

With conditions

Yes, if you need scoped environment variable management in tests or credential-sensitive code.

The package is stable, has no dependencies, and solves a real problem cleanly. The aging maintenance status (509 days since last release) is not a blocker for a simple, focused tool—check whether the code already handles your Python version and use case before adopting.

Install

tempenv on PyPI

Before you install

Low friction: pure Python wheel with no runtime dependencies. Maintenance is aging—last release was 509 days ago and the repository shows minimal activity (7 stars), though it remains archived=false and the code is marked Production/Stable.

Requires Python >=3.9

License in practice

Apache License 2.0 is permissive; you can use this package freely in commercial and private projects with minimal restrictions, provided you include a copy of the license.

Quickstart

pip install tempenv

import os
from tempenv import TemporaryEnvironment

with TemporaryEnvironment({"API_KEY": "value"}):
    print(os.environ.get("API_KEY"))
# API_KEY is restored to its previous value

Verify before relying

  • Whether the 509-day gap since last release indicates active maintenance or stable-enough code that updates are rare
  • Performance characteristics when managing large numbers of environment variables in nested contexts

Package facts

LicenseApache License 2.0 permissive
Python supportSupports the current Python release >=3.9
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceAging 509 days since the last release
Last repo commit
First released
Downloads181,869 / month, #10,111 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 :: Apache Software LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: SecurityTopic :: System :: ShellsTopic :: UtilitiesTyping :: Typed

Evidence: tempenv-2.1.0-py3-none-any.whl

Tags

Capabilities
environment variable context managertemporary env varsscoped environment overridetest environment isolationcredential scope management
Topics
testingcredentialscontext-manager
PyPI keywords
temporaryenvironment variablecontext managertesttesting

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 › “environment variable context manager”

  • tempenvTemporarily override environment variables within a scoped context,…
  • yacmanYacman provides a Python interface for reading, writing, and managing…
  • glcontextProvides portable OpenGL context creation across Windows, Linux, and…

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

More Utilities 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
charset-normalizer Worth it
PyPI · Utilities · released Aug 2026

Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.

permissive licensepure Python · 3.7+
1.7Bdownloads / 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
pluggy Worth it
PyPI · Libraries · released May 2025

Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.

Install it if you're building an extensible application or framework.

MITpure Python · 3.9+aging
1.3Bdownloads / mo
Pygments Worth it
PyPI · Utilities · released Mar 2026

Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.

Install it if you need to display or transform source code.

BSD-2-Clausepure Python · 3.9+
1.3Bdownloads / mo
six With conditions
PyPI · Libraries · released Dec 2024

Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.

MITpure Python
1.2Bdownloads / mo

See also pytest-env · envsubst · stubs · pytest-shutil · puccinialin · django-environ · django-read-only · memory-tempfile · acres