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
128 changes: 74 additions & 54 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,20 @@
version: 2.1

orbs:
singularity: singularity/singularity@1.0.3
singularity: singularity/singularity@1.0.4

workflows:
version: 2
test:
jobs:
- test-singularity-3-python-3:
filters:
branches:
ignore: master
- test-singularity-3-python-2:
filters:
branches:
ignore: master
- test-singularity-2-python-2:
filters:
branches:
ignore: master
- test-singularity-2-python-3:
- test-singularity-3-python-3: &ignore_master
filters:
branches:
ignore: master
- test-singularity-3-1-python-3: *ignore_master
- test-singularity-3-python-2: *ignore_master
- test-singularity-2-python-3: *ignore_master
- test-singularity-2-python-2: *ignore_master

waitforapt: &waitforapt
name: Remove cloud init lock
Expand All @@ -39,55 +31,57 @@ waitforapt: &waitforapt
install_spython: &install_spython
name: install spython
command: |
$HOME/conda/bin/pip uninstall spython --yes || echo "Not installed"
$HOME/conda/bin/python setup.py install
pip uninstall spython --yes || echo "Not installed"
python --version
python setup.py install

install_python_3: &install_python_3
name: install Python 3.5 dependencies
name: install Python 3 dependencies
command: |
ls $HOME
if [ ! -d "/home/circleci/conda" ]; then
echo 'export PATH="$HOME/conda/bin:$PATH"' >> "$BASH_ENV"
source "$BASH_ENV"
if [ ! -d "$HOME/conda" ]; then
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
/bin/bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/conda
export PATH=$HOME/conda/bin:$PATH
$HOME/conda/bin/python setup.py install
else
else
echo "Miniconda 3 is already installed, continuing to build."
fi
fi
[ $(python -c'import sys;print(sys.version_info.major)') -eq 3 ]

install_python_2: &install_python_2
name: install Python 3.5 dependencies
name: install Python 2 dependencies
command: |
ls $HOME
if [ ! -d "/home/circleci/conda" ]; then
echo 'export PATH="$HOME/conda/bin:$PATH"' >> "$BASH_ENV"
if [ ! -d "$HOME/conda" ]; then
wget https://repo.anaconda.com/miniconda/Miniconda2-latest-Linux-x86_64.sh
/bin/bash Miniconda2-latest-Linux-x86_64.sh -b -p $HOME/conda
export PATH=$HOME/conda/bin:$PATH
$HOME/conda/bin/python setup.py install
else
else
echo "Miniconda 2 is already installed, continuing to build."
fi
fi
[ $(python -c'import sys;print(sys.version_info.major)') -eq 2 ]

install_dependencies: &install_dependencies
name: install CI dependencies
command: |
pip install --upgrade pylint pytest

run_linter: &run_linter
name: run linter
command: |
$HOME/conda/bin/pip install --upgrade pylint
cd ~/repo
$HOME/conda/bin/pylint spython
cd ~/repo
pylint spython

test_spython: &test_spython
name: Test Singularity Python (Singularity Version 2 and 3)
command: |
cd ~/repo/spython
$HOME/conda/bin/python -m unittest tests.test_client
$HOME/conda/bin/python -m unittest tests.test_utils
$HOME/conda/bin/python -m unittest tests.test_instances
cd ~/repo/spython
pytest -k 'not test_oci'

test_spython_3: &test_spython_3
name: Test Singularity Python (Singularity Version 3 Only)
command: |
cd ~/repo/spython
$HOME/conda/bin/python -m unittest tests.test_oci
cd ~/repo/spython
pytest -k 'test_oci'


jobs:
Expand All @@ -98,19 +92,43 @@ jobs:
- checkout
- restore_cache:
keys:
- v1-dependencies
- v1-dependencies-py3
- run: *install_python_3
- run: *waitforapt
- singularity/install-go:
go-version: 1.11.5
- singularity/debian-install-3:
singularity-version: 3.1.0
singularity-version: 3.2.1
- run: *install_spython
- run: *install_dependencies
- save_cache:
paths:
- ~/conda
key: v1-dependencies-py3
- run: *run_linter
- run: *test_spython
- run: *test_spython_3

test-singularity-3-1-python-3:
machine: true
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-py3
- run: *install_python_3
- run: *waitforapt
- singularity/install-go:
go-version: 1.11.5
- singularity/debian-install-3:
singularity-version: 3.1.0
- run: *install_spython
- run: *install_dependencies
- save_cache:
paths:
- /home/circleci/conda
key: v1-dependencies
- ~/conda
key: v1-dependencies-py3
- run: *test_spython
- run: *test_spython_3

Expand All @@ -121,19 +139,19 @@ jobs:
- checkout
- restore_cache:
keys:
- v1-dependencies
- v1-dependencies-py2
- run: *install_python_2
- run: *waitforapt
- singularity/install-go:
go-version: 1.11.5
- singularity/debian-install-3:
singularity-version: 3.1.0
singularity-version: 3.2.1
- run: *install_spython
- run: *run_linter
- run: *install_dependencies
- save_cache:
paths:
- /home/circleci/conda
key: v1-dependencies
- ~/conda
key: v1-dependencies-py2
- run: *test_spython
- run: *test_spython_3

Expand All @@ -144,16 +162,17 @@ jobs:
- checkout
- restore_cache:
keys:
- v1-dependencies
- v1-dependencies-py3
- run: *install_python_3
- run: *waitforapt
- singularity/debian-install-2:
singularity-version: 2.6.1
- run: *install_spython
- run: *install_dependencies
- save_cache:
paths:
- /home/circleci/conda
key: v1-dependencies
- ~/conda
key: v1-dependencies-py3
- run: *test_spython

test-singularity-2-python-2:
Expand All @@ -163,14 +182,15 @@ jobs:
- checkout
- restore_cache:
keys:
- v1-dependencies
- v1-dependencies-py2
- run: *install_python_2
- run: *waitforapt
- singularity/debian-install-2:
singularity-version: 2.6.1
- run: *install_spython
- run: *install_dependencies
- save_cache:
paths:
- /home/circleci/conda
key: v1-dependencies
- ~/conda
key: v1-dependencies-py2
- run: *test_spython
1 change: 1 addition & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ disable=attribute-defined-outside-init,
no-member,
protected-access,
R,
unidiomatic-typecheck,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Wouldn't isinstance(foo, str) work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t know why, but it didn’t. The type was Unicode in Circle and it was best caught by checking for string. If I added Unicode to the isinstance list it would skip over and return None for the state. But this works.

redefined-builtin,
redefined-outer-name,
trailing-whitespace,
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ 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)
- updated testing to use pytest, linting fixes, and oci state fixes (0.0.63)
- fix crash in some error conditions (0.0.62)
- more OCI commands accept sudo parameter
- working directory, the last one defined, should be added to runscript (0.0.61)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
requests
semver
2 changes: 1 addition & 1 deletion spython/image/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(self, image=None):
image: the image uri to parse (required)

'''
super().__init__()
super(Image, self).__init__()
self.parse_image_name(image)


Expand Down
2 changes: 1 addition & 1 deletion spython/instance/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self, image, start=True, name=None, **kwargs):
name: a name for the instance (will generate RobotName
if not provided)
'''
super().__init__()
super(Instance, self).__init__()
self.parse_image_name(image)
self.generate_name(name)

Expand Down
10 changes: 8 additions & 2 deletions spython/main/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
from spython.logger import bot
from spython.utils import (
check_install,
get_singularity_version
get_singularity_version,
get_singularity_version_info
)

import json
Expand Down Expand Up @@ -43,10 +44,15 @@ def __init__(self):
self._init_level()

def version(self):
'''a wrapped to get_singularity_version, takes no arguments.
'''Shortcut to get_singularity_version, takes no arguments.
'''
return get_singularity_version()

def version_info(self):
'''Shortcut to get_singularity_version_info, takes no arguments.
'''
return get_singularity_version_info()

def _check_install(self):
'''ensure that singularity is installed, and exit if not.
'''
Expand Down
4 changes: 1 addition & 3 deletions spython/main/base/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.


from spython.utils import (
run_command as run_cmd
)
from spython.utils import run_command as run_cmd

from spython.logger import bot

Expand Down
2 changes: 1 addition & 1 deletion spython/oci/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self,
sudo: if init is called with or without sudo, keep a record and use
for following commands unless sudo is provided to function.
'''
super().__init__()
super(OciImage, self).__init__()

# Will typically be None, unless used outside of Client
self.container_id = container_id
Expand Down
Loading