Extremely simple helper for the memory-tempfile package
Project description
pytmpfile
Extremely simple helper for memory-tempfile. Intended to use in non-Python programs requiring files (e.g., GCC).
Usage:
from pytmpfile import get_tmp_path
import os
if __name__ == '__main__':
with get_tmp_path(content='print("hello")\n', suffix='.py') as tmp_path:
print(f'{tmp_path} exists inside context manager: {os.path.exists(tmp_path)}')
print('And it has this content:')
with open(tmp_path, 'r') as f:
print(f.read())
print(f'{tmp_path} exists outside context manager: {os.path.exists(tmp_path)}')
Output:
/run/user/1000/tmpemeg9rhm.py exists inside context manager: True
And it has this content:
print("hello")
/run/user/1000/tmpemeg9rhm.py exists outside context manager: False
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytmpfile-0.2.1.tar.gz
(3.1 kB
view details)
File details
Details for the file pytmpfile-0.2.1.tar.gz
.
File metadata
- Download URL: pytmpfile-0.2.1.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a8001c125fbac424e66e3a242fd0f630bdb79532f959cfbb0cdbb120e6fac7d |
|
MD5 | 572e01079ef9b30e5886e65e2471c909 |
|
BLAKE2b-256 | b1caa584019f2b5d0c29ecaca04b95603ba767e41bd3514a5e8d81b8887a6132 |