From 0619f090a6311f94b42878bab7af2c9d8a83700e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Fredrik=20Ki=C3=A6r?= <31612826+anders-kiaer@users.noreply.github.com> Date: Mon, 30 Mar 2020 14:18:12 +0200 Subject: [PATCH] Cleanup of setup.py (#119) --- .travis.yml | 10 ++++--- requirements.txt | 7 ----- requirements_dev.txt | 19 ------------- setup.py | 63 ++++++++++++++++++++++---------------------- 4 files changed, 37 insertions(+), 62 deletions(-) delete mode 100644 requirements.txt delete mode 100644 requirements_dev.txt diff --git a/.travis.yml b/.travis.yml index 0bdb1350..c1297b4e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,15 +21,17 @@ before_install: install: - ls - - pip install -r requirements_dev.txt - pip install . + - pip install .[tests] script: - python -c "import fmu.ensemble" - - python setup.py test - - pip install pyarrow - - pytest -s tests/test_virtualensemble.py + - pytest tests/ + - pip install .[parquet] + - pytest tests/test_virtualensemble.py + - sphinx-apidoc -H "API for fmu.ensemble" -o ./docs ./src/fmu - python setup.py build_sphinx + - touch build/sphinx/html/.nojekyll deploy: - provider: pages diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 5bd7fac3..00000000 --- a/requirements.txt +++ /dev/null @@ -1,7 +0,0 @@ -libecl -numpy -pandas>0.23.0 -pylint -pyyaml>=5.1 -six>=1.12.0 -wheel>=0.29.0 diff --git a/requirements_dev.txt b/requirements_dev.txt deleted file mode 100644 index 07e230a4..00000000 --- a/requirements_dev.txt +++ /dev/null @@ -1,19 +0,0 @@ -astroid -bumpversion>=0.5.3 -coverage>=4.1 -flake8>=2.6.0 -pandas>0.23.0 -pip>=18.0.0 -pyarrow -pylint -pytest-runner>=2.11.1 -pytest>=2.9.2 -pyyaml>=5.1 -setuptools -setuptools_scm -six>=1.12.0 -sphinx>=1.4.8 -sphinx_rtd_theme>=0.4.1 -tox>=2.3.1 -versioneer==0.18 -wheel>=0.29.0 diff --git a/setup.py b/setup.py index e1089ea0..f08fe0a3 100644 --- a/setup.py +++ b/setup.py @@ -2,13 +2,16 @@ # -*- coding: utf-8 -*- """The setup script.""" -from glob import glob -import os -from os.path import basename -from os.path import splitext - from setuptools import setup, find_packages -from sphinx.setup_command import BuildDoc + +try: + from sphinx.setup_command import BuildDoc + + cmdclass = {"build_sphinx": BuildDoc} +except ImportError: + # sphinx not installed - do not provide build_sphinx cmd + cmdclass = {} + with open("README.rst") as readme_file: readme = readme_file.read() @@ -16,51 +19,45 @@ with open("HISTORY.rst") as history_file: history = history_file.read() +REQUIREMENTS = [ + "libecl", + "numpy", + "pandas>0.23.0", + "pyyaml>=5.1", + "six>=1.12.0", +] -def relpath(*args): - """Return path of args relative to this file""" - root = os.path.dirname(__file__) - if isinstance(args, str): - return os.path.join(root, args) - return os.path.join(root, *args) - - -def parse_requirements(filename): - """Load requirements from a pip requirements file""" - try: - lineiter = (line.strip() for line in open(filename)) - return [line for line in lineiter if line and not line.startswith("#")] - except IOError: - return [] - - -REQUIREMENTS = parse_requirements("requirements.txt") - -SETUP_REQUIREMENTS = ["pytest-runner", "setuptools>=28", "setuptools_scm"] +SETUP_REQUIREMENTS = ["setuptools>=28", "setuptools_scm"] -TEST_REQUIREMENTS = parse_requirements("requirements_dev.txt") +TEST_REQUIREMENTS = [ + "flake8>=2.6.0", + "pylint", + "pytest>=2.9.2", + "pyyaml>=5.1", + "sphinx>=1.4.8", + "sphinx_rtd_theme>=0.4.1", +] -EXTRAS_REQUIRE = {"Parquet": ["pyarrow"]} +EXTRAS_REQUIRE = {"tests": TEST_REQUIREMENTS, "parquet": ["pyarrow"]} setup( name="fmu-ensemble", use_scm_version={"write_to": "src/fmu/ensemble/version.py"}, - cmdclass={"build_sphinx": BuildDoc}, + cmdclass=cmdclass, description="Python API to ensembles produced by ERT", long_description=readme + "\n\n" + history, author="HÃ¥vard Berland", author_email="havb@equinor.com", - url="https://git.equinor.com/equinor/fmu-ensemble", + url="https://github.com/equinor/fmu-ensemble", license="GPLv3", packages=find_packages("src"), package_dir={"": "src"}, - py_modules=[splitext(basename(path))[0] for path in glob("src/*.py")], include_package_data=True, install_requires=REQUIREMENTS, zip_safe=False, keywords="fmu, ensemble", classifiers=[ - "Development Status :: 2 - Pre-Alpha", + "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Natural Language :: English", "Programming Language :: Python :: 2", @@ -68,6 +65,8 @@ def parse_requirements(filename): "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", ], test_suite="tests", tests_require=TEST_REQUIREMENTS,