Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ The client here will eventually be released as "spython" (and eventually to
singularity on pypi), and the versions here will coincide with these releases.

## [master](https://github.com/singularityhub/singularity-cli/tree/master)
- WORKDIR should create container for Singularity converter (0.0.12)
- sudo `-E` flag should not be provided by default (0.2.13)
- WORKDIR should create container for Singularity converter (0.2.12)
- support for background process with client run (0.2.11)
- parser bugfixes, arg from Docker not properly parsed (0.2.1)
- version checks removed to support Singularity 3.x and above (0.2.0)
Expand Down
4 changes: 4 additions & 0 deletions docs/pages/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ toc: false
---

# Python API

This commands section primarily focuses on using Singularity Python from within Python and then in an interactive shell (for testing). We will first discuss the Python API, meaning functions that you can use in python to work with Singularity images or instances. Python is strong in the world of scientific programming, and so if you are reading these notes it's likely that you want to integrate Singularity containers into your Python applications. We wrote you a client to do that! Please select the type of command you are interested in below to continue!

- [Images](/singularity-cli/commands-images): base API to interact with containers:
- [Instances](/singularity-cli/commands-instances): interact with container instances.
- [OCI](/singularity-cli/commands-oci): interact with the OCI command group (3.1.0 and up)

Note that for any command that allows specifying `sudo`, you can provide additional options to sudo
(e.g., `-E` to preserve the environment) via `sudo_options`.

<hr>

<div>
Expand Down
7 changes: 5 additions & 2 deletions spython/utils/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@


def _process_sudo_cmd(cmd, sudo, sudo_options):
"""
Process the sudo command and honor adding environment (or not)
"""
if sudo and sudo_options is not None:
if isinstance(sudo_options, str):
sudo_options = shlex.split(sudo_options)
cmd = ["sudo", "-E"] + sudo_options + cmd
cmd = ["sudo"] + sudo_options + cmd
elif sudo:
cmd = ["sudo", "-E"] + cmd
cmd = ["sudo"] + cmd
return [x for x in cmd if x]


Expand Down
2 changes: 1 addition & 1 deletion spython/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.


__version__ = "0.2.12"
__version__ = "0.2.13"
AUTHOR = "Vanessa Sochat"
AUTHOR_EMAIL = "vsoch@users.noreply.github.com"
NAME = "spython"
Expand Down