Skip to main content

Python package to extract metadata from tables

Use this package to process tabular files in which each row represents an iRODS data object or collection and each column contains either an identifier or metadata to add to this item. It supports plain text files and Excel files, which could be stored locally or in iRODS itself.

To get started, create a virtual environment with pip or uv and install the package:

# with pip
python -m venv venv
source venv/bin/activate
pip install mango-metadata-from-tables
# with uv
uv init <my-project>
uv add mango-metadata-from-tables

Now, you can run the script with the command mango-metadata-from-tables (or uv run mango-metadata-from-tables).

Usage

This module can run on the command line with two commands: setup and run.

The setup command takes as arguments the path to a tabular file (local or in iRODS) and the desired path for the output YAML, asks the user questions about how to parse the tabular file, and outputs a configuration file.

This configuration file can then be provided as the --config option to the run command in order to standardize tabular files and properly obtain paths to data objects and attach metadata to them based on the columns of these files.

Note: Empty values in the table are ignored, and will not be added as metadata.
In some cases, users may find it meaningful to include the absence of a value as contextual information.
In those cases, we advice to use a value like "Unknown", "Not applicable" or "NA" in your table instead.

Examples

A small csv file

The following file simulates having a small semicolon-separated file with absolute paths in a "dataobject" column and a few columns with metadata.

First, with the setup command, we answer a few questions on how to parse the tabular file and create a "test-config.yaml" configuration file that keeps track of the answers.

Then, with the run command, we use the information on the configuration YAML file to parse the tabular file and, because it's just a "dry run", we simulate adding the metadata to each data object or collection. Note that this run command could then also be used on other tabular files with the same properties as the original one.

mango-metadata-from-tables setup tests/testdata/testdata.csv test-config.yaml --sep ";"
mango-metadata-from-tables run tests/testdata/testdata.csv --config test-config.yaml --dry-run

A larger Excel file with multiple sheets

In this second example the file is an Excel file with multiple sheets, including one that has no relevant metadata. Again, with the setup command we indicate how the Excel should be parsed and record the answers in a YAML configuration file. Then, with the run command we parse the Excel and simulate adding the metadata.

mango-metadata-from-tables setup tests/testdata/bigger-testdata.xlsx bigger-test-config.yaml
mango-metadata-from-tables run tests/testdata/bigger-testdata.xlsx --config bigger-test-config.yaml --dry-run

setup

The configuration file can be created as follows:

mango-metadata-from-tables setup filename output_path

In this case filename is the path to a tabular file (csv, tsv, Excel...), stored either locally or in iRODS. If it lives in iRODS, the --irods flag should be used, so that an iRODS session is started:

mango-metadata-from-tables setup /zone/home/project/path/to/tabular output_path --irods

If the tabular file is a plain text file, it is possible to specify a column separator with the --sep option, which has "," as a default. If a wrong separator is provided and the parser finds a single column, it will warn you and give you the possibility to correct it.

mango-metadata-from-tables setup tests/testdata/testdata.csv test-output.yml --sep ";"

If the file can be found and opened as a dataframe, the user will be prompted with questions that will later guide preprocessing of equivalent tabular files:

  • If there are multiple sheets in an Excel file, which one(s) should be used?
  • Which of the columns contains a unique identifier of the data objects that metadata has to be attached to?
  • If the unique identifier is not an absolute path, is it a relative path or part of filename? And if so, within which collection should the data objects be found?
  • Should any columns be whitelisted or blacklisted?

The final YAML will be printed on the console and saved as a file locally.

run

Given a path to a tabular file with metadata and a YAML with the settings to preprocess it, metadata can be added with the run command:

mango-metadata-from-tables run path_to_tabular --config path/to/config.yml

For testing purposes, it is possible to use the --dry-run flag, which simulates the preprocessing and identification of metadata and prints a small report at the end. An iRODS session will be initiated always, so make sure you have a valid active iRODS Session. For the testdata, that is the icts zone in quality.

mango-metadata-from-tables run path_to_tabular --config path/to/config.yml --dry-run

It is not necessary to rerun both setup and run for each tabular file: if you have several tabular files with the same properties, and that thus can be described by the same YAML configuration file, you just need to run setup with one of them, and then run with each of the tabular files and the same configuration file.

Metadata

Release files for mango-metadata-from-tables 1.0.2

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

Source distribution (sdist)

Source distribution for mango-metadata-from-tables 1.0.2
File Size Uploaded Provenance Actions
mango_metadata_from_tables-1.0.2.tar.gz 14.1 kB With provenance Details for mango_metadata_from_tables-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mango-metadata-from-tables 1.0.2
File Interpreter ABI Platform Actions
mango_metadata_from_tables-1.0.2-py3-none-any.whl Python 3 none any Details for mango_metadata_from_tables-1.0.2-py3-none-any.whl

Total release size: 31.8 kB

Release files / mango_metadata_from_tables-1.0.2.tar.gz

Download URL mango_metadata_from_tables-1.0.2.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
beff1d7e7a91b6b588ceb3c06cb71234eee6492366b23c377b14f9739002b200
BLAKE2b-256 checksum
How to use checksums
af7db7829e95f7b9b73cc6cd92db7e1e955677e158a6f2dca4f53b096058ef42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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 Nov 25, 2026.

Transparency log

Release files / mango_metadata_from_tables-1.0.2-py3-none-any.whl

Download URL mango_metadata_from_tables-1.0.2-py3-none-any.whl
Size 17.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e8fa90c03dd57e81096e2a8926e14f1c3189cbd0a9de78db231b4e4e7c521a6
BLAKE2b-256 checksum
How to use checksums
d0903a595d43f8f5a3cc2c6c798a27e81db6b5af7cfbc21dc275dae488b187ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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 Nov 25, 2026.

Transparency log

Security for mango-metadata-from-tables 1.0.2

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.

Select from 2 files

Attestation for mango_metadata_from_tables-1.0.2.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 Nov 25, 2026.

Transparency log

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