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
# bash completion for pmotools-python
# add the below to your ~/.bash_completion
_pmotools_python_complete()
{
# Make sure underscores (and =) are NOT treated as word breaks
# so options like --pmo_files or --file=path complete as one token.
local _OLD_WB="${COMP_WORDBREAKS-}"
COMP_WORDBREAKS="${COMP_WORDBREAKS//_/}"
COMP_WORDBREAKS="${COMP_WORDBREAKS//=}"
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}") )
# restore wordbreaks before returning
COMP_WORDBREAKS="$_OLD_WB"
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
# Keep underscores intact in the tokens.
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}") )
COMP_WORDBREAKS="$_OLD_WB"
return 0
fi
# 3) Otherwise, fall back to filename completion for positional args
COMPREPLY=( $(compgen -f -- "${cur}") )
# restore original word breaks
COMP_WORDBREAKS="$_OLD_WB"
return 0
}
complete -F _pmotools_python_complete pmotools-python
Developer Setup
To contribute to pmotools, follow these steps:
- Clone the repository and switch to the develop branch:
git clone git@github.com:your-org/pmotools.git
cd pmotools
git checkout develop
- Create your feature branch:
git checkout -b feature/my-feature
- Install and set up UV. This creates .venv/ and installs everything from pyproject.toml:
pip install -U uv
uv sync --dev
- Install pre-commit hooks (for formatting & linting):
uv run pre-commit install
- Run pre-commit manually on all files (first time):
uv run pre-commit run --all-files
- 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
- Run tests:
uv run pytest
- Commit and push your changes:
git add .
git commit -m "Your message"
git push origin feature/my-feature
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pmotools-1.0.0.tar.gz.
File metadata
- Download URL: pmotools-1.0.0.tar.gz
- Upload date:
- Size: 84.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.12 {"installer":{"name":"uv","version":"0.9.12"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1a4bcf86286c85976afb12be72aa46155eedaf6407d9f221628f86a3848f5b3
|
|
| MD5 |
a1cd75a922760220fe0bbe391601770d
|
|
| BLAKE2b-256 |
6e52ba2aa698043eaa14afa791aac4ebce0ec2cc962ed10ca72dc5c72f9a9030
|
File details
Details for the file pmotools-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pmotools-1.0.0-py3-none-any.whl
- Upload date:
- Size: 102.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.12 {"installer":{"name":"uv","version":"0.9.12"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
893e9ede5ef482c193e820addbd219453baeb4d2a54ab88d8c06a54b7887d40e
|
|
| MD5 |
c680a0745561feb0baab0788a8c6584d
|
|
| BLAKE2b-256 |
af228119ff54f4948908b4fe1c11053713d126613c5b21775827f9fa743a478f
|