Skip to main content

Point-in-time Storage.

Project description

pits – Point-In-Time Storage

pits provides Pythonic context-managed file object abstraction for point-in-time file storage. pits supports plain or gzipped files.

pits is listed on PyPI.

Writing

my_data = grab_my_data(...)

# write to plain file
with open('my-data.txt', 'w+') as f:
    f.write(my_data)

# write to gzip file
import gzip
with gzip.open('my-data.gz', 'wb') as f:
    f.write(my_data)

# write to point-in-time file
import pits
with pits.open('my-data', 'wb', gzip=True) as f:
    f.write(my_data)

# write as if we're at another point in time
with pits.goto('20220101-1200').open('my-data', 'wb', gzip=True) as f:
    f.write(my_data)

Reading

import pits

# read latest file
with pits.open('my-data') as f:
    f.write(my_data)

# read latest file as if we're at another point in time
with pits.goto('2022-12-18 15:00').open('my-data') as f:
    f.write(my_data)

Datetime format

  • Timestamp format for file name is %Y.%m.%d-%H:%M:%S.
  • All non-numeric characters are omitted in timestamp parsing, e.g., 2022-12-18 15:00 is transformed to 202212181500 before parsing.
  • All timestamps are local.
  • 20221218 is recognized as 2022-12-18 23:59:59, but 20221218-1500 is recognized as 2022-12-18 15:00:00.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pits-0.1.2-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file pits-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pits-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for pits-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ba7e7cc9b758e5e89ffe79a047a111896e9ea9283d917d02ae997b15429f21ec
MD5 a11e6518cf4b939ae1ddc8e871d69a15
BLAKE2b-256 17f439aedecc2a056548858349436bcdfd12c3f8cbae68e7042079068d643925

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