Skip to main content

Python client and CLI for the METT Data Portal API

Project description

METT Data Portal Client

Python 3.10+ License: Apache-2.0 PyPI version

Python client library and command-line interface (CLI) for the METT Data Portal API. Access genomic data, experimental results, and protein interactions for gut microbiome research.

Features

  • 🚀 High-level Python API - Clean, intuitive interface for programmatic access
  • 💻 Command-line Interface - Powerful CLI with tab completion and rich output
  • 📊 Multiple Output Formats - JSON, TSV, and formatted tables
  • 🔒 Flexible Authentication - Environment variables or config file support
  • 📚 Comprehensive Documentation - Auto-generated API reference with examples
  • 🔄 Auto-generated SDK - Stays in sync with the API schema

Quick Start

Installation

pip install mett

CLI Usage

# List all species
mett species list

# Search genomes
mett genomes search --query "Bacteroides" --per-page 5

# Get gene information
mett genes get BU_ATCC8492_00001

Python API

from mett_client import DataPortalClient

# Initialize client
client = DataPortalClient()

# List species
species = client.list_species()
print(f"Found {len(species)} species")

# List genomes (paginated)
result = client.list_genomes(per_page=5)
print(f"Found {len(result.items)} genomes")

# Search genomes by species
result = client.species_genomes("BU", per_page=5)
print(f"Found {len(result.items)} BU genomes")

# Search genomes with query
result = client.search_genomes(query="ATCC", per_page=5)
print(f"Found {len(result.items)} genomes matching 'ATCC'")

# Search genomes - check first genome
if result.items:
    print(f"First genome: {result.items[0].isolate_name}")

Documentation

For complete documentation including usage guides, API reference, and configuration options, please visit the GitHub repository.

Installation

From PyPI

pip install mett

From Source

Recommended (with uv)

git clone https://github.com/EBI-Metagenomics/mett-dataportal-client.git
cd mett-dataportal-client

# Create a virtual environment and install all dependencies from pyproject.toml
uv sync --all-extras --dev

# Run the CLI via uv (no manual activation needed)
uv run mett --help

Running tests and linting

With uv (recommended):

# Install all dev dependencies (if not already done)
uv sync --all-extras --dev

# Run tests
uv run pytest -v

# Run Ruff lint and formatting checks
uv run ruff check mett_client/ scripts/ tests/
uv run ruff format --check mett_client/ scripts/ tests/

# (Optional) Run pre-commit hooks on all files
uv run pre-commit run --all-files

Alternative (classic pip workflow)

If you prefer not to use uv, you can still work with a standard virtual environment:

python -m venv .venv
source .venv/bin/activate

pip install --upgrade pip
pip install -e ".[dev]"

# CLI is now on PATH inside the venv
mett --help

Requirements

  • Python 3.10+
  • See pyproject.toml for full dependency list

License

Apache-2.0 License - see LICENSE file for details.


Note: For development environments without SSL certificates, you may need to set:

export METT_VERIFY_SSL=false

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

mett-0.0.1a3.tar.gz (86.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mett-0.0.1a3-py3-none-any.whl (187.0 kB view details)

Uploaded Python 3

File details

Details for the file mett-0.0.1a3.tar.gz.

File metadata

  • Download URL: mett-0.0.1a3.tar.gz
  • Upload date:
  • Size: 86.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for mett-0.0.1a3.tar.gz
Algorithm Hash digest
SHA256 f6c45eb0af540db4962e719d21a32149b6991ead997c5644ff4fed1d6179a18b
MD5 4113c708aa8c846b19bed9491f7ad81b
BLAKE2b-256 44a4cfa4a023aa3cb8d8629239cd30d019f8f5e49e144e505c95b2a490ce7fe0

See more details on using hashes here.

File details

Details for the file mett-0.0.1a3-py3-none-any.whl.

File metadata

  • Download URL: mett-0.0.1a3-py3-none-any.whl
  • Upload date:
  • Size: 187.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for mett-0.0.1a3-py3-none-any.whl
Algorithm Hash digest
SHA256 e88c7850649c76b20ed1b239bb3a44217c9125cc99e01fdd399ec325230e3ef3
MD5 42f2c822cae0d727ad578baac32f1bf6
BLAKE2b-256 9ec8b2fcb550f4db0c3bdef7cce9e0880ff79158f30c081a9b8025370cce6200

See more details on using hashes here.

Supported by

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