Skip to main content

openMINDS Python library

openMINDS Python is a small library to support the creation and use of openMINDS metadata models and schemas in your Python application, with import and export in JSON-LD format.

Installation

pip install openMINDS

Usage

from datetime import date
from openminds import Collection, IRI
import openminds.latest.core as omcore

# Create an empty metadata collection

collection = Collection()

# Create some metadata

mgm = omcore.Organization(
    full_name="Metro-Goldwyn-Mayer Studios, Inc.", short_name="MGM", homepage=IRI("https://www.mgm.com")
)

stan = omcore.Person(
    given_name="Stan",
    family_name="Laurel",
    affiliations=omcore.Affiliation(member_of=mgm, start_date=date(1942, 1, 1)),
)

ollie = omcore.Person(
    given_name="Oliver",
    family_name="Hardy",
    affiliations=omcore.Affiliation(member_of=mgm, start_date=date(1942, 1, 1)),
)

# Add the metadata to the collection

collection.add(stan, ollie, mgm)

# Check the metadata are valid

failures = collection.validate()

# Save the collection in a single JSON-LD file

collection.save("my_collection.jsonld")

# Save each node in the collection to a separate file

collection.save("my_collection", individual_files=True)  # creates files within the 'my_collection' directory

# Load a collection from file
new_collection = Collection()
new_collection.load("my_collection.jsonld")

License

This work is licensed under the MIT License.

Getting help

In case of questions about openMINDS, please contact us at support@openmetadatainitiative.org. If you find a bug in the Python library or would like to suggest an enhancement or new feature, please open a ticket in the openMINDS Python library issue tracker.

If you identify a problem or would like to suggest changes to the openMINDS specification itself, please open a ticket in the openMINDS issue tracker.

Development

Contributions are welcome, please see our contribution guidelines.

This repository has two main branches: pipeline and main. The pipeline contains the code for building the Python package from the openMINDS schemas. The build process is triggered by changes to the schemas, and runs as a GitHub action. The resultant package is copied to the main branch, and at intervals is published on PyPI.

Acknowledgements

EU Logo

This open source software code was developed in part or in whole in the Human Brain Project, funded from the European Union's Horizon 2020 Framework Programme for Research and Innovation under Specific Grant Agreements No. 720270, No. 785907 and No. 945539 (Human Brain Project SGA1, SGA2 and SGA3), and in the EBRAINS-2.0 project, funded from the European Union's Horizon Europe programme under grant agreement 101147319.

Release files for openMINDS 0.6.1

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

Source distribution (sdist)

Source distribution for openMINDS 0.6.1
File Size Uploaded
openminds-0.6.1.tar.gz 4.9 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for openMINDS 0.6.1
File Interpreter ABI Platform
openminds-0.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.8 MB

Release files / openminds-0.6.1.tar.gz

Download URL openminds-0.6.1.tar.gz
Size 4.9 MB
Tags Source
SHA-256 checksum
How to use checksums
60388817d066568a4500ed503eb12efcecf1cb0e1a8d7e6de7579d3a09326a06
BLAKE2b-256 checksum
How to use checksums
e023ff6a7f3e5803dc831c494cfe4d38cb7f62c2982cdbc9a28e1f08b6c8e257
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / openminds-0.6.1-py3-none-any.whl

Download URL openminds-0.6.1-py3-none-any.whl
Size 6.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
41cfb6ee610b9cf109767ec9acba653fdc5549249c287d1002f7813fc91d85b3
BLAKE2b-256 checksum
How to use checksums
c4d41c5cd10f4c6510806d0c2a415f93ecb404695b7518d51810b2d2cbfa95d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6
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