Skip to content

Commit

Permalink
Merge pull request #62 from sciris/develop
Browse files Browse the repository at this point in the history
Implement auto deploy
  • Loading branch information
RomeshA committed Jul 1, 2019
2 parents aec8996 + 631e507 commit 94dc6c7
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 12 deletions.
28 changes: 24 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
sudo: required
dist: xenial
python:
- "2.7"
- "3.7"
sudo: required
language: python
python:
- '2.7'
- '3.7'

install: pip install tox-travis
script: tox
stages:
- test
- name: deploy
if: branch = master
jobs:
include:
- stage: deploy
python: 3.7
install: skip
script: skip
if: NOT type = pull_request
deploy:
provider: pypi
distributions: sdist bdist_wheel
user: sciris
password:
secure: hDzhg+/SQrIPo/3F55yLhljIbUickIpfDwx5pkQC0Q/gFrOh6MPqKKJkI+0HUio5REAOosN+4cn54zFuIY6jl1a+yzXpV0sb+TiMCJvScowSbCACZK7fa8hSlQLQ3FQzCNDVyXc2CDUQyaBlNWD1U2U1yPt9s8h1vX5WQ5kdJS1dO8Bbi2yEjyB++4zxXBKUSmcb9XYPDe/Eiq979ctg6A/t8E+p64vcL6EiZ9l782FOYsynKRpJYEG9XqHYxhiAu9z5oNfEY2o5iaSNPQ5mFqAtLA6QEIQP7g2ogbHEAg+Mgd3zn6FnUiCfbBwc066fwaifda3AGqWmCa+Po3Lc0ON/kL7LJnm7DFpRxbA02C/vSpYaDGiw5DoEXAqmPeuT6cF7dn915bpkAltjWgEiUW+T9yh7GSXZKlCFdPB8OdZEN3+fD2zp+NcaXG/qO0Gjv4xed4X3IbysiISO1ICb1pVKh/rnoPvMBacQeEQqY7y06mlc5rtUhEpzN4o3A+FoqLicRxc9H7EV8dzKHCl3XHz+Mp5c+++x4iHT0z66Da1TmOsAqDGpkunbWej/RUDlnlmXKMRP0Uiuoly1YyxnInz4Nd7spsGfw4vJO9xt8nHFd5L1o2gfTbydHBkjTYhpIVqqFrNgcqVvAqg+hhV4e2zLsfyZbUILq48MaDF8AHI=
on:
repo: sciris/sciris
20 changes: 16 additions & 4 deletions sciris/sc_fileio.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,15 @@ def saveobj(filename=None, obj=None, compresslevel=5, verbose=0, folder=None, me
myobj = ['this', 'is', 'a', 'weird', {'object':44}]
saveobj('myfile.obj', myobj)
'''
fullpath = makefilepath(filename=filename, folder=folder, default='default.obj', sanitize=True)
with GzipFile(fullpath, 'wb', compresslevel=compresslevel) as fileobj:


if filename is None:
bytesobj = io.BytesIO()
else:
filename = makefilepath(filename=filename, folder=folder, default='default.obj', sanitize=True)
bytesobj = None

with GzipFile(filename=filename, fileobj=bytesobj, mode='wb', compresslevel=compresslevel) as fileobj:
if method == 'dill': # If dill is requested, use that
if verbose>=2: print('Saving as dill...')
savedill(fileobj, obj)
Expand All @@ -104,8 +111,13 @@ def saveobj(filename=None, obj=None, compresslevel=5, verbose=0, folder=None, me
if verbose>=2: print('Exception when saving as pickle (%s), saving as dill...' % repr(E))
savedill(fileobj, obj) # ...but use Dill if that fails

if verbose: print('Object saved to "%s"' % fullpath)
return fullpath
if verbose and filename: print('Object saved to "%s"' % filename)

if filename:
return filename
else:
bytesobj.seek(0)
return bytesobj


def dumpstr(obj=None):
Expand Down
8 changes: 6 additions & 2 deletions sciris/sc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1131,12 +1131,16 @@ def timedsleep(delay=None, verbose=True):

__all__ += ['percentcomplete', 'checkmem', 'runcommand', 'gitinfo', 'compareversions', 'uniquename', 'importbyname']

def percentcomplete(step=None, maxsteps=None, indent=1):
def percentcomplete(step=None, maxsteps=None, prefix=None):
''' Display progress '''
if prefix is None:
prefix = ' '
elif isnumber(prefix):
prefix = ' '*prefix
onepercent = max(1,round(maxsteps/100)); # Calculate how big a single step is -- not smaller than 1
if not step%onepercent: # Does this value lie on a percent
thispercent = round(step/maxsteps*100) # Calculate what percent it is
print('%s%i%%\n'% (' '*indent, thispercent)) # Display the output
print(prefix + '%i%%'% thispercent) # Display the output
return None


Expand Down
4 changes: 2 additions & 2 deletions sciris/sc_version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__all__ = ['__version__', '__versiondate__', '__license__']

__version__ = '0.13.10'
__versiondate__ = '2019-06-25'
__version__ = '0.13.12'
__versiondate__ = '2019-07-01'
__license__ = 'Sciris %s (%s) -- (c) Sciris.org' % (__version__, __versiondate__)

0 comments on commit 94dc6c7

Please sign in to comment.