A quick way to get a temporary pathlib.Path.
Project description
temppath
Provides a quick way to get a pathlib.Path file in the system-defined
temporary space. temppath does not wrap tempfile.NamedTemporaryFile,
as that automatically deletes on close, and does not allow the same file to be
written, closed, then read in Windows,
which is inconsistent with the Unix implementation. Since temppath
provides pathlib.Path objects, this is not an issue.
Usage
There is a nice context manager, which will remove the path for you.
from temppath import TemporaryPathContext
with TemporaryPathContext() as t:
t.write_text('the quick brown fox jumps over the lazy dog')
...
do_something_awesome_that_reads(t)
# The file is removed when you leave the `with` context.
You also have the option to just clean it up yourself if you need more control.
from temppath import TemporaryPath
t = TemporaryPath()
t.write_text('the quick brown fox jumps over the lazy dog')
...
do_something_awesome_that_reads(t)
...
t.unlink()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file temppath-2021.236.907.tar.gz.
File metadata
- Download URL: temppath-2021.236.907.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f24807f96c801a172c66eb59d491db8255275803d6a86fe5b39dd27eaecf0fb9
|
|
| MD5 |
37b24b643afe435030bd6c25871d1dc6
|
|
| BLAKE2b-256 |
00ea00d72a7940b0da9c13743f842eab6d857cbe32c136620fb8cfd71ff70d36
|
File details
Details for the file temppath-2021.236.907-py3-none-any.whl.
File metadata
- Download URL: temppath-2021.236.907-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cce55c6b7f595a0b3cba801ab5e47d23fdde95570ac55b7c39d3fe690da3f76
|
|
| MD5 |
36c69700b50be24d82e9b08d26b533fe
|
|
| BLAKE2b-256 |
c5920909b9db62a83df1a992b45786bbb80863bd6237cb483c5309d686b51f91
|