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 via https://ebrains.eu/support/. 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).

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.1.0.tar.gz (241.7 kB view details)

Uploaded Source

Built Distribution

openMINDS-0.1.0-py3-none-any.whl (862.2 kB view details)

Uploaded Python 3

File details

Details for the file openMINDS-0.1.0.tar.gz.

File metadata

  • Download URL: openMINDS-0.1.0.tar.gz
  • Upload date:
  • Size: 241.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.6

File hashes

Hashes for openMINDS-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ecd65a48f6ab3c08320a7ad325fdd130c35e002d4bb3c070ef720515a5c56c91
MD5 f891696dbfdedcace22e300fdc077a3d
BLAKE2b-256 63e3cb21acbedd3050afa1c1822cb34f5b83f1fb092cfc5dba0b83caf6a94510

See more details on using hashes here.

Provenance

File details

Details for the file openMINDS-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: openMINDS-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 862.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.6

File hashes

Hashes for openMINDS-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc102e1107b4e70adc5f4adf7b25a9164bf87e3119c87afad96a3106bcadfba2
MD5 ca313a98873e4da6511538789818746b
BLAKE2b-256 e599fad01d12d1f28dcac8a88421221bc988da5068fad3b2ddc9dbd9b60788fa

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page