Skip to main content

mincePy Sci

CI Coverage Latest Version Python versions License Ruff

mincePy: move the database to one side and let your objects take centre stage.

mincePy Sci is a set of plugins for mincePy that enable common scientific and machine learning types to be saved. See the mincepy documentation for more information.

Installation

mincePy Sci needs Python 3.11 or later. Install it with mincePy:

pip install mincepy[sci]

or on its own, pip install mincepy-sci. Once installed, mincePy finds the plugins automatically, and support for each library is enabled if that library is installed. To install all the supported libraries as well, use pip install mincepy-sci[full].

Quick start

Scientific objects can then be saved, loaded and searched like any other mincePy object, e.g. with numpy, pymatgen and pytorch installed:

import mincepy
import numpy as np
from pymatgen.core import Lattice, Structure
import torch

historian = mincepy.connect("litemongo:///path/to/my/db#science", use_globally=True)

# Arrays
energies_id = historian.save(np.linspace(-3.5, -2.9, 7))

# Materials, e.g. a crystal structure, here with some metadata
nacl = Structure(Lattice.cubic(5.64), ["Na", "Cl"], [[0, 0, 0], [0.5, 0.5, 0.5]])
nacl_id = historian.save(nacl)
historian.meta.set(nacl_id, {"material": "NaCl", "source": "textbook"})

# Machine learning models
model_id = historian.save(torch.nn.Linear(3, 1))

# Later, e.g. in another script or notebook, load them back
energies, nacl, model = historian.load(energies_id, nacl_id, model_id)

# or find them by their metadata (or state)
structures = historian.find(meta={"material": "NaCl"})

Every save is versioned, so the history of each object is kept, and objects can be organised and browsed like files with pyOS.

Supported types

ase:
  • Atoms

  • Cell

e3nn:
  • o3:
    • Irrep and Irreps

    • Instruction

    • TensorProduct

    • ElementwiseTensorProduct

    • ReducedTensorProducts

    • TensorSquare

  • nn:
    • Gate

    • Extract

    • Activation

  • math:
    • normalize2mom

jax:
  • Array

numpy:
  • ndarray

pandas:
  • DataFrame

plams:
  • Settings

  • Molecule

  • Atom

  • Bond

pyilt2 (installed from PyPI as pyilt22):
  • dataset

pymatgen:
  • Structure

  • Molecule

  • BandStructure

  • CompleteDos

  • PeriodicSite

pytorch:
  • Tensor

  • Parameter

  • Size

  • Conv2d

  • MaxPool2d

  • Linear

  • ModuleList

  • ModuleDict

rdkit:
  • Mol

Contributing

We’d love to get more data types supported by mincePy! For now, the easiest way is to follow the examples set by the existing types and contribute a PR. If you’d like more (i.e. any) documentation on how to do this or would like to request that someone with more expertise makes a plugin just create an issue and we’ll see what we can do.

To develop mincePy Sci (Python 3.11 or later):

pip install -e '.[dev,full]'
pre-commit install

The tests can be run against MongoDB (by default mongodb://127.0.0.1) or, without a server, using litemongo’s in-memory engine:

MINCEPY_TEST_URI="litemongo://?engine=memory#mincepy-sci-tests" pytest test

Types are checked with ty (ty check, also run in CI). Files that don’t pass yet are listed under [tool.ty.src] exclude in pyproject.toml, please remove them from there once fixed.

Metadata

Release files for mincepy-sci 0.3.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 mincepy-sci 0.3.0
File Size Uploaded Provenance Actions
mincepy_sci-0.3.0.tar.gz 16.4 kB Without provenance Details for mincepy_sci-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mincepy-sci 0.3.0
File Interpreter ABI Platform Actions
mincepy_sci-0.3.0-py3-none-any.whl Python 3 none any Details for mincepy_sci-0.3.0-py3-none-any.whl

Total release size: 34.9 kB

Release files / mincepy_sci-0.3.0.tar.gz

Download URL mincepy_sci-0.3.0.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
bcb404d113dd925b22489bda42f8e27c507977fa6f61986f495f64823c963dc4
BLAKE2b-256 checksum
How to use checksums
b01b48108458ebeb04b73d985fda9a12c9aef72e016e76e4ec4fb88a02c5c16f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / mincepy_sci-0.3.0-py3-none-any.whl

Download URL mincepy_sci-0.3.0-py3-none-any.whl
Size 18.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
552fa714935a3ddff30d2f6d263712a56d1daceb673cc686ebb9cad08f6cf521
BLAKE2b-256 checksum
How to use checksums
f6505cafc215933fd0c6388594c7e8258b7820bd1b12e37ab90939dcf81be245
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for mincepy-sci 0.3.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.

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