Skip to main content

LinkML Toolkit (lmtk)

Tests PyPI version Documentation Status

A simple toolkit for working with LinkML schemas. This tool offers advanced schema analysis, validation, transformation, and visualization capabilities through a flexible command-line interface.

🌟 Features

  • Schema Analysis

    • Generate schema summaries.
    • Detailed views of classes, slots, and types.
    • Support for hierarchical and section-based analysis.
  • Schema Validation

    • Rigorous validation checks with detailed error reporting.
    • Optional metadata display for schemas.
  • Schema Operations

    • Merge or concatenate multiple schemas.
    • Subset schemas by specified classes.
  • Format Conversion

    • Export schemas to JSON, RDF, GraphQL, CSV, TSV, and SQL formats.
    • Customize RDF serialization formats (e.g., Turtle, XML).
    • SQL export supporting PostgreSQL, MySQL, SQLite, and DuckDB dialects.
  • Visualization

    • Generate interactive HTML visualizations of schemas.
    • Options for inheritance, descriptions, and statistics display.

🚀 Installation

Using pip

pip install linkml-toolkit

Using conda

# Create environment from provided configuration
conda env create -f environment-dev.yml
conda activate linkml-toolkit-dev

# For production environment only
conda env create -f environment.yml
conda activate linkml-toolkit

Development Installation

# Clone the repository
git clone https://github.com/genomewalker/linkml-toolkit.git
cd linkml-toolkit

# Create and activate conda environment
conda env create -f environment-dev.yml
conda activate linkml-toolkit-dev

# Install in development mode
pip install -e ".[dev,test,docs]"

📚 Usage

Core Commands

Schema Summary

# Generate a summary of the schema
lmtk summary --schema schema.yaml

# Detailed view for specific sections
lmtk summary --schema schema.yaml --section slots --detailed

# Export summary to JSON
lmtk summary --schema schema.yaml --output summary.json

Schema Validation

# Validate schema
lmtk validate --schema schema.yaml

# Validate with metadata display
lmtk validate --schema schema.yaml --metadata

Schema Export

# Export to JSON Schema
lmtk export --schema schema.yaml --format json --output schema.json

# Export to RDF (Turtle format)
lmtk export --schema schema.yaml --format rdf --rdf-format turtle --output schema.ttl

# Export to SQL (PostgreSQL dialect)
lmtk export --schema schema.yaml --format sql --sql-dialect postgresql --output schema.sql

Schema Subset

# Create a subset containing specific classes
lmtk subset --schema schema.yaml --classes class1,class2 --output subset.yaml

# Exclude inherited elements
lmtk subset --schema schema.yaml --classes class1 --no-inherited --output subset.yaml

Schema Combination

# Merge schemas
lmtk combine --schema base.yaml --additional-schemas schema1.yaml -a schema2.yaml --mode merge --output merged.yaml

# Concatenate schemas
lmtk combine --schema base.yaml --additional-schemas schema1.yaml -a schema2.yaml --mode concat --output concatenated.yaml

Schema Visualization

# Generate an interactive HTML visualization
lmtk visualize --schema schema.yaml --output visualization.html

# Generate full documentation bundle
lmtk visualize --schema schema.yaml --output docs/ --full-docs

🛠️ Development

Environment Management

# Create development environment
conda env create -f environment.yml

# Update environment
conda env update -f environment.yml

# Create production environment
conda env create -f environment.prod.yml

Running Tests

# Run all tests
pytest

# Run with coverage
pytest --cov=linkml_toolkit

# Run specific test file
pytest tests/test_core.py

# Run tests with output
pytest -v

Building Documentation

# Build documentation
cd docs
mkdocs build

# Serve documentation locally
mkdocs serve

📖 Project Structure

linkml-toolkit/
├── src/
│   └── linkml_toolkit/      # Source code
├── tests/                   # Test suite
│   └── data/               # Test data
├── docs/                    # Documentation
├── environment.yml         # Development environment
├── environment.prod.yml    # Production environment
├── pyproject.toml         # Build configuration
├── setup.cfg              # Package metadata
└── tox.ini               # Test automation

🤝 Contributing

We welcome contributions! Here's how you can help:

  1. Fork the Repository

    git clone https://github.com/genomewalker/linkml-toolkit.git
    cd linkml-toolkit
    
  2. Set Up Development Environment

    conda env create -f environment.yml
    conda activate linkml-toolkit
    pip install -e ".[dev,test,docs]"
    
  3. Create a Branch

    git checkout -b feature/your-feature-name
    
  4. Make Changes

    • Write code
    • Add tests
    • Update documentation
  5. Verify Changes

    # Run tests
    pytest
    
    # Run linting
    tox -e lint
    
    # Build docs
    cd docs && mkdocs build
    
  6. Submit Pull Request

    • Push changes to your fork
    • Create pull request
    • Wait for review

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • LinkML community for the base LinkML implementation.
  • Contributors who have helped improve this toolkit.

📫 Contact

Metadata

Release files for linkml-toolkit 0.2.0

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

Source distribution (sdist)

Source distribution for linkml-toolkit 0.2.0
File Size Uploaded Provenance
linkml_toolkit-0.2.0.tar.gz 55.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for linkml-toolkit 0.2.0
File Interpreter ABI Platform
linkml_toolkit-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 103.3 kB

Release files / linkml_toolkit-0.2.0.tar.gz

Download URL linkml_toolkit-0.2.0.tar.gz
Size 55.6 kB
Tags Source
SHA-256 checksum
How to use checksums
86bb777417b7e789ce6f9255a9e01189107c8bee24e88f502820d77dc3b8a188
BLAKE2b-256 checksum
How to use checksums
af16ceebdacb0ec1a6be9f4ac103f3d4e262ceddfaefe3320b4c0c41266508e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / linkml_toolkit-0.2.0-py3-none-any.whl

Download URL linkml_toolkit-0.2.0-py3-none-any.whl
Size 47.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5bb653babcfadafe3e64f4c2e7c4814f05507d5b2b4a22ad85345bd91c688fa9
BLAKE2b-256 checksum
How to use checksums
3c6ac52352ca66e29fc2e7857f4ff3fef0a22727f9e0d8d476fb7a48d10d5324
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Security for linkml-toolkit 0.2.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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