This package provides backports of new features found in Python's standard `tempfile` module, primarily `tempfile.TemporaryDirectory` (introduced in Python 3.4), allowing its use in older Python environments, including Python 2.7, 3.4, 3.5, and 3.6. It is currently at version 1.0, with its last release in October 2017, indicating a very slow or ceased release cadence given its backport nature and the progression of Python versions.
pip install backports-tempfileVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to use `TemporaryDirectory` from the `backports.tempfile` package as a context manager to create and automatically clean up a temporary directory.
For Python 3.4 and later, simply use `from tempfile import TemporaryDirectory`.
If you need newer `tempfile` features, you must use a Python version where those features are natively available or seek alternative backports if they exist.
Ensure conditional imports or clear version requirements are in place if using backports in a codebase targeting multiple Python versions. Only install and use if genuinely targeting older Python versions that lack the desired `tempfile` functionality.
pip install backports-tempfile
pip install --pre backports.tempfile (for older pip versions or if encountering issues with the main release, otherwise ensure pip is up-to-date: `python -m pip install --upgrade pip`)
Ensure 'backports-tempfile' is installed and import `TemporaryDirectory` from the backports module: `from backports import tempfile` then use `tempfile.TemporaryDirectory()`, or `from backports.tempfile import TemporaryDirectory`. Also, check for and rename any local `tempfile.py` files that might be conflicting.
No dependency data recorded yet.