Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Just in time open files

Project description

This package provides a way to delay opening files until the something is written to the file handle. This can be convenient when opening a large number of files of which most of them will not be frequently used. To deal with resource limits a queue is used from which, when full, the least frequent file is closed.


The software is distributed via PyPI, it can be installed with pip:

pip install jit_open

From source

The source is hosted on GitHub, to install the latest development version, use the following commands.

git clone
cd jit_open
pip install .


In the following example, only the file used.txt is created.

>>> from jit_open import Handle, Queue
>>> queue = Queue()
>>> used = Handle("used.txt", queue)
>>> unused = Handle("unused.txt", queue)
>>> used.write("line 1\n")
>>> used.write("line 2\n")


The library provides the Handle and Queue classes.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for jit_open, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size jit_open-1.0.1.tar.gz (3.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page