Example parser for openBIS using the bam-masterdata parser interface.
This repository can be used as a template for creating new parsers that can be used with the openbis-upload-helper.
You can either fork this repository or use it as a template.
Click Use this template and choose Create a new repository:
Choose:
- the organization or profile where the repository will be created;
- a repository name;
- a short description;
- the desired visibility.
At BAM, parsers are typically hosted under the BAMresearch organization.
Clone your new repository:
git clone https://github.com/BAMresearch/<repository-name>.gitNote: The examples below use this repository's current package name, openbis_parser_example. Replace it with your own repository name where needed.
The repository has the following structure:
openbis-parser-example
├── LICENSE
├── pyproject.toml
├── README.md
├── src
│ ├── openbis_parser_example
│ ├── __init__.py
│ ├── parser.py
│ └── _version.py
└── tests
├── __init__.py
├── conftest.py
└── test_parser.pyTo create your parser:
- Define your parser class in
src/<package-name>/parser.py. The class must inherit from thebam-masterdataparser interface,AbstractParser. - Expose the parser in
src/<package-name>/__init__.py:
from .parser import MyParser
my_parser_entry_point = {
"name": "My Parser",
"description": "Description of the parser.",
"parser_class": MyParser,
}- Register the parser in
pyproject.toml:
[project.entry-points."bam.parsers"]
my_parser = "<package-name>:my_parser_entry_point"- Update the remaining package-specific values in
pyproject.toml, such as the project name, package paths, URLs, andsetuptools-scmconfiguration.
Implement the parsing logic in:
src/<package-name>/parser.pyAdd or update tests in:
tests/test_parser.pyThe parser should transform the source files into bam-masterdata objects that can later be written to openBIS.
Once the parser is developed, tested, and released as a Python package, it can be included as a dependency of the openbis-upload-helper.
openbis-upload-helper automatically discovers installed parsers registered under the bam.parsers entry-point group.
If the parser should be included in the distributed application, contact the openbis-upload-helper maintainers and provide the parser repository and released package version.

