From 618b728d261a7e335b3959960e487d38d33e45fa Mon Sep 17 00:00:00 2001 From: Jan Caron <j.caron@fz-juelich.de> Date: Sun, 16 Jul 2017 15:43:25 +0200 Subject: [PATCH] Small changes to deployment files. Added environment.yml and requirement.txt. GitLab should now produce html coverage artifacts. io_vectordata: now warns if grid spacing is not equal in all directions. --- .gitlab-ci.yml | 9 ++++++++- environment.yml | 7 +++++++ pyramid/file_io/io_vectordata.py | 2 +- requirements.txt | 1 + setup.cfg | 2 +- setup.py | 25 +++++++++++++++++-------- 6 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 environment.yml create mode 100644 requirements.txt diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5dce810..cb95938 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 0000000..c45b555 --- /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 6083f20..9fec4da 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 0000000..d6e1198 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +-e . diff --git a/setup.cfg b/setup.cfg index 4588955..800d7c2 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 e571acf..d36cd31 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') -- GitLab