Skip to main content

volatile

Temporary files and directories.

Contains replacement for tempfile.NamedTemporaryFile that does not delete the file on close(), but still unlinks it after the context manager ends, as well as a mkdtemp-based temporary directory implementation.

  • Mostly reuses the stdlib implementations, supporting the same signatures.

  • Due to that, uses the OS’s built-in temporary file facilities, no custom schemes.

  • Tested on Python 2.6+ and 3.3+

Usage

A typical use-case that is not possible with the regular NamedTemporaryFile:

import volatile

with volatile.file() as tmp:
    # tmp behaves like a regular NamedTemporaryFile here, except for that
    # it gets unlinked at the end of the context manager, instead of when
    # close() is called.

    tmp.close()

    # run the users $EDITOR
    run_editor(tmp.name)

    buf = open(tmp.name).read()

    # ...

Temporary directories:

import volatile

with volatile.dir(): as dtmp:
    pass  # ... can use directory here

# a missing dtmp will not throw an exception!

Unix domain sockets:

import volatile

with volatile.unix_socket(): as (sock, addr):
    # sock is the bound socket, addr its address on the filesystem
    pass  # ... can use directory here

The source is fairly short and contains API docs in the comments.

Metadata

Release files for volatile 2.1.0

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

Source distribution (sdist)

Source distribution for volatile 2.1.0
File Size Uploaded Provenance Actions
volatile-2.1.0.tar.gz 3.3 kB Without provenance Details for volatile-2.1.0.tar.gz

Release files / volatile-2.1.0.tar.gz

Download URL volatile-2.1.0.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9be36ad508e3354e016c115de0397dc2203b9800a73d9d177ca9d37a8d3a31d3
BLAKE2b-256 checksum
How to use checksums
0dc68ab8520c95262ba253e7cc93ba4636bdeeb9ab2c0bdec5034b46e01b607d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for volatile 2.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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