Skip to main content

Maggma

Static Badge testing codecov python

What is Maggma

Maggma is a framework to build scientific data processing pipelines from data stored in a variety of formats -- databases, Azure Blobs, files on disk, etc., all the way to a REST API. The rest of this README contains a brief, high-level overview of what maggma can do. For more, please refer to the documentation.

Installation from PyPI

Maggma is published on the Python Package Index. The preferred tool for installing packages from PyPi is pip. This tool is provided with all modern versions of Python.

Open your terminal and run the following command.

pip install --upgrade maggma

Basic Concepts

maggma's core classes -- Store and Builder -- provide building blocks for modular data pipelines. Data resides in one or more Store and is processed by a Builder. The results of the processing are saved in another Store, and so on:

flowchart LR
    s1(Store 1) --Builder 1--> s2(Store 2) --Builder 2--> s3(Store 3)
s2 -- Builder 3-->s4(Store 4)

Store

A major challenge in building scalable data pipelines is dealing with all the different types of data sources out there. Maggma's Store class provides a consistent, unified interface for querying data from arbitrary data sources. It was originally built around MongoDB, so it's interface closely resembles PyMongo syntax. However, Maggma makes it possible to use that same syntax to query other types of databases, such as Amazon S3, GridFS, or files on disk, and many others. Stores implement methods to connect, query, find distinct values, groupby fields, update documents, and remove documents.

The example below demonstrates inserting 4 documents (python dicts) into a MongoStore with update, then accessing the data using count, query, and distinct.

>>> turtles = [{"name": "Leonardo", "color": "blue", "tool": "sword"},
               {"name": "Donatello","color": "purple", "tool": "staff"},
               {"name": "Michelangelo", "color": "orange", "tool": "nunchuks"},
               {"name":"Raphael", "color": "red", "tool": "sai"}
            ]
>>> store = MongoStore(database="my_db_name",
                       collection_name="my_collection_name",
                       username="my_username",
                       password="my_password",
                       host="my_hostname",
                       port=27017,
                       key="name",
                    )
>>> with store:
        store.update(turtles)
>>> store.count()
4
>>> store.query_one({})
{'_id': ObjectId('66746d29a78e8431daa3463a'), 'name': 'Leonardo', 'color': 'blue', 'tool': 'sword'}
>>> store.distinct('color')
['purple', 'orange', 'blue', 'red']

Builder

Builders represent a data processing step, analogous to an extract-transform-load (ETL) operation in a data warehouse model. Much like Store provides a consistent interface for accessing data, the Builder classes provide a consistent interface for transforming it. Builder transformation are each broken into 3 phases: get_items, process_item, and update_targets:

  1. get_items: Retrieve items from the source Store(s) for processing by the next phase
  2. process_item: Manipulate the input item and create an output document that is sent to the next phase for storage.
  3. update_target: Add the processed item to the target Store(s).

Both get_items and update_targets can perform IO (input/output) to the data stores. process_item is expected to not perform any IO so that it can be parallelized by Maggma. Builders can be chained together into an array and then saved as a JSON file to be run on a production system.

Origin and Maintainers

Maggma has been developed and is maintained by the Materials Project team at Lawrence Berkeley National Laboratory and the Materials Project Software Foundation.

Maggma is written in Python and supports Python 3.11+.

Metadata

Release files for maggma 0.78.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 maggma 0.78.0
File Size Uploaded Provenance Actions
maggma-0.78.0.tar.gz 231.1 kB Without provenance Details for maggma-0.78.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for maggma 0.78.0
File Interpreter ABI Platform Actions
maggma-0.78.0-py3-none-any.whl Python 3 none any Details for maggma-0.78.0-py3-none-any.whl

Total release size: 356.7 kB

Release files / maggma-0.78.0.tar.gz

Download URL maggma-0.78.0.tar.gz
Size 231.1 kB
Tags Source
SHA-256 checksum
How to use checksums
af2bab427291a57e744e87f8668d36b41eb6f8c1a2a32a151631a761f454b96c
BLAKE2b-256 checksum
How to use checksums
03b959363a66c6160943668b4c0c6b58330733304b312d7429580cf18bb46b24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / maggma-0.78.0-py3-none-any.whl

Download URL maggma-0.78.0-py3-none-any.whl
Size 125.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9f76bf9ee14b8987fc985ae407234d1aff37c667d26ca6d4fdd01f2ecd909d7
BLAKE2b-256 checksum
How to use checksums
23297e3585da86a19b62477463c9ab1578faff814e21e62a5b222682d6862dd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for maggma 0.78.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.78.0 This release

2 release files No provenance

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