Skip to content

Commit 1180df8

Browse files
authored
Merge pull request #76 from vsoch/development
Migration to Singularity Hub 2.0 is done
2 parents ef49586 + 0d42bdb commit 1180df8

File tree

299 files changed

+5897
-3616
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

299 files changed

+5897
-3616
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1+
singularity.egg-info
2+
__pycache__
3+
pypi.sh
4+
dist
15
*.pyc
26
OLD

.travis.yml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,17 @@ sudo: true
55
os: linux
66

77
language: python
8-
python:
9-
- "2.7"
10-
- "3.5"
118

12-
install:
13-
- pip install pylint
14-
- cd $TRAVIS_BUILD_DIR/
15-
- cd $TRAVIS_BUILD_DIR && pip install -r requirements.txt
16-
- cd $TRAVIS_BUILD_DIR && pip3 install -r requirements.txt
17-
- python setup.py sdist
18-
- python setup.py install
19-
- pylint --version
20-
- cd /tmp && git clone -b development https://github.com/singularityware/singularity.git && cd singularity && ./autogen.sh && ./configure --prefix=/usr/local && make && sudo make install
9+
matrix:
10+
include:
11+
- os: linux
12+
env: PYTHON_VERSION=2
13+
- os: linux
14+
env: PYTHON_VERSION=3
15+
16+
before_install:
17+
- sudo chmod u+x .travis/*
18+
- .travis/before_install
2119

2220
script:
23-
- python -m unittest discover -s $TRAVIS_BUILD_DIR/singularity/tests/ -p '[t|T]est*.py'
24-
#bash $TRAVIS_BUILD_DIR/singularity/tests/run_tests.sh $TRAVIS_BUILD_DIR/singularity/tests /tmp
21+
- .travis/script

.travis/before_install

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
apt-get update && apt-get install -y wget git build-essential squashfs-tools \
4+
libtool \
5+
autotools-dev \
6+
automake \
7+
autoconf
8+
9+
sudo sed -i -e 's/^Defaults\tsecure_path.*$//' /etc/sudoers
10+
11+
if [ "${PYTHON_VERSION}" == "2" ];
12+
then
13+
wget https://repo.continuum.io/archive/Anaconda2-5.0.0.1-Linux-x86_64.sh
14+
sudo bash Anaconda2-5.0.0.1-Linux-x86_64.sh -b -p /opt/anaconda2 && sudo chown -R 0755 /opt/anaconda2
15+
PATH=/opt/anaconda3/bin:$PATH
16+
rm Anaconda2-5.0.0.1-Linux-x86_64.sh
17+
export PATH
18+
else
19+
wget https://repo.continuum.io/archive/Anaconda3-5.0.0.1-Linux-x86_64.sh
20+
sudo bash Anaconda3-5.0.0.1-Linux-x86_64.sh -b -p /opt/anaconda3 && sudo chown -R 0755 /opt/anaconda3
21+
PATH=/opt/anaconda3/bin:$PATH
22+
rm Anaconda3-5.0.0.1-Linux-x86_64.sh
23+
export PATH
24+
fi
25+
26+
# Install python dependencies
27+
which python
28+
29+
conda install -y pandas scikit-learn pygments
30+
cd $TRAVIS_BUILD_DIR && sudo python -m pip install -r requirements.txt
31+
python setup.py sdist && python setup.py install
32+
pylint --version
33+
34+
# Install Singularity (development)
35+
cd /tmp && git clone -b development https://github.com/singularityware/singularity.git && cd singularity && ./autogen.sh && ./configure --prefix=/usr/local && make && sudo make install
36+

.travis/script

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
sudo apt-get install -y squashfs-tools
3+
python -m unittest discover -s $TRAVIS_BUILD_DIR/singularity/tests/ -p '[t|T]est*.py'

MANIFEST.in

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
include README.md
2-
include LICENSE
3-
recursive-include singularity/tests *
4-
recursive-include singularity/hub *
5-
recursive-include singularity/templates *
6-
recursive-include singularity/static *
7-
recursive-include singularity/build *
8-
recursive-include singularity/analysis *
9-
recursive-include singularity/views *
10-
recursive-include singularity/testing *
1+
include README.md LICENSE
2+
recursive-include singularity *
3+
recursive-exclude * __pycache__
4+
recursive-exclude * *.pyc
5+
recursive-exclude * *.pyo

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
# Singularity Python
42

53
[![Build Status](https://travis-ci.org/singularityware/singularity-python.svg?branch=master)](https://travis-ci.org/singularityware/singularity-python)
@@ -12,4 +10,3 @@ Please see our [complete docs](https://github.com/singularityware/singularity-py
1210

1311
## Help and Contribution
1412
Please contribute to the package, or post feedback and questions as <a href="https://github.com/singularityware/singularity-python" target="_blank">issues</a>. For points that require discussion of the larger group, please use the <a href="https://groups.google.com/a/lbl.gov/forum/#!forum/singularity" target="_blank">Singularity List</a>
15-

examples/cli/run_singularity/singularity_client.py

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,36 +11,46 @@
1111
S.help()
1212

1313
# These are the defaults, which can be specified
14-
S = Singularity(sudo=False,sudopw=None,debug=False)
14+
S = Singularity(sudo=False,debug=False)
1515

16-
# Create an image
17-
image = S.create('myimage.img')
16+
# Note that the "create" and "import" workflow is deprecated in favor of build
17+
# https://singularityware.github.io/docs-build
1818

19-
# Import into it
19+
image = S.build('myimage.simg', 'docker://ubuntu:latest') # requires sudo
20+
21+
# (Deprecated) create an image and import into it
22+
image = S.create('myimage.simg')
2023
S.importcmd(image,'docker://ubuntu:latest')
2124

2225
# Execute command to container
2326
result = S.execute(image,command='cat /singularity')
2427
print(result)
2528
'''
26-
#!/bin/sh
27-
28-
if test -x /bin/bash; then
29-
exec /bin/bash "$@"
30-
elif test -x /bin/sh; then
31-
exec /bin/sh "$@"
32-
else
33-
echo "ERROR: No valid shell within container"
34-
exit 255
35-
fi
29+
'#!/bin/sh\n\nexec "/bin/bash"\n'
3630
'''
3731

3832
# For any function you can get the docs:
3933
S.help(command="exec")
4034

41-
# export an image as a byte array
42-
byte_array = S.export(image)
35+
# export an image to tar
36+
tar = S.export(image)
37+
38+
# Show apps and inspect
39+
S.apps(image)
40+
S.inspect(image)
4341

44-
# Get an in memory tar
45-
from singularity.reproduce import get_memory_tar
46-
tar = get_memory_tar(image)
42+
'''
43+
{
44+
"data": {
45+
"attributes": {
46+
"deffile": null,
47+
"help": null,
48+
"labels": null,
49+
"environment": "# Custom environment shell code should follow\n\n",
50+
"runscript": "#!/bin/sh\n\nexec \"/bin/bash\"\n",
51+
"test": null
52+
},
53+
"type": "container"
54+
}
55+
}
56+
'''
Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,40 @@
11
#!/bin/sh
22

3-
# Generate a python run script in the present working directory
4-
shub --runscript py
3+
# See help
4+
shub create --help
55

6-
# Generate a python run script somewhere else
7-
shub --runscript py --outfolder /home/vanessa/Desktop
6+
'''
7+
Usage: shub create [-h] [--recipe] [--app APP] [--from BOOTSTRAP_FROM]
8+
[--bootstrap BOOTSTRAP] [--outfolder OUTFOLDER]
9+
10+
optional arguments:
11+
-h, --help show this help message and exit
12+
--recipe create template recipe
13+
--app APP the name of an app to include in the recipe
14+
--from BOOTSTRAP_FROM
15+
the bootstrap "from", should coincide with "bootstrap"
16+
type
17+
--bootstrap BOOTSTRAP
18+
the bootstrap type, default is docker
19+
--outfolder OUTFOLDER
20+
full path to folder for output, stays in tmp (or pwd)
21+
if not specified
22+
23+
'''
24+
25+
# Generate a relatively blank template, default bootstrap is docker
26+
shub create
27+
'''
28+
DEBUG bootstrap: docker
29+
Output file written to /home/vanessa/Documents/Dropbox/Code/singularity/singularity-python/examples/create/make_runscript/Singularity
30+
'''
31+
32+
# Create a recipe template for an app
33+
shub create --app foo
34+
'''
35+
DEBUG bootstrap: docker
36+
Output file written to /home/vanessa/Documents/Dropbox/Code/singularity/singularity-python/examples/create/make_runscript/Singularity.foo
37+
'''
38+
39+
# Specify a from, bootstrap
40+
shub create --app foo --from ubuntu --bootstrap docker

examples/create/make_runscript/singularity

Lines changed: 0 additions & 53 deletions
This file was deleted.

examples/create/package_image/package_images.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,4 @@
7979
if not os.path.exists(package_name):
8080
image_package = package(image_path=image,
8181
output_folder=output_folder,
82-
remove_image=True,
83-
runscript=True,
84-
software=True)
85-
tmpfolder = os.path.dirname(image)
86-
shutil.rmtree(tmpfolder)
87-
82+
old_version=True) # makes file tar instead of memory

0 commit comments

Comments
 (0)