Apply ManGO metadata schemas in Python
Small application to apply metadata from a metadata schema using iRODS PRC.
Requirements
python-irodsclientvalidators
Installation
You can install the package and its dependencies with pip:
pip install mango-mdschema
Usage
# authentication to iRODS
import os, os.path
from irods.session import iRODSSession
from mango_mdschema import Schema
env_file = os.getenv('IRODS_ENVIRONMENT_FILE', os.path.expanduser('~/.irods/irods_environment.json'))
# load a schema from file
my_schema = Schema('/path/to/schema') # this also validates it as a schema
with iRODSSession(irods_env_file=env_file) as session:
obj = session.data_objects.get('path/to/my/object')
my_metadata = {
'text' : 'Some text',
'a_date' : '2023-04-26',
'author' : {
'name' : 'Mariana',
'email' : 'mariana.montes@kuleuven.be'
}
}
my_schema.apply(obj, my_metadata)
The apply function will first validate the provided metadata dictionary
before applying it on the iRODS object. See the tutorial for
more details.
To only validate your metadata, without applying it, you can use the validate
function of the schema.
try:
validated = my_schema.validate(metadata)
except (ConversionError, ValidationError) as err:
print("Oops my metadata was not valid: {err}")
You can check the fields in a schema with:
print(my_schema)
The list of required fields and default values is found as the required_fields attribute.
You can also check all the characteristics of a specific field such as 'name' with:
my_schema.print_requirements('name') # same as print(my_schema.fields['name'])
You can test the list of AVUs that would be sent by providing a given metadata dictonary like so:
avus = my_schema.to_avus(metadata)
The schema class can also read the metadata from ManGO and return it as
nested dictionary with all values converted to their Python representation (
i.e. integer fields result in int values, datetime fields in datetime
objects, etc.).
with iRODSSession(irods_env_file=env_file) as session:
obj = session.data_objects.get('path/to/my/object')
my_metadata = my_schema.extract(obj)
Check the tutorial notebook for more details.
Metadata
Release files for mango-mdschema 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mango_mdschema-1.1.0.tar.gz | 25.0 kB | With provenance | Details for mango_mdschema-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mango_mdschema-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for mango_mdschema-1.1.0-py3-none-any.whl |
Total release size: 43.6 kB
Release files / mango_mdschema-1.1.0.tar.gz
| Download URL | mango_mdschema-1.1.0.tar.gz |
|---|---|
| Size | 25.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f23715f7147be866aa2550546e8d49625312c45bf33303d7a54a36c07749cea6
|
|
BLAKE2b-256 checksum How to use checksums |
94adc77ced013bc7e73ff5046437306275832954564cc9abeb4b879d579b216c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 7, 2026.
Transparency logRelease files / mango_mdschema-1.1.0-py3-none-any.whl
| Download URL | mango_mdschema-1.1.0-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2bb9c343c0b5b53b7b04571971b22f26a5c511531cbf3aa510068bc74feeda61
|
|
BLAKE2b-256 checksum How to use checksums |
985fac6f90f88d967d4c61ea87fdb09f14182a6d6c1ea16402df24df87848cb5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 7, 2026.
Transparency logSecurity for mango-mdschema 1.1.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mango_mdschema-1.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 7, 2026.
Transparency logA 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.