Permalink
Browse files

Make firtst attempt for travis

  • Loading branch information...
hombit committed Oct 12, 2017
1 parent 00d7ddd commit 6ed6c01cbfb5db132bf87a0fd381668139bbd880
@@ -0,0 +1,10 @@
language: python
cache: pip

python:
- "3.6"
install:
- pip install -f requirements.txt
- python setup.py -q install
script:
- sci_py_import_all
@@ -9,4 +9,4 @@ WORKDIR $PROJECT
COPY . $PROJECT
RUN python setup.py install

CMD ["python", "bin/example"]
CMD ["python", "bin/sci_py_example"]
File renamed without changes.
@@ -0,0 +1,20 @@
#!/usr/bin/env python3

from __future__ import division, print_function, unicode_literals

from importlib import import_module
from pkgutil import walk_packages

def import_modules_from_package(pkg):
for module_info in walk_packages(pkg.__path__):
module_name = '{}.{}'.format(pkg.__name__, module_info.name)
print('#'*80)
print(module_name)
print('#'*80)
module = import_module(module_name)
if module_info.ispkg:
import_modules_from_package(module)

import scientific_python
print(scientific_python.__path__)
import_modules_from_package(scientific_python)
@@ -0,0 +1 @@
numpy>=1.13
@@ -0,0 +1 @@
__all__ = ('basics', 'sequences', 'strings')
@@ -77,6 +77,8 @@ def my_simple_function():
# Here lower() makes all characters have a lower case. Similarly upper() works.
# One more method of these family is capitalize() that makes the first
# character have upper case and other characters have lower case.
# str has a lot of methods, use them all instead of write your own code:
# https://docs.python.org/3/library/stdtypes.html#string-methods

## Raw strings ##

@@ -144,5 +146,8 @@ def my_simple_function():
# because on Python prior 3.6 using of this prefix produces syntax error.
from sys import version_info
if version_info >= (3, 6):
from strings_f_prefix import f_prefix
if __package__:
from .strings_f_prefix import f_prefix
else:
from strings_f_prefix import f_prefix
f_prefix()
@@ -2,17 +2,29 @@

from __future__ import division, print_function, unicode_literals

# Read simple_module.py first.
# If this file is used as stand-alone module or script its __package__ variable
# is None or empty string then import can be produced as usual. If the file is
# used as package module, then we should use relative import.

import simple_module as sm
# Read simple_module.py first.
if __package__:
from . import simple_module as sm
else:
import simple_module as sm
# Print from simple_module is executed!
# First time import executes module, play with "import antigravity".

# imports only hello and default_name as described by `__all__`
from simple_module import *
if __package__:
from .simple_module import *
else:
from simple_module import *
# Print isn't executed one more time.

from simple_module import goodbye as good_bye
if __package__:
from .simple_module import goodbye as good_bye
else:
from simple_module import goodbye as good_bye
# Print is silent again.

assert sm.hello(name='Joe') == 'Hello Joe'
@@ -188,11 +188,11 @@
assert b.flags.owndata
assert np.issubdtype(b.dtype, np.float)
c = a[:] # a view on all elements of `a`
assert_array_equal(a, b, c)
assert_array_equal(b, c)
assert not c.flags.owndata
d = a # another variable that holds the same object as a
assert a is d
assert_array_equal(a, b, c, d)
assert_array_equal(c, d)
# all attributes of `d` is the same as for `a`, remember that they are the same
# object:
assert d.flags.owndata
@@ -202,7 +202,8 @@
b = a
a += 1
assert a is b # `a` still is the same object, compare with tuple/str behaviour
assert_array_equal(a, b, np.arange(1, 11))
assert_array_equal(a, b)
assert_array_equal(b, np.arange(1, 11))

# But "+", "-", "*", etc create new objects:
a = np.arange(10)
@@ -217,7 +218,8 @@
b = a
a[:] = 1
assert a is b
assert_array_equal(a, b, 1)
assert_array_equal(a, b)
assert_array_equal(b, 1)

a = np.ones(10)
a[::2] = 0
@@ -277,7 +279,7 @@ def plusone_bench(a):
assert_array_equal(a, a_copy) # original array hasn't changed
# But indexing arrays can be used to change elements in-place:
a[index] += 1
assert not np.all(a, a_copy) # a has been changed
assert not np.all(a == a_copy) # a has been changed
# If indexing array has duplicate index then this index is changed only once
a = np.zeros(2)
a[[0,0,0,0]] += 1
@@ -2,21 +2,21 @@

from __future__ import division, print_function, unicode_literals

from setuptools import setup
# from pip.req import parse_requirements
from setuptools import find_packages, setup
from pip.req import parse_requirements


setup(
name='scientific_python',
version='0.0.0',
version='0.0.1',
url='https://xray.sai.msu.ru/~malanchev/',
license='MIT',
author='Konstantin Malanchev',
author_email='malanchev@physics.msu.ru',
description='Package with materials for Scientific Python course for astronomers in Moscow University',
packages=['scientific_python'],
# install_reqs=parse_requirements('requirements.txt', session='hack'),
scripts=['bin/example'],
packages=find_packages(),
install_reqs=parse_requirements('requirements.txt', session='hack'),
scripts=['bin/sci_py_example', 'bin/sci_py_import_all'],
package_data={
'scientific_python': ['misc', 'doc'],
},
@@ -17,4 +17,5 @@ if [ "${PYTHON_PATH/$ENV}" = "${PYTHON_PATH}" ]; then
echo "Activation failed"
else
python setup.py install
pip install -r requirements.txt
fi

0 comments on commit 6ed6c01

Please sign in to comment.