lmodify
A Python CLI tool for creating and managing LMOD modules from Singularity/Apptainer containers in HPC environments.
Features
- Automatic package name and version detection from Singularity image filenames
- Generate LMOD Lua module files
- Create wrapper scripts for containerized applications
- Manage multiple package versions
- Add commands to existing packages
- Interactive configuration setup
Installation
pip install -e .
For development:
pip install -e ".[dev]"
Quick Start
1. Initialize Configuration
First, create your configuration file:
lmodify init
This will prompt you for:
- Path to Singularity images
- Path for binary wrappers
- Path for LMOD Lua files
- Your metadata (name, email, organization)
The configuration is saved to ~/.config/lmodify.ini by default.
2. Create a Package
Create an LMOD module from a Singularity image:
lmodify create -s /path/to/seqfu__1.20.3.simg seqfu fu-msa fu-orf
Or load commands from a file:
lmodify create -s /path/to/seqfu__1.20.3.simg -f commands.txt
This will:
- Parse the package name and version from the image filename
- Create a wrapper script in
{bin_path}/seqfu__1.20.3/singularity.exec - Create symlinks for the specified commands
- Generate an LMOD Lua file at
{lmod_path}/seqfu/1.20.3.lua
3. List Available Packages
View all available LMOD modules:
lmodify list
Filter by keyword:
lmodify list seqfu
Show only package names:
lmodify list -p
4. Add Commands to Existing Packages
Add one or more commands to an existing package:
lmodify add seqfu fu-orf
lmodify add seqfu fu-orf fu-shred fu-pecheck
Add from a file:
lmodify add seqfu -f commands.txt
Add to a specific version:
lmodify add seqfu fu-orf --version 1.20.3
Supported Image Naming Patterns
lmodify automatically detects package names and versions from these patterns:
-
Galaxy Project depot pattern:
depot.galaxyproject.org-singularity-{name}-{version}--{build}.img depot.galaxyproject.org-singularity-kraken2-2.0.8_beta--pl526hc9558a2_2.img -
Colon pattern:
{name}:{version}--{build} checkv:1.0.3--pyhdfd78af_0 genomad:1.9.0--pyhdfd78af_1.simg -
Double underscore pattern:
{name}__{version}[.extension] seqfu__1.20.3 unicycler__0.5.1.simg
If automatic detection fails, you can specify manually:
lmodify create -s image.sif -p mypackage -v 1.0.0 mycommand
Commands
init
Create a configuration file with interactive prompts.
lmodify init [-o OUTPUT] [-f]
Options:
-o, --output: Output path for config file-f, --force: Overwrite existing config file
create
Create a new LMOD package from a Singularity image.
lmodify create [OPTIONS] [COMMANDS...]
Options:
-s, --singularity: Path to Singularity image (required)-p, --package: Package name (auto-detected if not provided)-v, --version: Package version (auto-detected if not provided)-f, --cmd-file: File with list of commands (one per line, # for comments)-l, --lmod-path: Override LMOD path from config-b, --bin-path: Override bin path from config-d, --description: Package description-C, --category: Package category (bio, chem, physics, tools, etc.)--force: Overwrite existing files--dry-run: Preview without making changes
Command file format:
Create a text file with one command per line. Empty lines and lines starting with # are ignored:
# Core commands
seqfu
fu-msa
fu-orf
fu-index
fu-shred
# Additional utilities
fu-pecheck
fu-tabcheck
You can combine commands from both the file and command-line arguments. Duplicates are automatically removed.
list
List available LMOD packages.
lmodify list [KEYWORD] [-p]
Options:
KEYWORD: Filter packages (case-insensitive)-p, --packages-only: Show only package names, not versions-l, --lmod-path: Override LMOD path from config
add
Add one or more commands to an existing package.
lmodify add PACKAGE [COMMANDS...] [OPTIONS]
Options:
-f, --cmd-file: File with list of commands (one per line, # for comments)-v, --version: Add to specific version (default: all versions)-l, --lmod-path: Override LMOD path from config-b, --bin-path: Override bin path from config--force: Overwrite existing command--dry-run: Preview without making changes
Examples:
# Add single command
lmodify add seqfu fu-orf
# Add multiple commands
lmodify add seqfu fu-orf fu-shred fu-pecheck
# Add from file
lmodify add seqfu -f commands.txt
# Combine file and arguments
lmodify add seqfu fu-extra -f commands.txt --version 1.20.3
Configuration File
Default location: ~/.config/lmodify.ini
[lmodify]
singularity_default_path = /opt/singularity
bin_path = /opt/bin
lmod_path = /opt/lmod
[metadata]
author = Your Name
email = your.email@example.com
organization = Your Organization
You can specify a custom config file with:
lmodify -c /path/to/config.ini <command>
How It Works
When you create a package, lmodify:
-
Creates a wrapper script (
singularity.exec) that executes commands inside the container:#!/bin/bash singularity exec "/path/to/image.simg" $(basename "$0") "$@"
-
Creates symlinks for each command pointing to the wrapper script:
seqfu -> singularity.exec stats -> singularity.exec
-
Generates an LMOD Lua module that adds the bin directory to PATH:
prepend_path("PATH", "/opt/bin/seqfu__1.20.3")
Users can then load the module:
module load seqfu/1.20.3
seqfu --version
Development
Run tests:
pytest
Run tests with coverage:
pytest --cov=lmodify
License
MIT License
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Metadata
Release files for lmodify 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| lmodify-0.6.0.tar.gz | 26.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lmodify-0.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 54.4 kB
Release files / lmodify-0.6.0.tar.gz
| Download URL | lmodify-0.6.0.tar.gz |
|---|---|
| Size | 26.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d71997b6de21c136406b86be41cfef168007900fa638d54d44b137fb7be2d66b
|
|
BLAKE2b-256 checksum How to use checksums |
1b9070ce313542524357cf919e59507653dab5cfebbeca7eb1d2da9ab67faae5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 17, 2026.
Transparency logRelease files / lmodify-0.6.0-py3-none-any.whl
| Download URL | lmodify-0.6.0-py3-none-any.whl |
|---|---|
| Size | 28.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fb7ff902105006a7b201961ea0bf81fdecdaadc7031e93c70573bc1f4a9745b1
|
|
BLAKE2b-256 checksum How to use checksums |
4e5057006b8d1d05e1f81d55a26c9c704da0a99ccbbc1f887b8453e98421a704
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 17, 2026.
Transparency logSecurity for lmodify 0.6.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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for lmodify-0.6.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 17, 2026.
Transparency logA 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.