Skip to main content

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.

Installation

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 https://git.lumc.nl/j.f.j.laros/jit-open
cd jit_open
pip install .

Usage

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")

Library

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.

Source Distribution

jit_open-1.0.2.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file jit_open-1.0.2.tar.gz.

File metadata

  • Download URL: jit_open-1.0.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.4.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.7

File hashes

Hashes for jit_open-1.0.2.tar.gz
Algorithm Hash digest
SHA256 288a220c3c7a1adaca8bb198dbb5b71e15544e792f93f0ade4df7ddda8dc69b7
MD5 75afb2f3c04e30e56b797f2ffc968a71
BLAKE2b-256 7de955b2c072f9d4298ec18c341f30fde4574dc1c701d71475233c561d437d80

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page