Skip to main content

Tools for building and analyzing PMO files

Project description

pmotools

A collection of tools to interact with portable microhaplotype object (pmo) file format

Setup

Install using pip

pip install .

Usage

This package is built to either be used as a library in python projects and a command line interface already created which can be called from the commandline pmotools-python which will install with pip install ..

Auto completion

If you want to add auto-completion to the scripts master function pmotools-python you can add the following to your ~/.bash_completion. This can also be found in etc/bash_completion in the current directory. Or can be generated with pmotools-python --bash-completion

_pmotools_python_complete()
{
    local cur prev
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    # 1) Completing the command name (1st arg): list all commands
    if [[ ${COMP_CWORD} -eq 1 ]]; then
        # Our CLI prints machine-friendly list via --list-plain:
        # "<command>\t<group>\t<help>"
        local lines cmds
        lines="$(${COMP_WORDS[0]} --list-plain 2>/dev/null)"
        cmds="$(printf '%s\n' "${lines}" | awk -F'\t' '{print $1}')"
        COMPREPLY=( $(compgen -W "${cmds}" -- "${cur}") )
        return 0
    fi

    # 2) Completing flags for a leaf command: scrape leaf -h
    if [[ "${cur}" == -* ]]; then
        local helps opts
        helps="$(${COMP_WORDS[0]} ${COMP_WORDS[1]} -h 2>/dev/null)"
        # Pull out flag tokens and split comma-separated forms
        opts="$(printf '%s\n' "${helps}" \
            | sed -n 's/^[[:space:]]\{0,\}\(-[-[:alnum:]][-[:alnum:]]*\)\(, *-[[:alnum:]][-[:alnum:]]*\)\{0,\}.*/\1/p' \
            | sed 's/, / /g')"
        COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
        return 0
    fi

    # 3) Otherwise, fall back to filename completion for positional args
    COMPREPLY=( $(compgen -f -- "${cur}") )
    return 0
}

complete -F _pmotools_python_complete pmotools-python

Developer Setup

To contribute to pmotools, follow these steps:

  1. Clone the repository and switch to the develop branch:
git clone git@github.com:your-org/pmotools.git
cd pmotools
git checkout develop
  1. Create your feature branch:
git checkout -b feature/my-feature
  1. Install and set up UV. This creates .venv/ and installs everything from pyproject.toml:
pip install -U uv
uv sync --dev
  1. Install pre-commit hooks (for formatting & linting):
uv run pre-commit install
  1. Run pre-commit manually on all files (first time):
uv run pre-commit run --all-files
  1. Develop your code. Pre-commit will automatically run on staged files before each commit, checking:
  • Formatting (Ruff)
  • Linting (Ruff)
  • Trailing whitespace, YAML syntax, large files
  1. Run tests:
uv run pytest
  1. Commit and push your changes:
git add .
git commit -m "Your message"
git push origin feature/my-feature

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

pmotools-0.1.0.tar.gz (75.8 kB view details)

Uploaded Source

Built Distribution

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

pmotools-0.1.0-py3-none-any.whl (85.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pmotools-0.1.0.tar.gz
  • Upload date:
  • Size: 75.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for pmotools-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e5cf9310720fd341fe8beb887df82e7ec1c7b6289e4b70dfa84052eef0cb2520
MD5 fa33e607dfb169b8195a4e788a9de9b7
BLAKE2b-256 1fa02def22669ecb2ea9c7e36c66aa7aa2f28d819cdcc863ad3dd24ba70228ea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pmotools-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 85.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for pmotools-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a7d74cacad95836ef1918136e85c049fdca137530be28d780be4e2b19277316a
MD5 e29c9e0bd38e0b9ed705bfdf62fc7cf6
BLAKE2b-256 81b61d52cdeff285cfdd8aa21c82bde3d40bae1b420516c70e4810172780dd1c

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