Skip to main content

Common Formats. Uncommon Speed.

Project description

megstore - Common Formats. Uncommon Speed.

Build Documents Codecov Latest version Support python versions License CII Best Practices

megstore is a Python library that provides a unified interface for file operations across various file formats. It aims to simplify file handling, while also enhancing performance and reliability.

Why megstore

  • Faster file read and write operations, the random read performance is also very fast with index support.
  • Low memory usage with streaming read and write support.
  • Supports popular file formats and easy to use.

Quick Start

Installation

pip3 install megstore

# for msgpack support
pip3 install 'megstore[msgpack]'

Examples

  • indexed jsonline
from megstore import indexed_jsonline_open

with indexed_jsonline_open("data.jsonl", "w") as writer:
    writer.append({"key": "value"})
    writer.append({"number": 123})

with indexed_jsonline_open("data.jsonl", "r") as reader:
    second_item = reader[1]
    second_to_last_items = reader[1:]
    total_count = len(reader)
    for item in reader:
        print(item)
  • indexed msgpack
from megstore import indexed_msgpack_open

with indexed_msgpack_open("data.msg", "w") as writer:
    writer.append({"key": "value"})
    writer.append({"number": 123})

with indexed_msgpack_open("data.msg", "r") as reader:
    second_item = reader[1]
    second_to_last_items = reader[1:]
    total_count = len(reader)
    for item in reader:
        print(item)
  • indexed txt
from megstore import indexed_txt_open

with indexed_txt_open("data.txt", "w") as writer:
    writer.append("Hello, World!")
    writer.append("This is a test.")

with indexed_txt_open("data.txt", "r") as reader:
    second_item = reader[1]
    second_to_last_items = reader[1:]
    total_count = len(reader)
    for line in reader:
        print(line)

How to Contribute

  • We welcome everyone to contribute code to the megstore project, but the contributed code needs to meet the following conditions as much as possible:

    You can submit code even if the code doesn't meet conditions. The project members will evaluate and assist you in making code changes

    • Code format: Your code needs to pass code format check. megstore uses ruff as lint tool

    • Static check: Your code needs complete type hint. megstore uses pytype as static check tool. If pytype failed in static check, use # pytype: disable=XXX to disable the error and please tell us why you disable it.

    • Test: Your code needs complete unit test coverage. megstore uses pyfakefs and moto as local file system and s3 virtual environment in unit tests. The newly added code should have a complete unit test to ensure the correctness

  • You can help to improve megstore in many ways:

    • Write code.
    • Improve documentation.
    • Report or investigate bugs and issues.
    • If you find any problem or have any improving suggestion, submit a new issuse as well. We will reply as soon as possible and evaluate whether to adopt.
    • Review pull requests.
    • Star megstore repo.
    • Recommend megstore to your friends.
    • Any other form of contribution is welcomed.

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

If you're not sure about the file name format, learn more about wheel file names.

megstore-0.0.1-py3-none-any.whl (25.5 kB view details)

Uploaded Python 3

File details

Details for the file megstore-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: megstore-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 25.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for megstore-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d50d5fac03cd9ee4db0b202e42102e6884fa1ec69d378831396925d5a16f1f70
MD5 a030fc22c15d3b2c3a5c94bc7f41b9e6
BLAKE2b-256 1464ee4f6e4c73983302c74a0dfdad4ef18cfa80bc258803a9be819e149e3b67

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