{"library":"memory-tempfile","title":"Memory Tempfile","description":"memory-tempfile (version 2.2.3) is a Python library that provides helper functions to identify and utilize paths on Linux-based operating systems where RAM-based temporary files can be created. It extends Python's standard `tempfile` module to prioritize memory-backed filesystems like `tmpfs` or `ramfs` for temporary storage, aiming to improve performance by avoiding disk I/O. The project has a stable, albeit infrequent, release history with the current version released in 2019.","language":"python","status":"active","last_verified":"Sun May 17","install":{"commands":["pip install memory-tempfile"],"cli":null},"imports":["from memory_tempfile import MemoryTempfile"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from memory_tempfile import MemoryTempfile\nimport os\n\ntempfile_manager = MemoryTempfile()\n\n# Create a temporary file in a memory-backed filesystem\nwith tempfile_manager.TemporaryFile(mode='w+t') as tf:\n    tf.write('Hello from memory tempfile!')\n    tf.seek(0)\n    content = tf.read()\n    print(f\"Read from temp file: {content}\")\n\n# Create a temporary directory in a memory-backed filesystem\nwith tempfile_manager.TemporaryDirectory() as td:\n    print(f\"Temporary directory created at: {td}\")\n    # You can create files inside this directory\n    file_path = os.path.join(td, 'my_data.txt')\n    with open(file_path, 'w') as f:\n        f.write('Data in temp directory.')\n    print(f\"File created in temp directory: {file_path}\")\n# Directory and its contents are automatically removed when exiting the 'with' block","lang":"python","description":"This example demonstrates how to create a temporary file and a temporary directory using `MemoryTempfile`, which will attempt to use a RAM-based filesystem. The resources are automatically cleaned up using context managers.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-17","installed_version":"2.2.3","pypi_latest":"2.2.3","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.6,"avg_import_s":0.02,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"memory-tempfile","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.03,"mem_mb":1.3,"disk_size":"17.8M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"memory-tempfile","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.6,"import_time_s":0.02,"mem_mb":1.3,"disk_size":"18M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"memory-tempfile","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.02,"mem_mb":0.9,"disk_size":"19.6M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"memory-tempfile","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.6,"import_time_s":0.02,"mem_mb":0.9,"disk_size":"20M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"memory-tempfile","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.02,"mem_mb":0.7,"disk_size":"11.5M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"memory-tempfile","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.5,"import_time_s":0.02,"mem_mb":0.7,"disk_size":"12M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"memory-tempfile","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.02,"mem_mb":0.9,"disk_size":"11.3M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"memory-tempfile","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.4,"import_time_s":0.02,"mem_mb":0.8,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"memory-tempfile","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.02,"mem_mb":1.3,"disk_size":"17.3M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"memory-tempfile","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.8,"import_time_s":0.02,"mem_mb":1.3,"disk_size":"18M"}]}}