backports.tempfile
Backport of new features in Python's tempfile module
Decision gist · record as of 2026-08-14
No, unless you are actively maintaining legacy code on Python 2.7, 3.4, or 3.5. The package is abandoned (last release 2017-10-13, last commit 2019-04-02) and unnecessary for any modern Python project. If you do need it for legacy support, it installs cleanly with no dependencies, but expect no future maintenance or security updates.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Only useful on Python 2.7, 3.4, 3.5, or 3.6 where TemporaryDirectory is not available in the standard library.
- Low install friction with no runtime dependencies.
- However, the package is abandoned—last release was 2017-10-13 and last commit 2019-04-02.
License · maintenance · safety
permissive license (permissive) — Licensed under Python Software Foundation License (permissive). No restrictions on use or redistribution in typical commercial or open-source contexts.
last release 2017-10-13 (3227 days) · last repo commit 2019-04-02 · 5 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,228,976 downloads/mo, #4,188 on PyPI
Alternatives
Verify before relying
pip install backports.tempfile
from backports.tempfile import TemporaryDirectory
with TemporaryDirectory() as tmpdir:
# Use tmpdir for temporary files
pass- Whether the backport's TemporaryDirectory behavior exactly matches the standard library implementation across all tested versions.
- Whether this backport remains compatible with Python versions beyond 3.6 despite classifiers stopping there.
What it is and what it does
backports.tempfile backports the TemporaryDirectory context manager from Python's standard tempfile module to older Python versions that lack it. TemporaryDirectory is a context manager that creates a temporary directory and automatically cleans it up when the context exits.
This package targets Python 2.7, 3.4, 3.5, and 3.6. It has no runtime dependencies and installs with low friction. However, the package is abandoned—no releases since 2017-10-13 and no commits since 2019-04-02. It is only relevant if you are maintaining legacy code that must run on these old Python versions.
Use it for
- Legacy Python 2.7 codebases that need safe temporary directory handling without manual cleanup.
- Supporting Python 3.4 or 3.5 applications where TemporaryDirectory is not yet available in the standard library.
- Unified code that must run on both Python 2 and early Python 3 versions using a single import.
- Migrating older projects away from manual tempfile cleanup logic to a context-manager approach.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
No, unless you are actively maintaining legacy code on Python 2.7, 3.4, or 3.5.
The package is abandoned (last release 2017-10-13, last commit 2019-04-02) and unnecessary for any modern Python project. If you do need it for legacy support, it installs cleanly with no dependencies, but expect no future maintenance or security updates.
Install
backports-tempfile on PyPI
Before you install
Low install friction with no runtime dependencies. However, the package is abandoned—last release was 2017-10-13 and last commit 2019-04-02. Only relevant if you must support Python 2.7, 3.4, or 3.5.
Only useful on Python 2.7, 3.4, 3.5, or 3.6 where TemporaryDirectory is not available in the standard library.
License in practice
Licensed under Python Software Foundation License (permissive). No restrictions on use or redistribution in typical commercial or open-source contexts.
Quickstart
pip install backports.tempfile
from backports.tempfile import TemporaryDirectory
with TemporaryDirectory() as tmpdir:
# Use tmpdir for temporary files
pass
Verify before relying
- Whether the backport's TemporaryDirectory behavior exactly matches the standard library implementation across all tested versions.
- Whether this backport remains compatible with Python versions beyond 3.6 despite classifiers stopping there.
Package facts
| License | permissive license permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Abandoned 3,227 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,228,976 / month, #4,188 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 6 - MatureIntended Audience :: DevelopersLicense :: OSI Approved :: Python Software Foundation LicenseProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python Modules |
Evidence: backports.tempfile-1.0-py2.py3-none-any.whl
Tags
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 › “temporary directory context manager”
- backports.tempfileProvides the TemporaryDirectory context manager for Python 2.7 and…
- atomicwritesProvides a context manager for writing files atomically—writing to a…
- tempenvTemporarily override environment variables within a scoped context,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
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.
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.
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.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
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…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also contextlib2 · memory-tempfile · backports.weakref · linecache2 · backports.zstd · django-utils-six · unittest2 · traceback2 · pickle5 · weakrefmethod