Skip to main content

Python library for interacting with openMINDS metadata schemas

Project description

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.

Project details


Download files

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

Source Distribution

openminds-0.5.1.tar.gz (4.8 MB view details)

Uploaded Source

Built Distribution

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

openminds-0.5.1-py3-none-any.whl (6.4 MB view details)

Uploaded Python 3

File details

Details for the file openminds-0.5.1.tar.gz.

File metadata

  • Download URL: openminds-0.5.1.tar.gz
  • Upload date:
  • Size: 4.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for openminds-0.5.1.tar.gz
Algorithm Hash digest
SHA256 a6876d1de1fcde619ec42bd7ee237588a733b7fd5122cef2cec0c8963a527336
MD5 22816a41a7ac26c1f28be41f0f08f0e5
BLAKE2b-256 fb4f184dd9348cb9d5ac3e07d966826bde79fcbb530a1dff14aa2a5de47915b5

See more details on using hashes here.

File details

Details for the file openminds-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: openminds-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 6.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for openminds-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c85e5abd37466fd39ed304ba0c87d7e163306f1ffcf2574286645b3301fc4381
MD5 fb03ae9a1d6c0df07d845a39c22f374d
BLAKE2b-256 8637106ca07494f9601eeb3f52ca1ac0ead36c15cd211712d3f23718c99d265c

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