mgnify-pipelines-toolkit
This Python package contains a collection of scripts and tools for including in MGnify pipelines. Scripts stored here are mainly for:
- One-off production scripts that perform specific tasks in pipelines
- Scripts that have few dependencies
- Scripts that don't have existing containers built to run them
- Scripts for which building an entire container would be too bulky of a solution to deploy in pipelines
This package is built and uploaded to PyPi and bioconda. The package bundles scripts and makes them executable from the command-line when this package is installed.
How to install
This package is available both on PyPi and bioconda.
To install from PyPi with pip:
pip install mgnify-pipelines-toolkit
To install from bioconda with conda/mamba:
conda install -c bioconda mgnify-pipelines-toolkit
You should then be able to run the packages from the command-line. For example to run the get_subunits.py script:
get_subunits -i ${easel_coords} -n ${meta.id}
Development
Quick Start with uv and Taskfile
This project uses uv for fast Python environment management and Task for task automation.
Prerequisites:
Common tasks:
task: Available tasks for this project:
* clean: Clean up generated files and caches
* lint: Run linters (ruff check only)
* lint-fix: Run linters and fix issues automatically
* pre-commit: Install pre-commit hooks
* run: Run toolkit scripts with uv (usage: task run -- <script_name> [args])
* test: Run tests with uv
* testk: Run specific tests from a file (usage: task testk -- test_path)
* venv: Create a virtual environment with uv
When doing these steps above, you ensure that the code you add will be linted and formatted properly.
New script requirements
There are a few requirements for your script:
- It needs to have a named main function of some kind. See
mgnify_pipelines_toolkit/analysis/shared/get_subunits.pyand themain()function for an example - Because this package is meant to be run from the command-line, make sure your script can easily pass arguments using tools like
argparseorclick - A small amount of dependencies. This requirement is subjective, but for example if your script only requires a handful of basic packages like
Biopython,numpy,pandas, etc., then it's fine. However if the script has a more extensive list of dependencies, a container is probably a better fit.
How to add a new script
To add a new Python script, first copy it over to the mgnify_pipelines_toolkit directory in this repository, specifically to the subdirectory that makes the most sense. If none of the subdirectories make sense for your script, create a new one. If your script doesn't have a main() type function yet, write one.
Then, open pyproject.toml as you will need to add some bits. First, add any missing dependencies (include the version) to the dependencies field.
Then, if you created a new subdirectory to add your script in, go to the packages line under [tool.setuptools] and add the new subdirectory following the same syntax.
Then, scroll down to the [project.scripts] line. Here, you will create an alias command for running your script from the command-line. In the example line:
get_subunits = "mgnify_pipelines_toolkit.analysis.shared.get_subunits:main"
get_subunitsis the aliasmgnify_pipelines_toolkit.analysis.shared.get_subunitswill link the alias to the script with the pathmgnify_pipelines_toolkit/analysis/shared/get_subunits.py:mainwill specifically call the function namedmain()when the alias is run.
When you have setup this command, executing get_subunits on the command-line will be the equivalent of doing:
from mgnify_pipelines_toolkit.analysis.shared.get_subunits import main; main()
You should then write at least one unit test for your addition. This package uses pytest at the moment for this purpose. A GitHub Action workflow will run all of the unit tests whenever a commit is pushed to any branch.
Finally, you will need to bump up the version in the version line.
At the moment, these should be the only steps required to setup your script in this package (which is subject to change).
Building and uploading to PyPi
The building and pushing of the package is automated by GitHub Actions, which will activate only on a new release. Bioconda should then automatically pick up the new PyPi release and push it to their recipes, though it's worth keeping an eye on their automated pull requests just in case here.
Metadata
Release files for mgnify-pipelines-toolkit 1.5.5
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 | |
|---|---|---|---|---|
| mgnify_pipelines_toolkit-1.5.5.tar.gz | 117.8 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mgnify_pipelines_toolkit-1.5.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 280.4 kB
Release files / mgnify_pipelines_toolkit-1.5.5.tar.gz
| Download URL | mgnify_pipelines_toolkit-1.5.5.tar.gz |
|---|---|
| Size | 117.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
027126318f95fe6266aca1f078649a9cd83a41d93e44bc0b7686989eee8c249d
|
|
BLAKE2b-256 checksum How to use checksums |
cdfa56760fbe6bad314a98f6fea06eab7b7cd6ecbb7b3b889b530f7399b436c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 19, 2026.
Transparency logRelease files / mgnify_pipelines_toolkit-1.5.5-py3-none-any.whl
| Download URL | mgnify_pipelines_toolkit-1.5.5-py3-none-any.whl |
|---|---|
| Size | 162.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ff7935c5b4a6da940fcf5d83061942d81b3712c315fe3b5be3042511cfd8b4b2
|
|
BLAKE2b-256 checksum How to use checksums |
2aba07ca3bc70d373513c89bc3e2b2d34f7fd8c0e9d3647c720ecda4da348c17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 19, 2026.
Transparency logSecurity for mgnify-pipelines-toolkit 1.5.5
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 mgnify_pipelines_toolkit-1.5.5.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 Oct 19, 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.