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
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)
- adding test for entrypoint + cmd and fixing testing requirements (0.0.66)
- fixing bug that inspect does not honor quiet (0.0.65)
- refactor recipe parsers, writers, and base (0.0.64)
- paths for files, add, copy, will not be expanded as it adds hardcoded paths
Expand Down
29 changes: 14 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,26 @@


from setuptools import setup, find_packages
import codecs
import os

##########################################################################################
# HELPER FUNCTIONS #######################################################################
##########################################################################################
################################################################################
# HELPER FUNCTIONS #############################################################
################################################################################

def get_lookup():
'''get version by way of singularity.version, returns a
lookup dictionary with several global variables without
needing to import singularity
lookup dictionary with several global variables without
needing to import spython
'''
lookup = dict()
version_file = os.path.join('spython', 'version.py')
with open(version_file) as filey:
exec(filey.read(), lookup)
return lookup

# Read in requirements
def get_requirements(lookup=None):
'''get_requirements reads in requirements and versions from
the lookup obtained with get_lookup'''
the lookup obtained with get_lookup'''

if lookup is None:
lookup = get_lookup()
Expand All @@ -41,12 +39,12 @@ def get_requirements(lookup=None):
module_name = module[0]
module_meta = module[1]
if "exact_version" in module_meta:
dependency = "%s==%s" %(module_name,module_meta['exact_version'])
dependency = "%s==%s" % (module_name, module_meta['exact_version'])
elif "min_version" in module_meta:
if module_meta['min_version'] is None:
dependency = module_name
else:
dependency = "%s>=%s" %(module_name,module_meta['min_version'])
dependency = "%s>=%s" % (module_name, module_meta['min_version'])
install_requires.append(dependency)
return install_requires

Expand All @@ -66,8 +64,8 @@ def get_requirements(lookup=None):
KEYWORDS = lookup['KEYWORDS']
DESCRIPTION = lookup['DESCRIPTION']
LICENSE = lookup['LICENSE']
with open('README.md') as filey:
LONG_DESCRIPTION = filey.read()
with open('README.md') as readme:
LONG_DESCRIPTION = readme.read()

##########################################################################################
# MAIN ###################################################################################
Expand All @@ -77,6 +75,7 @@ def get_requirements(lookup=None):
if __name__ == "__main__":

INSTALL_REQUIRES = get_requirements(lookup)
TESTS_REQUIRES = get_requirements(lookup)

setup(name=NAME,
version=VERSION,
Expand All @@ -94,8 +93,8 @@ def get_requirements(lookup=None):
long_description_content_type="text/markdown",
keywords=KEYWORDS,
setup_requires=["pytest-runner"],
tests_require=["pytest"],
install_requires = INSTALL_REQUIRES,
tests_require=TESTS_REQUIRES,
install_requires=INSTALL_REQUIRES,
classifiers=[
'Intended Audience :: Science/Research',
'Intended Audience :: Developers',
Expand All @@ -107,4 +106,4 @@ def get_requirements(lookup=None):
'Programming Language :: Python :: 3',
],

entry_points = {'console_scripts': [ 'spython=spython.client:main' ] })
entry_points={'console_scripts': ['spython=spython.client:main']})
6 changes: 6 additions & 0 deletions spython/tests/testdata/docker2singularity/entrypoint-cmd.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bootstrap: docker
From: busybox:latest
%runscript
exec python /code/script.py "$@"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an inexact translation of the Dockerfile. See #111 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes but this is what works and is expected for Singularity. You don't see users writing /bin/bash -c "..." as this is handled internally in Singularity.

Copy link
Contributor

Choose a reason for hiding this comment

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

Completely missing the point. docker run entrypoint-cmd --foo does a python --foo not a python /code/script.py --foo

Copy link
Member Author

Choose a reason for hiding this comment

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

It will need to be fixed then.

%startscript
exec python /code/script.py "$@"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM busybox:latest
CMD ["/code/script.py"]
ENTRYPOINT ["python"]
8 changes: 7 additions & 1 deletion spython/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.


__version__ = "0.0.65"
__version__ = "0.0.66"
AUTHOR = 'Vanessa Sochat'
AUTHOR_EMAIL = 'vsochat@stanford.edu'
NAME = 'spython'
Expand All @@ -18,3 +18,9 @@
INSTALL_REQUIRES = (
('semver', {'min_version': '2.8.0'}),
)

TESTS_REQUIRES = (
('pytest', {'min_version': '4.6.2'}),
Copy link
Contributor

Choose a reason for hiding this comment

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

Something like 4.0.0 should already be enough

('pytest-cov', {'min_version': '2.5.1'}),
Copy link
Contributor

Choose a reason for hiding this comment

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

Should not be required
But will be needed on CI if coverage is added

Copy link
Member Author

Choose a reason for hiding this comment

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

So thinking ahead! Without realizing it :)

('pytest-fixtures', {'min_version': '0.1.0'}),
Copy link
Contributor

Choose a reason for hiding this comment

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

Not required

)