Skip to main content

BuildStatus Coverage Supported Python versions Latest Version License

Generate sequential file names in a thread-safe way.

Usage

If you want to create sequential files to write output to (say from different threads or from consecutive runs of the same program), then you can use this module.

# Assume files "./a.0.txt" and "./a.3.txt" exist.
>> import seqfile

# Providing prefix and suffix finds the next file in the sequence
# ignoring any gaps
>> seqfile.findNextFile('.', prefix='a.', suffix='.txt')
'./a.4.txt'

# Providing a file name generator as fnameGen produces the first file
# which it was successful in creating.
>> seqfile.findNextFile('.', fnameGen=lambda x: 'a.' + str(x) + '.txt')
'./a.1.txt'

The returned file will exist, be empty, and can be opened for writing.

Installing

This package is available from PyPi.

pip install seqfile

You can install the bleeding edge directly from the source:

pip install git+https://github.com/musically-ut/seqfile.git@master#egg=seqfile

Tests

The tests can be run using nosetests (if all dependencies are installed in the environment) or using python setup.py test.

Metadata

Release files for seqfile 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for seqfile 0.1.0
File Size Uploaded
seqfile-0.1.0.tar.gz 68.0 kB Details

Release files / seqfile-0.1.0.tar.gz

Download URL seqfile-0.1.0.tar.gz
Size 68.0 kB
Tags Source
SHA-256 checksum
How to use checksums
80ed03daefefd561ff5976e6b4cbcec43e741b76df9ac660f0ba165e54717330
BLAKE2b-256 checksum
How to use checksums
44dcf04789fba88cc825ee1ce22367378561cbf0ae26878e7691d820fd15964f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.2.0

1 release file

This release

0.1.0 This release

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page