styxsingularity is a Python package that provides Singularity/Apptainer integration for Styx compiled wrappers. It allows you to run Styx functions within Singularity containers, offering improved isolation and reproducibility for your workflows.
You can install styxsingularity using pip:
pip install styxsingularityfrom styxdefs import set_global_runner
from styxsingularity import SingularityRunner
# Initialize the SingularityRunner
runner = SingularityRunner()
# Set the global runner for Styx
set_global_runner(runner)
# Now you can use any Styx functions as usual, and they will run in Singularity containersThe SingularityRunner class accepts several parameters for advanced configuration:
image_overrides: A dictionary to override container image tagssingularity_executable: Path to the Singularity executable (default:"singularity")data_dir: Directory for temporary data storageenviron: Environment variables to set in the container
Example:
runner = SingularityRunner(
image_overrides={"python:3.9": "my-custom-python:3.9"},
singularity_executable="/usr/local/bin/singularity",
data_dir="/tmp/styx_data",
environ={"PYTHONPATH": "/app/lib"}
)styxsingularity provides a custom error class, StyxSingularityError, which is raised when a Singularity execution fails. This error includes details about the return code, command arguments, and Singularity arguments for easier debugging.
Contributions to styxsingularity are welcome! Please refer to the GitHub repository for information on how to contribute, report issues, or submit pull requests.
styxsingularity is released under the MIT License. See the LICENSE file for details.
For detailed API documentation, please visit our API Docs.
If you encounter any issues or have questions, please open an issue on the GitHub repository.
- Python 3.10+
- Singularity or Apptainer installed and running on your system
Comparison with styxdocker
While styxdocker and styxsingularity serve similar purposes, they have some key differences:
- Container Technology:
styxdockeruses Docker, whilestyxsingularityuses Singularity/Apptainer. - Platform Support:
styxdockerworks on Windows, Linux, and macOS, whereasstyxsingularityis not supported on Windows. - User Permissions:
styxdockercan run containers as the current user on POSIX systems, which can help with file permission issues.
Choose the package that best fits your infrastructure and requirements.