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.0.tar.gz (3.2 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: jit_open-1.0.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for jit_open-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b55345854d2225e4ed2939ef5258f8c430519180bf2fe73995d55c2d1c658e18
MD5 7a43de46040ab97040c70f1427c9128b
BLAKE2b-256 9bdd03dbd802397b36cc793cbb1c904cf2964b281591f7ddf58c30752a9c51b8

See more details on using hashes here.

Supported by

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