Skip to content

Overview

MetaboLights WS3


The mtbls-ws3 is Python application stack to manage MetaboLights open repository. It provides REST API endpoints for the metabolomics community and other MetaboLights applications.


Features

  • REST API endpoints with FastAPI and API documentation (Redoc).
  • Json serializable models with pydantic library.
  • Serve the selected REST API endpoints (e.g., submission, curation, public, etc.).
  • A new design with best practices, including dependency inversion, testability, modularity, maintainability, and extensibility.
  • Jwt based extensible authentication, authorization, identity management
  • Improved logging mechanism

Development Environment

Development environment for linux or mac

# install python package manager uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# add $HOME/.local/bin to your PATH, either restart your shell or run
export PATH=$HOME/.local/bin:$PATH

# If there is no git, install it from https://git-scm.com/downloads
# Linux command to install git
# apt update; apt install git -y

# Mac command to install git
# brew install git

# clone project from github
git clone https://github.com/EBI-Metabolights/mtbls-ws3.git

cd mtbls-ws3

# install python with uv
uv python install 3.13

# install python dependencies
uv sync --extra ws3

# install pre-commit to check repository integrity and format checking
uv run pre-commit
#########################################################################################
# ๐Ÿ” Validate pyproject.toml...................................(no files to check)Skipped
# ๐Ÿ”’ Security ยท Detect hardcoded secrets...........................................Passed
# ๐ŸŸข  Markdown ยท Format markdown...................................................Passed
# ๐ŸŸข  Check large files............................................................Passed
# ๐ŸŸข  Check toml files.........................................(no files to check)Skipped
# ๐ŸŸข  Check json files.........................................(no files to check)Skipped
# ๐ŸŸข  Format json files........................................(no files to check)Skipped
# ๐ŸŸข  Check yaml files.............................................................Passed
# ๐ŸŸข Check end of file character...................................................Passed
# ๐ŸŸข  Check training whitespaces...................................................Passed
# โœ… Check training whitespaces................................(no files to check)Skipped
# ๐Ÿ” Detect missing __init__.py files..............................................Passed
# ๐Ÿ” Check Format with Ruff....................................(no files to check)Skipped
# ๐Ÿ python ยท Format with Ruff.................................(no files to check)Skipped
# ๐Ÿชต architecture and package structure check (lint-imports).......................Passed
#########################################################################################

uv run pytest

# Run and test webservice server on local
# test curator metabolights-help@ebi.ac.uk with password test.123
# test user metabolights-dev@ebi.ac.uk with password test.123
# test studies MTBLS800001 MTBLS800002 MTBLS800003
uv run python tests/run/main_local.py

# open your IDE (vscode, pycharm, etc.) and set python interpreter as .venv/bin/python

Design & Development

You can find design details Design Section

Before committing and pushing your updates:

  • Add/update unit tests.
  • Run following commands and fix all issues and
uv run lint-imports

uv run pre-commit

uv run pytest