Skip to main content

Python client and CLI for the METT Data Portal API

Project description

METT Data Portal Client

Python 3.10+ License: MIT 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-dataportal

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_dataportal import DataPortalClient

# Initialize client
client = DataPortalClient()

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

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

Documentation

Quick Links

Viewing API Documentation

The API reference is in Quarto format (.qmd). To view it:

# Generate from OpenAPI spec (if needed)
make docs-generate

# Render to HTML
make docs-render

# Open in browser
open docs/reference/api-reference.html

Or use preview mode (auto-reloads on changes):

make docs-preview

The rendered HTML includes interactive tabs showing examples in three formats:

  • Friendly CLI - High-level mett commands
  • Generic CLI - mett api request commands
  • cURL - Raw HTTP requests

For more information, see the Documentation README.

Installation

From PyPI

pip install mett-dataportal

From Source

git clone https://github.com/your-org/mett-dataportal-client.git
cd mett-dataportal-client
pip install -e .

Development Installation

pip install -e ".[dev]"

Requirements

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

Project Structure

mett-dataportal-client/
โ”œโ”€โ”€ mett_dataportal/          # Main package
โ”‚   โ”œโ”€โ”€ cli/                  # CLI commands (organized by API type)
โ”‚   โ”‚   โ”œโ”€โ”€ core/             # Core APIs (system, species, genomes, genes)
โ”‚   โ”‚   โ”œโ”€โ”€ experimental/    # Experimental APIs (drugs, proteomics, etc.)
โ”‚   โ”‚   โ””โ”€โ”€ interactions/    # Interaction APIs (PPI, TTP)
โ”‚   โ”œโ”€โ”€ client.py             # High-level API client
โ”‚   โ”œโ”€โ”€ config.py             # Configuration management
โ”‚   โ””โ”€โ”€ utils.py              # Utility functions
โ”œโ”€โ”€ mett_dataportal_sdk/      # Auto-generated SDK
โ”œโ”€โ”€ docs/                      # Documentation
โ”‚   โ”œโ”€โ”€ guides/                # User guides
โ”‚   โ”‚   โ”œโ”€โ”€ USAGE.md          # Usage examples
โ”‚   โ”‚   โ””โ”€โ”€ CONFIGURATION.md  # Configuration guide
โ”‚   โ”œโ”€โ”€ developers/            # Developer documentation
โ”‚   โ”‚   โ””โ”€โ”€ DEVELOPMENT.md    # Development guide
โ”‚   โ”œโ”€โ”€ reference/             # API reference
โ”‚   โ”‚   โ”œโ”€โ”€ api-reference.qmd # Main API reference (Quarto)
โ”‚   โ”‚   โ””โ”€โ”€ cli-examples*.md  # Example files
โ”‚   โ””โ”€โ”€ assets/                # Static assets (CSS, etc.)
โ”œโ”€โ”€ scripts/                   # Utility scripts
โ””โ”€โ”€ tests/                     # Test suite

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests and linting (make test && make lint)
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/feature/amazing-feature)
  7. Open a Pull Request

License

MIT License - see LICENSE file for details.

Support

Acknowledgments

Built for the METT Data Portal project. Special thanks to all contributors.


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_dataportal-0.1.0.tar.gz (85.0 kB view details)

Uploaded Source

Built Distribution

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

mett_dataportal-0.1.0-py3-none-any.whl (186.8 kB view details)

Uploaded Python 3

File details

Details for the file mett_dataportal-0.1.0.tar.gz.

File metadata

  • Download URL: mett_dataportal-0.1.0.tar.gz
  • Upload date:
  • Size: 85.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for mett_dataportal-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bf4c0ec414802a36cd3ecbc08b8c18e3e5b8ed92ec6581d736aeb9b5edf978cc
MD5 d1f6acb9f8ac4b8a5506a5cf48f2d189
BLAKE2b-256 854ceda14d99f90b37bb81f32e1ee17eb70e8e1377fdae3a61c8a66611818721

See more details on using hashes here.

File details

Details for the file mett_dataportal-0.1.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for mett_dataportal-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 38dedb16a0cd2ad7d76962472de6317ccce287a69291fd5cbce0bc1224098ef9
MD5 ff987d797726699d8edd4850352228b7
BLAKE2b-256 6c2901c19f1b23ce33fe3660c5a3cb98e5f5684216eae8090c53c41c144007aa

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