diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5dce8103045f89546a2eab8db496013d2705e08d..cb95938bcd7d804ac13885a68c6a32f9c617b03b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,6 +18,9 @@ before_script: # Install jutil via secure ssh connection: - pip install git+ssh://gitlab@iffgit.fz-juelich.de/unger/jutil.git + ## Used for + #- pip install pytest pytest-cov + stages: - test @@ -27,5 +30,9 @@ test: # TODO: Different jobs with custom develop arguments? extra_requires (hyperspy, plotting)? # TODO: Use pip install -e .[hyperspy], etc. # Install requirements (-e: editable, like python setup.py develop, but pip, not easy_install): - - pip install -e . # TODO: belongs here or before_script? + - pip install -e .['tests'] # Also installs everything for tests! - python setup.py test + - coverage html + artifacts: + paths: + - htmlcov/ diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000000000000000000000000000000000000..c45b555358a8976c4766153918f08c856dd7ecba --- /dev/null +++ b/environment.yml @@ -0,0 +1,7 @@ +name: pyramid +dependencies: +- python=3.5 +- numpy +- pip +- pip: + - pypi-package-name diff --git a/pyramid/file_io/io_vectordata.py b/pyramid/file_io/io_vectordata.py index 6083f2068a4cb13e4a8b5c74cf08ba06e1e5a3a0..9fec4da4b575bf1a7a54daa591b70df77101826a 100644 --- a/pyramid/file_io/io_vectordata.py +++ b/pyramid/file_io/io_vectordata.py @@ -155,7 +155,7 @@ def _load_from_ovf(filename, a): field = np.asarray((x_mag, y_mag, z_mag)) * float(header.get('valuemultiplier', 1)) if a is None: # TODO: If transferred to HyperSpy, this has to stay in Pyramid reader! - if header.get('xstepsize') == header.get('ystepsize') == header.get('zstepsize'): + if not header.get('xstepsize') == header.get('ystepsize') == header.get('zstepsize'): _log.warning('Grid spacing is not equal in x, y and z (x will be used)!') a = float(header.get('xstepsize', 1.)) meshunit = header.get('meshunit', 'nm') diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6e1198b1ab1f5a7f19c6f1fc2ba7338438cf718 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +-e . diff --git a/setup.cfg b/setup.cfg index 45889554d66f37f1e175c0c4df5447685e22a6fc..800d7c28c7363803630aaec51c3590f2ddba41fc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -36,7 +36,7 @@ omit = [tool:pytest] addopts = --cov --flake8 -flake8-max-line-length = 120 +flake8-max-line-length = 100 flake8-ignore = ALL # TODO: PEP8 deactivated by this line (remove at a later point)! E402 E124 E125 diff --git a/setup.py b/setup.py index e571acfd97733d8f19244783dfcbad82eccf1e89..d36cd3180ea464283fb5b4edf603bc3a352c1503 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ import subprocess import sys from distutils.command.build import build -import numpy +#import numpy from setuptools import setup, find_packages @@ -19,8 +19,8 @@ MAINTAINER_EMAIL = 'j.caron@fz-juelich.de' URL = '' VERSION = '0.1.0-dev' PYTHON_VERSION = (2, 7) -DEPENDENCIES = {'numpy': (1, 10)} -LONG_DESCRIPTION = 'long description (TODO!)' # TODO: Long description! +DEPENDENCIES = {'numpy': (1, 10)} # TODO: get rid off!!! +LONG_DESCRIPTION = 'long description (TODO!)' # TODO: Long description! put in (Readme?) file! def get_package_version(package): @@ -126,6 +126,15 @@ def get_files(rootdir): return filepaths +# TODO: extend extras_require for plotting and IO: +extras_require = { + # TODO: Test all if really needed! don't use nose, if possible (pure pytest)! + "tests": ['pytest', 'pytest-runner', 'pytest-cov', 'pytest-flake8', 'coverage', 'nose'] + # TODO: more for mayavi (plotting in general) and hyperspy, etc (see below)... +} + + + print('\n-------------------------------------------------------------------------------') print('checking requirements') check_requirements() @@ -140,17 +149,17 @@ setup(name=DISTNAME, download_url=URL, version=VERSION, packages=find_packages(exclude=['tests', 'doc']), - include_dirs=[numpy.get_include()], + #include_dirs=[numpy.get_include()], # TODO: Use requirements.txt? extras_require for optional stuff (hyperspy, plotting)? # TODO: After split of Pyramid, comment out and see what really is used (is e.g. scipy?)! - # - pip install numpy scipy nose h5py matplotlib Pillow scikit-image cmocean hyperspy - setup_requires=['numpy>=1.6', 'pytest-runner', 'pytest'], - tests_require=['nose', 'pytest-cov', 'pytest-flake8', 'coverage'], + #setup_requires=['numpy>=1.6', 'pytest', 'pytest-runner'], + #tests_require=['pytest', 'pytest-cov', 'pytest-flake8'], install_requires=['numpy>=1.6', 'tqdm', 'scipy', 'matplotlib', 'Pillow', 'h5py', 'hyperspy', 'jutil', 'cmocean'], + extras_require=extras_require, # TODO: extra: 'pyfftw', 'mayavi' (not easy to install... find a way!) # TODO: See https://stackoverflow.com/a/28842733 for extras_require... # TODO: ...replace [dev] with [IO] (hyperspy) and [plotting] (separate plotting library)! - test_suite='nose.collector', + #test_suite='nose.collector', # TODO: don't use nose! cmdclass={'build': build}) print('-------------------------------------------------------------------------------\n')