From 458911ebfbc8fe74807279223ecb436ff8ff80b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaman=20G=C3=BC=C3=A7l=C3=BC?= Date: Fri, 30 Aug 2019 18:31:19 +0200 Subject: [PATCH] Clean up installation procedure with pip (#4) * Move dependencies list from 'requirements.txt' to 'setup.py'. * Move library version to separate file. NOTE: gelato now provides version to user: In [1]: import gelato; gelato.__version__ Out[1]: '0.9.3' * Enable tests with Python-3.7. * Update __version__ --- .travis.yml | 11 +++++++---- gelato/__init__.py | 1 + gelato/version.py | 1 + requirements.txt | 11 ----------- setup.py | 31 ++++++++++++++++++++++++------- 5 files changed, 33 insertions(+), 22 deletions(-) create mode 100644 gelato/version.py delete mode 100644 requirements.txt diff --git a/.travis.yml b/.travis.yml index ae96a8d..e02105d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,17 +6,20 @@ python: - "3.5" - "3.6" +# Enable 3.7 without globally enabling 'dist: xenial' for other build jobs +matrix: + include: + - python: 3.7 + dist: xenial + # Cache directory $HOME/.cache/pip cache: pip # command before installation: install all dependencies and run CMAKE config before_install: - python -m pip install --upgrade pip - - python -m pip install -r requirements.txt - python -m pip uninstall -y sympde - - wget https://raw.githubusercontent.com/pyccel/sympde/master/requirements.txt -O requirements_sympde.txt - - python -m pip install -r requirements_sympde.txt - - python -m pip install git+https://github.com/pyccel/sympde@master + - python -m pip uninstall -y gelato # command to install project install: diff --git a/gelato/__init__.py b/gelato/__init__.py index 3148e7d..aca2cd5 100644 --- a/gelato/__init__.py +++ b/gelato/__init__.py @@ -1,4 +1,5 @@ # -*- coding: UTF-8 -*- +from .version import __version__ from .expr import * from .glt import * from .printing import * diff --git a/gelato/version.py b/gelato/version.py new file mode 100644 index 0000000..4033697 --- /dev/null +++ b/gelato/version.py @@ -0,0 +1 @@ +__version__ = '0.9.4' diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index bb255c7..0000000 --- a/requirements.txt +++ /dev/null @@ -1,11 +0,0 @@ -sympy==1.2 -numpy>=1.13, <1.16 -scipy>=0.18 -matplotlib -sympde - -# sympde dependencies -h5py -pytest -pyyaml -yamlloader diff --git a/setup.py b/setup.py index 97fbd4f..dc21913 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,17 @@ # -*- coding: UTF-8 -*- #! /usr/bin/python -import sys +from pathlib import Path from setuptools import setup, find_packages +# ... +# Read library version into '__version__' variable +path = Path(__file__).parent / 'gelato' / 'version.py' +exec(path.read_text()) +# ... + NAME = 'gelato' -VERSION = '0.9.3' +VERSION = __version__ AUTHOR = 'Ahmed Ratnani' EMAIL = 'ahmed.ratnani@ipp.mpg.de' URL = 'https://github.com/ratnania/GeLaTo' @@ -26,17 +32,28 @@ # download_url = URL+'/tarball/master', ) +install_requires = [ + + # Third-party libraries from PyPi + 'sympy>=1.2', + 'numpy>=1.13', + 'scipy>=0.18', + 'matplotlib', + + # Our libraries from PyPi + 'sympde', +] + # ... packages = find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]) # ... def setup_package(): - if 'setuptools' in sys.modules: - setup_args['install_requires'] = ['numpy'] - setup(packages = packages, \ - include_package_data = True, \ - zip_safe=True, \ + setup(packages = packages, + include_package_data = True, + install_requires = install_requires, + zip_safe = True, **setup_args)