From 9251f9fafa6309b7463b715ff531b23fb3b1f4fe Mon Sep 17 00:00:00 2001 From: Chris B Date: Sat, 9 Jun 2018 11:00:41 +0100 Subject: [PATCH 01/24] (WIP) Switch to pyctdev, including: * use autover * add examples command * WIP simplifying setup.py with a build time dep (as per pyviz plan) * clean up packaging and testing (and test the packages) --- .appveyor.yml | 21 +++-- .travis.yml | 151 +++++++++++++++++++++------------ MANIFEST.in | 8 ++ _pyct_setup_support.py | 123 +++++++++++++++++++++++++++ conda.recipe/meta.yaml | 32 +++++-- dodo.py | 49 ++--------- parambokeh/__init__.py | 22 ++++- parambokeh/__main__.py | 12 +++ parambokeh/tests/__init__.py | 0 parambokeh/tests/test_dummy.py | 3 + pyproject.toml | 5 ++ setup.cfg | 3 - setup.py | 84 ++++++++++++++---- tox.ini | 64 ++++++++++++++ 14 files changed, 438 insertions(+), 139 deletions(-) create mode 100644 MANIFEST.in create mode 100644 _pyct_setup_support.py create mode 100644 parambokeh/__main__.py create mode 100644 parambokeh/tests/__init__.py create mode 100644 parambokeh/tests/test_dummy.py create mode 100644 pyproject.toml delete mode 100644 setup.cfg create mode 100644 tox.ini diff --git a/.appveyor.yml b/.appveyor.yml index 26c0d17..b058e25 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,22 +1,21 @@ environment: + global: + CHANNELS: "-c pyviz/label/dev" matrix: - - PY: "3.6" - CONDA: "C:\\Miniconda3-x64" - DOIT: "doit" - PY: "2.7" CONDA: "C:\\Miniconda-x64" - DOIT: "doit==0.29.0" + - PY: "3.6" + CONDA: "C:\\Miniconda36-x64" install: - "SET PATH=%CONDA%;%CONDA%\\Scripts;%PATH%" - - pip install %DOIT% ioamdoit - - doit create_env --python=%PY% - - activate test-environment - - doit install_test_dependencies - - doit capture_conda_env - - doit develop_install + - "conda install -y -c pyviz/label/dev pyctdev && doit ecosystem_setup" + - "doit env_create %CHANNELS% --name=test --python=%PY%" + - "activate test" + - "doit develop_install %CHANNELS%" + - "doit env_capture" build: off test_script: - - doit all_tests + - "doit test_all" diff --git a/.travis.yml b/.travis.yml index 1cd57a9..df2f454 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,55 +10,112 @@ sudo: false env: global: - secure: qDzvmjcR6eLAmHx0ziN3Y5M8h65+OM+eBNERQsC3WSkeaD45rEE6a8w59dBdUzZBTLKO2RP8pKlgzxBZGOBlnLbTyN4RD/q2dA+gm5c0SDWWT4kVCiogJVsrzyRHVgMDmqDu56HPbQzhsW+5Qh2JKjVkkI7GwvGZRFB9WKQC8yjW/RfLvQ7bzX6jXbaHDYg9dywjI5u7da7HZKXyt/6nhebdaI19RdQHuESUqTADFEgdCKdzrNC+NqbJ8SUnNBBmkb1ZqoQ3/p1/Z/+uDi/2ThozE7Lz6gl8HtxVRnBiwNCDvZRE8uTB79+FlW0FJCVZ7qGO8jVWlVqy+WEEFh/6s9RP2PLd73CmItfF7BzSdxdurOYfnizboqCideSasDQK7XdeDiX4fPrgqbeesn8+XJ9vhxRAmpsNdZIU+2pivgviJwUZUwKwgzt3hf23ld9GpJg60wCfQRT8hiZc3/XsUPrzDjci7hwrRESqobPcuWk6xsFPTvJsTeOSLejP1wDOGAhufLTQIys26BSwHiaj6aI4RPK3Y4sy644m4IOfVvi3d+YfyN2Q5NO7QIwk5PjQBUEdwcIi3lAk2eAIjJamlDYFCRrnwuEoFinuFlUjtqpkuVTLgonTbk9KkIYnXeP3wYERrt4uOJtxDRCojBC0FI5rDbkhC3wP8Wef4EToQ+s= + - PYENV_VERSION=3.6 + - CHANS_DEV="-c pyviz/label/dev" + - CHANS_REL="-c pyviz" + - PKG_TEST_PYTHON="--test-python=py27 --test-python=py36" + - PYPI="https://upload.pypi.org/legacy/" + +cache: + directories: + - $HOME/miniconda + +before_cache: + - rm -rf $HOME/miniconda/pkgs + - rm -rf $HOME/miniconda/conda-bld/* + - rm -rf $HOME/miniconda/envs/*/conda-bld + +# quick hack to determine what tag is (improvements welcomed) +# release: ^v(\d+|\.)*[^a-z]\d*$ +# dev release: ^v(\d+|\.)*[a-z]\d*$ stages: - test - - doc - - name: anaconda_deploy - if: branch = master AND type != pull_request + - name: conda_dev_package + if: branch = switch_to_pyctdev +## if: tag =~ ^v(\d+|\.)*[a-z]\d*$ +# - name: pip_dev_package +## if: branch = switch_to_pyctdev +# if: tag =~ ^v(\d+|\.)*[a-z]\d*$ +# - name: conda_package +# if: tag =~ ^v(\d+|\.)*[^a-z]\d*$ +# - name: pip_package +# if: tag =~ ^v(\d+|\.)*[^a-z]\d*$ +# - name: docs +# if: tag =~ ^v(\d+|\.).*$ + jobs: include: - - &default + + ########## DEVELOPER INSTALL ########## + + - &conda_default stage: test - env: PYTHON_VERSION="2.7" + env: DESC="dev test_all" before_install: - ####################### - ## install miniconda ## - - easy_install --user doit==0.29.0 ioamdoit - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - ~/Library/Python/2.7/bin/doit install_miniconda; - else - ~/.local/bin/doit install_miniconda; - fi - - rm -f .doit.db - - export PATH="$HOME/miniconda/bin:$PATH" - ####################### - - pip install ioamdoit - - doit create_env --python=$PYTHON_VERSION + # install doit/pyctdev and use to install miniconda... + - pip install pyctdev && doit miniconda_install && pip uninstall -y doit pyctdev + - export PATH="$HOME/miniconda/bin:$PATH" && hash -r + - conda config --set always_yes True + # ...and now install doit/pyctdev into miniconda + - conda install -c pyviz/label/dev pyctdev && doit ecosystem_setup + install: + - doit env_create $CHANS_DEV --python=$PYENV_VERSION - source activate test-environment + - doit develop_install -o examples -o tests $CHANS_DEV + - doit env_capture + script: doit test_all - install: - - doit install_test_dependencies - - doit capture_conda_env - - doit develop_install - script: - - doit all_tests + # python 2 flake checking typically catches python 2 syntax + # errors where python 3's been assumed... + - <<: *conda_default + env: DESC="py2 flakes" PYENV_VERSION=2.7 + script: doit test_lint - - <<: *default - env: PYTHON_VERSION="3.6" + ########## END-USER PACKAGES ########## + + ## dev packages + + - &pip_default + env: PYPI="https://test.pypi.org/legacy/" TRAVIS_NOCACHE=$TRAVIS_JOB_ID + stage: pip_dev_package + before_install: pip install pyctdev && doit ecosystem=pip ecosystem_setup + install: + - unset PYENV_VERSION && pyenv global 3.6 2.7 + - doit ecosystem=pip package_build $PKG_TEST_PYTHON --test-group=unit + - doit ecosystem=pip package_build $PKG_TEST_PYTHON --test-group=all + script: doit ecosystem=pip package_upload -u $TPPU -p $TPPP -r ${PYPI} - - <<: *default - stage: doc - env: PYTHON_VERSION="3.6" + - <<: *conda_default + stage: conda_dev_package + env: DESC="" TRAVIS_NOCACHE=$TRAVIS_JOB_ID install: - # TODO: could (build and) use conda package; to be cleaned up - # once auto versioning/package building is finalized - - doit install_doc_dependencies - - doit capture_conda_env - - doit develop_install + - doit package_build $CHANS_DEV $PKG_TEST_PYTHON --test-group=unit + - doit package_test $CHANS_DEV $PKG_TEST_PYTHON --test-group=examples --test-requires=examples + script: doit package_upload --user=ceball --token=$CONDA_UPLOAD_TOKEN_TMP --label=dev + + ## release packages + + - <<: *pip_default + env: TRAVIS_NOCACHE=$TRAVIS_JOB_ID + stage: pip_package + script: doit ecosystem=pip package_upload -u $PPU -p $PPP -r ${PYPI} + + - <<: *conda_default + stage: conda_package + env: DESC="" TRAVIS_NOCACHE=$TRAVIS_JOB_ID + install: doit package_build $CHANS_REL $PKG_TEST_PYTHON --test-group=all + script: doit package_upload --token=$CONDA_UPLOAD_TOKEN_AGAIN --label=dev --label=main + + + ########## DOCS ########## + + - <<: *conda_default + stage: docs + env: DESC="docs" CHANS_DEV="-c pyviz/label/dev" script: + - doit develop_install $CHANS_DEV -o doc - doit docs deploy: - provider: pages @@ -66,26 +123,16 @@ jobs: github_token: $GITHUB_TOKEN fqdn: parambokeh.pyviz.org local_dir: ./doc/_build/html + repo: ioam-docs/parambokeh-dev on: - # TODO: depending on what we do for auto versioning/packaging, - # should make this deploy somewhere for PRs etc, and only to the - # main site on specific tag format. tags: true + all_branches: true + condition: $TRAVIS_TAG =~ [0-9]+[a-z][0-9]*$ - provider: pages skip_cleanup: true github_token: $GITHUB_TOKEN local_dir: ./doc/_build/html - repo: ioam-docs/parambokeh-master - - - <<: *default - stage: anaconda_deploy - env: PYTHON_VERSION="3.6" - install: - - source deactivate - - conda update -q -y conda - - conda install -q -y conda-build anaconda-client - script: - - export VERSIONHACK=$(python -c "import subprocess;desc=subprocess.check_output(['git','describe','--long']).decode('utf8');v,commits=desc.split('-')[0:2];newv=[int(x) for x in v[1::].split('.')];newv[-1]+=1;print('.'.join(str(x) for x in newv)+'.dev'+commits)") - - conda build conda.recipe/ - # only upload if package doesn't exist (as e.g. there are cron builds) - - anaconda show pyviz/param/$VERSIONHACK || anaconda --token $CONDA_UPLOAD_TOKEN_AGAIN upload --user pyviz --label dev $(conda build --output conda.recipe) + on: + tags: true + all_branches: true + condition: $TRAVIS_TAG =~ [0-9]+[^a-z][0-9]*$ diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..1e664fb --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,8 @@ +include LICENSE +include README.md +include parambokeh/.version +graft examples +graft parambokeh/examples +global-exclude *.py[co] +global-exclude *~ +global-exclude *.ipynb_checkpoints/* diff --git a/_pyct_setup_support.py b/_pyct_setup_support.py new file mode 100644 index 0000000..1b84313 --- /dev/null +++ b/_pyct_setup_support.py @@ -0,0 +1,123 @@ +# just dumping everything in here for now; will sort out later + +import os + +########## autover ########## + +def embed_version(basepath, ref='v0.2.2'): + """ + Autover is purely a build time dependency in all cases (conda and + pip) except for when you use pip's remote git support [git+url] as + 1) you need a dynamically changing version and 2) the environment + starts off clean with zero dependencies installed. + This function acts as a fallback to make Version available until + PEP518 is commonly supported by pip to express build dependencies. + """ + import io, zipfile, importlib + try: from urllib.request import urlopen + except: from urllib import urlopen + try: + url = 'https://github.com/ioam/autover/archive/{ref}.zip' + response = urlopen(url.format(ref=ref)) + zf = zipfile.ZipFile(io.BytesIO(response.read())) + ref = ref[1:] if ref.startswith('v') else ref + embed_version = zf.read('autover-{ref}/autover/version.py'.format(ref=ref)) + with open(os.path.join(basepath, 'version.py'), 'wb') as f: + f.write(embed_version) + return importlib.import_module("version") + except: + return None + +def get_setup_version(reponame): + """ + Helper to get the current version from either git describe or the + .version file (if available). + """ + import json + basepath = os.path.split(__file__)[0] + version_file_path = os.path.join(basepath, reponame, '.version') + try: + from param import version + except: + raise + version = embed_version(basepath) + if version is not None: + return version.Version.setup_version(basepath, reponame, archive_commit="$Format:%h$") + else: + print("WARNING: param>=1.6.0 unavailable. If you are installing a package, this warning can safely be ignored. If you are creating a package or otherwise operating in a git repository, you should install param>=1.6.0.") + return json.load(open(version_file_path, 'r'))['version_string'] + + +########## examples ########## + +import shutil + +def examples(path, root, verbose=False, force=False): + """ + Copies the notebooks to the supplied path. + """ + filepath = os.path.abspath(os.path.dirname(root)) + example_dir = os.path.join(filepath, './examples') + if not os.path.exists(example_dir): + example_dir = os.path.join(filepath, '../examples') + if os.path.exists(path): + if not force: + print('%s directory already exists, either delete it or set the force flag' % path) + return + shutil.rmtree(path) + ignore = shutil.ignore_patterns('.ipynb_checkpoints', '*.pyc', '*~') + tree_root = os.path.abspath(example_dir) + if os.path.isdir(tree_root): + shutil.copytree(tree_root, path, ignore=ignore, symlinks=True) + else: + print('Cannot find %s' % tree_root) + + + +def default_setup_args(): + + ########## setup.py "best practice" ########## + + args = { + 'include_package_data':True, + 'long_description_content_type':"text/markdown", + 'license':'BSD-3', + 'classifiers': [ + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent" + ] + } + + from setuptools import find_packages + args['packages'] = find_packages() + args['long_description']=open('README.md').read() + + # + could check manifest.in entries + + + + ########## common pyviz setup.py metadata ########## + + # would want to make this configurable. And moving it out of individual setup.py + # files might annoy people who are trying to read setup.py by eye + + AUTHOR = "pyviz" + AUTHOR_EMAIL = "holoviews@gmail.com" + PLATFORMS = ["Windows","MacOS","Linux"] + + args.update({ + 'author': AUTHOR, + 'author_email': AUTHOR_EMAIL, + 'maintainer': AUTHOR, + 'maintainer_email': AUTHOR_EMAIL, + 'platforms': PLATFORMS, + }) + + + return args + + +# TODO: seems like setuptools doesn't support all things that can be in PKG-INFO, +# like multiple URLs, so (for example) can't get link to github and homepage from pypi +# https://www.python.org/dev/peps/pep-0566/ https://packaging.python.org/specifications/core-metadata/#project-url-multiple-use . +# Should come with pyproject/switching to different build system e.g. flit diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index 4e45072..3f58835 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -1,6 +1,8 @@ +{% set sdata = load_setup_py_data() %} + package: name: parambokeh - version: {{ os.environ.get("VERSIONHACK") }} + version: {{ sdata['version'] }} source: path: .. @@ -8,21 +10,35 @@ source: build: noarch: python script: python setup.py install --single-version-externally-managed --record=record.txt + entry_points: + {% for group,epoints in sdata.get("entry_points",{}).items() %} + {% for entry_point in epoints %} + - {{ entry_point }} + {% endfor %} + {% endfor %} requirements: build: + # duplicates pyproject.toml (not supported in conda build) - python - run: - - python + - setuptools - param - - pyviz_comms - - bokeh >=0.12.10 + run: + - python {{ sdata['python_requires'] }} + {% for dep in sdata.get('install_requires',{}) %} + - {{ dep }} + {% endfor %} test: imports: - parambokeh + requires: + {% for dep in sdata['extras_require']['tests'] %} + - {{ dep }} + {% endfor %} about: - home: https://github.com/ioam/parambokeh - summary: ParamBokeh provides an easy way to generate a UI for param based classes in the notebook or on bokeh server. - license: BSD 3-Clause + home: {{ sdata['url'] }} + summary: {{ sdata['description'] }} + license: {{ sdata['license'] }} + diff --git a/dodo.py b/dodo.py index 385a1b9..77d48df 100644 --- a/dodo.py +++ b/dodo.py @@ -1,51 +1,14 @@ -DOIT_CONFIG = {'verbosity': 2} +import os +if "PYCTDEV_ECOSYSTEM" not in os.environ: + os.environ["PYCTDEV_ECOSYSTEM"] = "conda" -from ioamdoit import * +from pyctdev import * # noqa: api -# The aim would be to not have anything much here, but right now -# that's not easy because of awkward installation/specification of -# dependencies across projects. - -def task_install_required_dependencies(): - return {'actions': ['conda install -y -q -c conda-forge -c pyviz param "bokeh>=0.12.10" pyviz_comms']} - -def task_install_test_dependencies(): - return { - 'actions': [ - 'conda install -y -q -c conda-forge "holoviews>=1.9.0" pandas notebook flake8 pyparsing pytest', - 'pip install pytest-nbsmoke'], - 'task_dep': ['install_required_dependencies'] - } - -def task_install_doc_dependencies(): - # would not need to exist if nbsite had conda package - return { - 'actions': [ - 'conda install -y -q -c conda-forge notebook ipython sphinx=1.6 beautifulsoup4 graphviz selenium phantomjs', - 'pip install https://github.com/pyviz/nbsite/archive/master.zip sphinx_ioam_theme'], - 'task_dep': ['install_test_dependencies'] - } - -def task_lint(): - return {'actions': ['flake8 --ignore E,W parambokeh']} - - -def task_lint_nb(): - return {'actions': ['pytest --nbsmoke-lint examples/']} - - -def task_test_nb(): - return {'actions': ['pytest --nbsmoke-run examples/']} - - -def task_all_tests(): - return {'actions': [], - 'task_dep': ['lint','lint_nb','test_nb']} +############################################################ +# Website building tasks; will move out to pyct def task_docs(): - # TODO: could do better than this, or nbsite could itself use doit - # (providing a dodo file for docs, or using doit internally). return {'actions': [ 'nbsite_nbpagebuild.py ioam parambokeh ./examples ./doc', 'sphinx-build -b html ./doc ./doc/_build/html', diff --git a/parambokeh/__init__.py b/parambokeh/__init__.py index cb1760c..53cc274 100644 --- a/parambokeh/__init__.py +++ b/parambokeh/__init__.py @@ -29,11 +29,25 @@ from .util import named_objs, get_method_owner from .view import _View + +__version__ = str(param.version.Version(fpath=__file__, archive_commit="$Format:%h$", + reponame="parambokeh")) + +## +# make pyct's example/data commands available if possible +from functools import partial try: - __version__ = param.Version(release=(0,2,1), fpath=__file__, - commit="$Format:%h$", reponame='parambokeh') -except: - __version__ = '0.2.1-unknown' + from pyct.cmd import copy_examples as _copy, fetch_data as _fetch, examples as _examples + copy_examples = partial(_copy, 'parambokeh') + fetch_data = partial(_fetch, 'parambokeh') + examples = partial(_examples, 'parambokeh') +except ImportError: + def _missing_cmd(*args,**kw): return("install pyct to enable this command (e.g. `conda install pyct` or `pip install pyct`)") + _copy = _fetch = _examples = _missing_cmd + def _err(): raise ValueError(_missing_cmd()) + fetch_data = copy_examples = examples = _err +del partial, _examples, _copy, _fetch +## def notebook_show(obj, doc, comm): diff --git a/parambokeh/__main__.py b/parambokeh/__main__.py new file mode 100644 index 0000000..6b79172 --- /dev/null +++ b/parambokeh/__main__.py @@ -0,0 +1,12 @@ +def main(args=None): + try: + import pyct.cmd + except ImportError: + import sys + from . import _missing_cmd + print(_missing_cmd()) + sys.exit(1) + return pyct.cmd.substitute_main('parambokeh',args=args) + +if __name__ == "__main__": + main() diff --git a/parambokeh/tests/__init__.py b/parambokeh/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/parambokeh/tests/test_dummy.py b/parambokeh/tests/test_dummy.py new file mode 100644 index 0000000..d1cd791 --- /dev/null +++ b/parambokeh/tests/test_dummy.py @@ -0,0 +1,3 @@ +def test_dummy(): + print(1) + pass diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..463973f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,5 @@ +[build-system] +requires = [ + "param >=1.6.1", + "setuptools" +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index fbb761a..0000000 --- a/setup.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[pytest] -# notebooks to skip running; one case insensitive re to match per line -skip_run = ^.*JSONInit\.ipynb$ diff --git a/setup.py b/setup.py index 0382013..2e747bf 100644 --- a/setup.py +++ b/setup.py @@ -1,35 +1,83 @@ -#!/usr/bin/env python import os import sys +import shutil + +from setuptools import setup + +# TODO: +# - release new nbsite +# - replace (param build time dep + _pyct_setup_support) with pyctbuild + try: - from setuptools import setup -except ImportError: - from distutils.core import setup + # this list will become pyctbuild (and autover, unless autover is included in pyctbuild) + import param # noqa + import _pyct_setup_support as pss +except ImportError as e: + raise ImportError("requires param,... to ... please first install param (e.g. pip install param) or upgrade to pip>=10 or conda-build>= ?") + + -setup_args = {} -install_requires = ['param>=1.5.1', 'bokeh>=0.12.10', 'pyviz_comms'] +install_requires = [ + 'param >=1.6.1', + 'bokeh >=0.12.10', + 'pyviz_comms' +] + +extras_require = { + 'tests': [ + 'nbsmoke >=0.2.6', + 'flake8', + 'pytest >=2.8.5' + ], + 'examples': [ + 'pyct', + 'holoviews >=1.9.0', + 'pandas', + 'jupyter', + 'pyparsing', # ??? + ] +} + +extras_require['doc'] = extras_require['examples'] + [ + 'nbsite', + 'sphinx_ioam_theme' +] + +extras_require['all'] = sorted(set(sum(extras_require.values(), []))) + +setup_args = pss.default_setup_args() setup_args.update(dict( name='parambokeh', - version="0.2.2", + version= pss.get_setup_version("parambokeh"), + python_requires = '>=2.7', install_requires = install_requires, + extras_require = extras_require, + tests_require = extras_require["tests"], url = 'https://github.com/ioam/parambokeh', description='ParamBokeh provides an easy way to generate a UI for param based classes in the notebook or on bokeh server.', - long_description=open('README.rst').read() if os.path.isfile('README.rst') else 'Consult README.rst', - author= "IOAM", - author_email= "holoviews@gmail.com", - maintainer= "IOAM", - maintainer_email= "holoviews@gmail.com", - platforms=['Windows', 'Mac OS X', 'Linux'], - packages = ["parambokeh"], - provides = ["parambokeh"], + entry_points={ + 'console_scripts': [ + 'parambokeh = parambokeh.__main__:main' + ] + } )) if __name__=="__main__": - if ('upload' in sys.argv) or ('sdist' in sys.argv): - import parambokeh - parambokeh.__version__.verify(setup_args['version']) + # TODO: hope to eliminate the examples handling from here too, moving it to pyctbuild + ### + example_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), + 'parambokeh','examples') + if 'develop' not in sys.argv: + pss.examples(example_path, __file__, force=True) + ### + setup(**setup_args) + + ### examples handling + if os.path.isdir(example_path): + shutil.rmtree(example_path) + ### diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..a65a2d9 --- /dev/null +++ b/tox.ini @@ -0,0 +1,64 @@ +# For use with pyct (https://github.com/pyviz/pyct), but just standard +# tox config (works with tox alone). + +[tox] +# python version test group extra envs extra commands +envlist = {py27,py36}-{lint,unit,examples,all}-{default,examples}-{dev,pkg} + +[_lint] +description = Flake check python and notebooks, and verify notebooks +deps = .[tests] +# verify takes quite a long time - maybe split into flakes and lint? +commands = flake8 + pytest --nbsmoke-lint -k ".ipynb" +# requires hv, pandas etc unless missing modules turned into warnings +# pytest --nbsmoke-verify -k ".ipynb" + +[_unit] +description = Run unit tests +deps = .[tests] +commands = pytest parambokeh + +[_examples] +description = Test that examples run +deps = .[examples, tests] +commands = pytest --nbsmoke-run -k ".ipynb" +# could add more, to test types of example other than nbs + +[_all] +description = Run all tests +deps = .[examples, tests] +commands = {[_lint]commands} + {[_unit]commands} + {[_examples]commands} + +[_pkg] +commands = parambokeh copy-examples --path=. --force + +[testenv] +changedir = {envtmpdir} + +commands = examples-pkg: {[_pkg]commands} + unit: {[_unit]commands} + lint: {[_lint]commands} + examples: {[_examples]commands} + all: {[_all]commands} + +deps = unit: {[_unit]deps} + lint: {[_lint]deps} + examples: {[_examples]deps} + all: {[_all]deps} + +[pytest] +addopts = -v --pyargs --doctest-modules --doctest-ignore-import-errors +norecursedirs = doc .git dist build _build .ipynb_checkpoints +# notebooks to skip running; one case insensitive re to match per line +nbsmoke_skip_run = ^.*JSONInit\.ipynb$ + +[flake8] +include = *.py +# run_tests.py is generated by conda build, which appears to have a +# bug resulting in code being duplicated a couple of times. +exclude = .git,__pycache__,.tox,.eggs,*.egg,doc,dist,build,_build,.ipynb_checkpoints,run_test.py +ignore = E, + W From 768c5002d71e16249fdf798145252cb4daa468d8 Mon Sep 17 00:00:00 2001 From: Chris B Date: Sat, 9 Jun 2018 11:04:20 +0100 Subject: [PATCH 02/24] Fix build stages --- .travis.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index df2f454..1a3ad9c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,16 +33,16 @@ stages: - test - name: conda_dev_package if: branch = switch_to_pyctdev -## if: tag =~ ^v(\d+|\.)*[a-z]\d*$ -# - name: pip_dev_package -## if: branch = switch_to_pyctdev # if: tag =~ ^v(\d+|\.)*[a-z]\d*$ -# - name: conda_package -# if: tag =~ ^v(\d+|\.)*[^a-z]\d*$ -# - name: pip_package -# if: tag =~ ^v(\d+|\.)*[^a-z]\d*$ -# - name: docs -# if: tag =~ ^v(\d+|\.).*$ + - name: pip_dev_package + if: tag =~ ^v(\d+|\.)*[a-z]\d*$ +# if: branch = switch_to_pyctdev + - name: conda_package + if: tag =~ ^v(\d+|\.)*[^a-z]\d*$ + - name: pip_package + if: tag =~ ^v(\d+|\.)*[^a-z]\d*$ + - name: docs + if: tag =~ ^v(\d+|\.).*$ jobs: From fcb2ab11a4d65f76b3c517e4c27444e9521fc776 Mon Sep 17 00:00:00 2001 From: Chris B Date: Sun, 10 Jun 2018 12:20:55 +0100 Subject: [PATCH 03/24] Still need conda-forge for phantomjs on linux :( --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1a3ad9c..1b0c2d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -113,9 +113,9 @@ jobs: - <<: *conda_default stage: docs - env: DESC="docs" CHANS_DEV="-c pyviz/label/dev" + env: DESC="docs" script: - - doit develop_install $CHANS_DEV -o doc + - doit develop_install $CHANS_DEV -o doc -c conda-forge # phantomjs still not on defaults - doit docs deploy: - provider: pages From 9d1642db68a3f396fa26871d492c73ef6c6faecc Mon Sep 17 00:00:00 2001 From: Chris B Date: Mon, 11 Jun 2018 14:50:46 +0100 Subject: [PATCH 04/24] Switch to setup.cfg --- _pyct_setup_support.py | 61 +++++++--------------------------------- conda.recipe/meta.yaml | 2 +- setup.cfg | 59 +++++++++++++++++++++++++++++++++++++++ setup.py | 63 ++++++------------------------------------ 4 files changed, 78 insertions(+), 107 deletions(-) create mode 100644 setup.cfg diff --git a/_pyct_setup_support.py b/_pyct_setup_support.py index 1b84313..453f024 100644 --- a/_pyct_setup_support.py +++ b/_pyct_setup_support.py @@ -28,11 +28,20 @@ def embed_version(basepath, ref='v0.2.2'): except: return None -def get_setup_version(reponame): +def get_setup_version(): """ Helper to get the current version from either git describe or the .version file (if available). """ + import configparser # py2 also? + config = configparser.ConfigParser() + config.read("setup.cfg") + reponame = config['tool:autover']['reponame'] + if 'pkgname' in config['tool:autover']: + pkgname = config['tool:autover']['pkgname'] + # etc... (started from an old get_setup_version?) + + import json basepath = os.path.split(__file__)[0] version_file_path = os.path.join(basepath, reponame, '.version') @@ -71,53 +80,3 @@ def examples(path, root, verbose=False, force=False): shutil.copytree(tree_root, path, ignore=ignore, symlinks=True) else: print('Cannot find %s' % tree_root) - - - -def default_setup_args(): - - ########## setup.py "best practice" ########## - - args = { - 'include_package_data':True, - 'long_description_content_type':"text/markdown", - 'license':'BSD-3', - 'classifiers': [ - "License :: OSI Approved :: BSD License", - "Operating System :: OS Independent" - ] - } - - from setuptools import find_packages - args['packages'] = find_packages() - args['long_description']=open('README.md').read() - - # + could check manifest.in entries - - - - ########## common pyviz setup.py metadata ########## - - # would want to make this configurable. And moving it out of individual setup.py - # files might annoy people who are trying to read setup.py by eye - - AUTHOR = "pyviz" - AUTHOR_EMAIL = "holoviews@gmail.com" - PLATFORMS = ["Windows","MacOS","Linux"] - - args.update({ - 'author': AUTHOR, - 'author_email': AUTHOR_EMAIL, - 'maintainer': AUTHOR, - 'maintainer_email': AUTHOR_EMAIL, - 'platforms': PLATFORMS, - }) - - - return args - - -# TODO: seems like setuptools doesn't support all things that can be in PKG-INFO, -# like multiple URLs, so (for example) can't get link to github and homepage from pypi -# https://www.python.org/dev/peps/pep-0566/ https://packaging.python.org/specifications/core-metadata/#project-url-multiple-use . -# Should come with pyproject/switching to different build system e.g. flit diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index 3f58835..9bb501c 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -41,4 +41,4 @@ about: home: {{ sdata['url'] }} summary: {{ sdata['description'] }} license: {{ sdata['license'] }} - +# license_file: {{ sdata['license_file'] }} diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..1aa403d --- /dev/null +++ b/setup.cfg @@ -0,0 +1,59 @@ +[metadata] +name = parambokeh +version = attr: _pyct_setup_support.get_setup_version +description = ParamBokeh provides an easy way to generate a UI for param based classes in the notebook or on bokeh server. +long_description = file: README.md +long_description_content_type = text/markdown +license = BSD 3-Clause License +license_file = LICENSE +classifiers = + License :: OSI Approved :: BSD License + Operating System :: OS Independent + Programming Language :: Python + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + Development Status :: 4 - Beta +author = PyViz +author_email = holoviews@gmail.com +maintainer = PyViz +maintainer_email = holoviews@gmail.com +url = https://ioam.github.io/parambokeh +project_urls = + Bug Tracker = https://github.com/ioam/parambokeh/issues + Documentation = https://ioam.github.io/parambokeh + Source Code = https://github.com/ioam/parambokeh + + +[options] +include_package_data = True +packages = find: +python_requires = >=2.7 +install_requires = + param >=1.6.1 + bokeh >=0.12.10 + pyviz_comms + +[options.extras_require] +tests = + nbsmoke >=0.2.6 + flake8 + pytest >=2.8.5 + +examples = + pyct + holoviews >=1.9.0 + pandas + jupyter + pyparsing + +doc = + nbsite + sphinx_ioam_theme + +[options.entry_points] +console_scripts = + parambokeh = parambokeh.__main__:main + +[tool:autover] +reponame = parambokeh diff --git a/setup.py b/setup.py index 2e747bf..1d729bb 100644 --- a/setup.py +++ b/setup.py @@ -9,75 +9,28 @@ # - replace (param build time dep + _pyct_setup_support) with pyctbuild +# Temporary until build requirements as specified in pyproject.toml +# are widely supported try: - # this list will become pyctbuild (and autover, unless autover is included in pyctbuild) + # this list will become pyctbuild (and autover, unless autover is + # included in pyctbuild) import param # noqa import _pyct_setup_support as pss except ImportError as e: raise ImportError("requires param,... to ... please first install param (e.g. pip install param) or upgrade to pip>=10 or conda-build>= ?") - -install_requires = [ - 'param >=1.6.1', - 'bokeh >=0.12.10', - 'pyviz_comms' -] - -extras_require = { - 'tests': [ - 'nbsmoke >=0.2.6', - 'flake8', - 'pytest >=2.8.5' - ], - 'examples': [ - 'pyct', - 'holoviews >=1.9.0', - 'pandas', - 'jupyter', - 'pyparsing', # ??? - ] -} - -extras_require['doc'] = extras_require['examples'] + [ - 'nbsite', - 'sphinx_ioam_theme' -] - -extras_require['all'] = sorted(set(sum(extras_require.values(), []))) - -setup_args = pss.default_setup_args() - -setup_args.update(dict( - name='parambokeh', - version= pss.get_setup_version("parambokeh"), - python_requires = '>=2.7', - install_requires = install_requires, - extras_require = extras_require, - tests_require = extras_require["tests"], - url = 'https://github.com/ioam/parambokeh', - description='ParamBokeh provides an easy way to generate a UI for param based classes in the notebook or on bokeh server.', - entry_points={ - 'console_scripts': [ - 'parambokeh = parambokeh.__main__:main' - ] - } -)) - - if __name__=="__main__": - # TODO: hope to eliminate the examples handling from here too, moving it to pyctbuild - ### + # TODO: hope to eliminate the examples handling from here too + # (i.e. all lines except setup()), moving it to pyctbuild + example_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'parambokeh','examples') if 'develop' not in sys.argv: pss.examples(example_path, __file__, force=True) - ### - setup(**setup_args) + setup() - ### examples handling if os.path.isdir(example_path): shutil.rmtree(example_path) - ### From 6f43bc78a4303a5157638e1a7d366f8c031ffd74 Mon Sep 17 00:00:00 2001 From: Chris B Date: Mon, 11 Jun 2018 16:54:24 +0100 Subject: [PATCH 05/24] Switch to pyctbuild --- _pyct_setup_support.py | 82 ------------------------------------------ setup.cfg | 5 ++- setup.py | 16 +++------ 3 files changed, 9 insertions(+), 94 deletions(-) delete mode 100644 _pyct_setup_support.py diff --git a/_pyct_setup_support.py b/_pyct_setup_support.py deleted file mode 100644 index 453f024..0000000 --- a/_pyct_setup_support.py +++ /dev/null @@ -1,82 +0,0 @@ -# just dumping everything in here for now; will sort out later - -import os - -########## autover ########## - -def embed_version(basepath, ref='v0.2.2'): - """ - Autover is purely a build time dependency in all cases (conda and - pip) except for when you use pip's remote git support [git+url] as - 1) you need a dynamically changing version and 2) the environment - starts off clean with zero dependencies installed. - This function acts as a fallback to make Version available until - PEP518 is commonly supported by pip to express build dependencies. - """ - import io, zipfile, importlib - try: from urllib.request import urlopen - except: from urllib import urlopen - try: - url = 'https://github.com/ioam/autover/archive/{ref}.zip' - response = urlopen(url.format(ref=ref)) - zf = zipfile.ZipFile(io.BytesIO(response.read())) - ref = ref[1:] if ref.startswith('v') else ref - embed_version = zf.read('autover-{ref}/autover/version.py'.format(ref=ref)) - with open(os.path.join(basepath, 'version.py'), 'wb') as f: - f.write(embed_version) - return importlib.import_module("version") - except: - return None - -def get_setup_version(): - """ - Helper to get the current version from either git describe or the - .version file (if available). - """ - import configparser # py2 also? - config = configparser.ConfigParser() - config.read("setup.cfg") - reponame = config['tool:autover']['reponame'] - if 'pkgname' in config['tool:autover']: - pkgname = config['tool:autover']['pkgname'] - # etc... (started from an old get_setup_version?) - - - import json - basepath = os.path.split(__file__)[0] - version_file_path = os.path.join(basepath, reponame, '.version') - try: - from param import version - except: - raise - version = embed_version(basepath) - if version is not None: - return version.Version.setup_version(basepath, reponame, archive_commit="$Format:%h$") - else: - print("WARNING: param>=1.6.0 unavailable. If you are installing a package, this warning can safely be ignored. If you are creating a package or otherwise operating in a git repository, you should install param>=1.6.0.") - return json.load(open(version_file_path, 'r'))['version_string'] - - -########## examples ########## - -import shutil - -def examples(path, root, verbose=False, force=False): - """ - Copies the notebooks to the supplied path. - """ - filepath = os.path.abspath(os.path.dirname(root)) - example_dir = os.path.join(filepath, './examples') - if not os.path.exists(example_dir): - example_dir = os.path.join(filepath, '../examples') - if os.path.exists(path): - if not force: - print('%s directory already exists, either delete it or set the force flag' % path) - return - shutil.rmtree(path) - ignore = shutil.ignore_patterns('.ipynb_checkpoints', '*.pyc', '*~') - tree_root = os.path.abspath(example_dir) - if os.path.isdir(tree_root): - shutil.copytree(tree_root, path, ignore=ignore, symlinks=True) - else: - print('Cannot find %s' % tree_root) diff --git a/setup.cfg b/setup.cfg index 1aa403d..a4f4c0d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = parambokeh -version = attr: _pyct_setup_support.get_setup_version +version = attr: pyctbuild.version.get_setup_version2 description = ParamBokeh provides an easy way to generate a UI for param based classes in the notebook or on bokeh server. long_description = file: README.md long_description_content_type = text/markdown @@ -57,3 +57,6 @@ console_scripts = [tool:autover] reponame = parambokeh + +[wheel] +universal = 1 diff --git a/setup.py b/setup.py index 1d729bb..4188096 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,3 @@ -import os -import sys -import shutil - from setuptools import setup # TODO: @@ -12,23 +8,21 @@ # Temporary until build requirements as specified in pyproject.toml # are widely supported try: - # this list will become pyctbuild (and autover, unless autover is - # included in pyctbuild) - import param # noqa - import _pyct_setup_support as pss + import pyctbuild except ImportError as e: - raise ImportError("requires param,... to ... please first install param (e.g. pip install param) or upgrade to pip>=10 or conda-build>= ?") + raise ImportError("Parambokeh requires pyctbuild to build. Please first install pyctbuild (e.g. pip or conda install pyctbuild), or upgrade to pip>=10 (or conda-build>= ??)") if __name__=="__main__": # TODO: hope to eliminate the examples handling from here too # (i.e. all lines except setup()), moving it to pyctbuild - + import os, sys, shutil example_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'parambokeh','examples') if 'develop' not in sys.argv: - pss.examples(example_path, __file__, force=True) + import pyctbuild.examples + pyctbuild.examples.examples(example_path, __file__, force=True) setup() From ef792905b252fbe3bd2aab347af4721b04166765 Mon Sep 17 00:00:00 2001 From: Chris B Date: Mon, 11 Jun 2018 17:01:58 +0100 Subject: [PATCH 06/24] Updated build requirements. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 463973f..6ac2697 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] requires = [ - "param >=1.6.1", + "pyctbuild", "setuptools" ] From 3a7ef5d3a4647b6bd17087c323acbbd7299a4d51 Mon Sep 17 00:00:00 2001 From: Chris B Date: Mon, 11 Jun 2018 22:21:39 +0100 Subject: [PATCH 07/24] Updated conda build requirements --- conda.recipe/meta.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index 9bb501c..a85d8e3 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -18,11 +18,11 @@ build: {% endfor %} requirements: - build: + host: # duplicates pyproject.toml (not supported in conda build) - python - setuptools - - param + - pyctbuild run: - python {{ sdata['python_requires'] }} {% for dep in sdata.get('install_requires',{}) %} From a603d6aef29c5640928507148c376ef130a27308 Mon Sep 17 00:00:00 2001 From: Chris B Date: Mon, 11 Jun 2018 22:38:30 +0100 Subject: [PATCH 08/24] Clarified error message [ci skip]. --- setup.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 4188096..7a42592 100644 --- a/setup.py +++ b/setup.py @@ -2,15 +2,13 @@ # TODO: # - release new nbsite -# - replace (param build time dep + _pyct_setup_support) with pyctbuild - # Temporary until build requirements as specified in pyproject.toml # are widely supported try: import pyctbuild -except ImportError as e: - raise ImportError("Parambokeh requires pyctbuild to build. Please first install pyctbuild (e.g. pip or conda install pyctbuild), or upgrade to pip>=10 (or conda-build>= ??)") +except ImportError: + raise ImportError("Parambokeh requires pyctbuild to build; please upgrade to pip>=10 and try again (or alternatively, install pyctbuild manually first (e.g. `conda install -c pyviz pyctbuild`)") if __name__=="__main__": From 199fe1b84acabece6b26d11ccd742d17c498a242 Mon Sep 17 00:00:00 2001 From: Chris B Date: Wed, 13 Jun 2018 09:03:14 +0100 Subject: [PATCH 09/24] Syntax fix for python2 --- examples/apps/django2/manage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/apps/django2/manage.py b/examples/apps/django2/manage.py index 66e0f78..0b8fe53 100755 --- a/examples/apps/django2/manage.py +++ b/examples/apps/django2/manage.py @@ -11,5 +11,5 @@ "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" - ) from exc + ) execute_from_command_line(sys.argv) From 2de7ad0b57950517fd160c5ae04a5d7ce4e1747c Mon Sep 17 00:00:00 2001 From: Chris B Date: Wed, 13 Jun 2018 09:16:14 +0100 Subject: [PATCH 10/24] Update appveyor --- .appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index b058e25..a555442 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,6 +1,6 @@ environment: global: - CHANNELS: "-c pyviz/label/dev" + CHANS_DEV: "-c pyviz/label/dev" matrix: - PY: "2.7" CONDA: "C:\\Miniconda-x64" @@ -10,9 +10,9 @@ environment: install: - "SET PATH=%CONDA%;%CONDA%\\Scripts;%PATH%" - "conda install -y -c pyviz/label/dev pyctdev && doit ecosystem_setup" - - "doit env_create %CHANNELS% --name=test --python=%PY%" + - "doit env_create %CHANS_DEV% --name=test --python=%PY%" - "activate test" - - "doit develop_install %CHANNELS%" + - "doit develop_install -o examples -o tests %CHANS_DEV%" - "doit env_capture" build: off From d2bc4e527ebf991abb7bf29ce6296646a86b6391 Mon Sep 17 00:00:00 2001 From: Chris B Date: Sat, 7 Jul 2018 16:00:11 +0100 Subject: [PATCH 11/24] Use param for setup version. Use pyct.build for examples. --- .gitattributes | 3 ++- conda.recipe/meta.yaml | 5 +++-- parambokeh/__init__.py | 6 +++--- pyproject.toml | 5 +++-- setup.cfg | 7 +++---- setup.py | 38 ++++++++++++++++++++++++-------------- 6 files changed, 38 insertions(+), 26 deletions(-) diff --git a/.gitattributes b/.gitattributes index d5612e1..418cdfb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ - __init__.py export-subst +__init__.py export-subst +setup.cfg export-subst diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index a85d8e3..644e202 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -21,8 +21,9 @@ requirements: host: # duplicates pyproject.toml (not supported in conda build) - python - - setuptools - - pyctbuild + - setuptools >=30.3.0 + - param >=1.7.0 + - pyct-core >=0.4.4 run: - python {{ sdata['python_requires'] }} {% for dep in sdata.get('install_requires',{}) %} diff --git a/parambokeh/__init__.py b/parambokeh/__init__.py index 53cc274..5305449 100644 --- a/parambokeh/__init__.py +++ b/parambokeh/__init__.py @@ -29,9 +29,9 @@ from .util import named_objs, get_method_owner from .view import _View - -__version__ = str(param.version.Version(fpath=__file__, archive_commit="$Format:%h$", - reponame="parambokeh")) +from param.version import Version +__version__ = str(param.Version(fpath=__file__,archive_commit="$Format:%h$",reponame="parambokeh")) +del Version ## # make pyct's example/data commands available if possible diff --git a/pyproject.toml b/pyproject.toml index 6ac2697..fec98ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,6 @@ [build-system] requires = [ - "pyctbuild", - "setuptools" + "param >=1.7.0", + "pyct >=0.4.4", + "setuptools >=30.3.0" ] diff --git a/setup.cfg b/setup.cfg index a4f4c0d..8f18f0b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = parambokeh -version = attr: pyctbuild.version.get_setup_version2 +version = attr: param.version.get_setupcfg_version description = ParamBokeh provides an easy way to generate a UI for param based classes in the notebook or on bokeh server. long_description = file: README.md long_description_content_type = text/markdown @@ -55,8 +55,7 @@ doc = console_scripts = parambokeh = parambokeh.__main__:main -[tool:autover] -reponame = parambokeh - [wheel] universal = 1 + +[tool:autover.configparser_workaround.archive_commit=$Format:%h$] diff --git a/setup.py b/setup.py index 7a42592..142194d 100644 --- a/setup.py +++ b/setup.py @@ -1,26 +1,36 @@ from setuptools import setup - -# TODO: -# - release new nbsite - -# Temporary until build requirements as specified in pyproject.toml -# are widely supported +#### +# Build dependency checks +# +# Temporary, until pyproject.toml is widely supported. We're expecting +# most users to install a wheel or conda package, neither of which +# requires running setup.py and building a package. So these checks +# are for packagers and those installing from e.g. github. +import setuptools +from pkg_resources import parse_version +missing_build_dep = False +if parse_version(setuptools.__version__)=10 and try again (or alternatively, install pyctbuild manually first (e.g. `conda install -c pyviz pyctbuild`)") + import pyct.build + import param + if parse_version(param.__version__)=30.3.0, param>=1.7.0, and pyct; please upgrade to pip>=10 and try again. Alternatively, install the build dependencies manually first (e.g. `pip install --upgrade "setuptools>=30.3.0" "param>=1.7.0" pyct` or `conda install -c pyviz "setuptools>=30.3.0" "param>=1.7.0" pyct-core`)') +##### if __name__=="__main__": - - # TODO: hope to eliminate the examples handling from here too - # (i.e. all lines except setup()), moving it to pyctbuild + # TODO: hope to eliminate the examples handling from here + # (i.e. all lines except setup()), moving it to pyct import os, sys, shutil example_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'parambokeh','examples') if 'develop' not in sys.argv: - import pyctbuild.examples - pyctbuild.examples.examples(example_path, __file__, force=True) + pyct.build.examples(example_path, __file__, force=True) setup() From 385d05aebb260714547eecee2e28ae1c6fae2eed Mon Sep 17 00:00:00 2001 From: Chris B Date: Sat, 7 Jul 2018 16:02:27 +0100 Subject: [PATCH 12/24] Remove build dependency checks. See https://github.com/pyviz/autover/issues/54 --- setup.py | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/setup.py b/setup.py index 142194d..0ac03b8 100644 --- a/setup.py +++ b/setup.py @@ -1,32 +1,11 @@ from setuptools import setup -#### -# Build dependency checks -# -# Temporary, until pyproject.toml is widely supported. We're expecting -# most users to install a wheel or conda package, neither of which -# requires running setup.py and building a package. So these checks -# are for packagers and those installing from e.g. github. -import setuptools -from pkg_resources import parse_version -missing_build_dep = False -if parse_version(setuptools.__version__)=30.3.0, param>=1.7.0, and pyct; please upgrade to pip>=10 and try again. Alternatively, install the build dependencies manually first (e.g. `pip install --upgrade "setuptools>=30.3.0" "param>=1.7.0" pyct` or `conda install -c pyviz "setuptools>=30.3.0" "param>=1.7.0" pyct-core`)') -##### +import os, sys, shutil + +import pyct.build if __name__=="__main__": # TODO: hope to eliminate the examples handling from here # (i.e. all lines except setup()), moving it to pyct - import os, sys, shutil example_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'parambokeh','examples') if 'develop' not in sys.argv: From c99fd6ff2f0067b1c028048c138a317ca53eb2d6 Mon Sep 17 00:00:00 2001 From: Chris B Date: Sat, 7 Jul 2018 16:35:16 +0100 Subject: [PATCH 13/24] Simplify travis file. --- .travis.yml | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1b0c2d6..6e23be5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,8 +13,10 @@ env: - PYENV_VERSION=3.6 - CHANS_DEV="-c pyviz/label/dev" - CHANS_REL="-c pyviz" + # TODO: update before merge (along with stage branch checks) + - LABELS_DEV="--label devtmp" + - LABELS_REL="--label dev --label main" - PKG_TEST_PYTHON="--test-python=py27 --test-python=py36" - - PYPI="https://upload.pypi.org/legacy/" cache: directories: @@ -25,10 +27,6 @@ before_cache: - rm -rf $HOME/miniconda/conda-bld/* - rm -rf $HOME/miniconda/envs/*/conda-bld -# quick hack to determine what tag is (improvements welcomed) -# release: ^v(\d+|\.)*[^a-z]\d*$ -# dev release: ^v(\d+|\.)*[a-z]\d*$ - stages: - test - name: conda_dev_package @@ -78,35 +76,33 @@ jobs: ## dev packages - &pip_default - env: PYPI="https://test.pypi.org/legacy/" TRAVIS_NOCACHE=$TRAVIS_JOB_ID + env: TRAVIS_NOCACHE=$TRAVIS_JOB_ID PYPI=testpypi PYPIUSER=$TPPU PYPIPASS=$TPPP stage: pip_dev_package before_install: pip install pyctdev && doit ecosystem=pip ecosystem_setup install: - unset PYENV_VERSION && pyenv global 3.6 2.7 - doit ecosystem=pip package_build $PKG_TEST_PYTHON --test-group=unit - doit ecosystem=pip package_build $PKG_TEST_PYTHON --test-group=all - script: doit ecosystem=pip package_upload -u $TPPU -p $TPPP -r ${PYPI} + script: doit ecosystem=pip package_upload -u $PYPIUSER -p $PYPIPASS --pypi ${PYPI} - - <<: *conda_default + - &conda_pkg + <<: *conda_default stage: conda_dev_package - env: DESC="" TRAVIS_NOCACHE=$TRAVIS_JOB_ID + env: DESC="" TRAVIS_NOCACHE=$TRAVIS_JOB_ID LABELS=$LABELS_DEV CHANS=$CHANS_DEV install: - - doit package_build $CHANS_DEV $PKG_TEST_PYTHON --test-group=unit - - doit package_test $CHANS_DEV $PKG_TEST_PYTHON --test-group=examples --test-requires=examples - script: doit package_upload --user=ceball --token=$CONDA_UPLOAD_TOKEN_TMP --label=dev + - doit package_build $CHANS $PKG_TEST_PYTHON --test-group=unit + - doit package_test $CHANS $PKG_TEST_PYTHON --test-group=examples --test-requires=examples + script: doit package_upload --token=$ANACONDA_TOKEN $LABELS ## release packages - <<: *pip_default - env: TRAVIS_NOCACHE=$TRAVIS_JOB_ID + env: TRAVIS_NOCACHE=$TRAVIS_JOB_ID PYPI=pypi PYPIUSER=$PPU PYPIPASS=$PPP stage: pip_package - script: doit ecosystem=pip package_upload -u $PPU -p $PPP -r ${PYPI} - - <<: *conda_default + - <<: *conda_pkg stage: conda_package - env: DESC="" TRAVIS_NOCACHE=$TRAVIS_JOB_ID - install: doit package_build $CHANS_REL $PKG_TEST_PYTHON --test-group=all - script: doit package_upload --token=$CONDA_UPLOAD_TOKEN_AGAIN --label=dev --label=main + env: DESC="" TRAVIS_NOCACHE=$TRAVIS_JOB_ID LABELS=$LABELS_REL CHANS=$CHANS_REL ########## DOCS ########## From 6261d5e135410a7d34c646e5bbfd8c3b07dc506f Mon Sep 17 00:00:00 2001 From: Chris B Date: Sat, 7 Jul 2018 19:03:56 +0100 Subject: [PATCH 14/24] Back to packaging on dev tags. --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6e23be5..d6dcfa0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,11 +30,9 @@ before_cache: stages: - test - name: conda_dev_package - if: branch = switch_to_pyctdev -# if: tag =~ ^v(\d+|\.)*[a-z]\d*$ + if: tag =~ ^v(\d+|\.)*[a-z]\d*$ - name: pip_dev_package if: tag =~ ^v(\d+|\.)*[a-z]\d*$ -# if: branch = switch_to_pyctdev - name: conda_package if: tag =~ ^v(\d+|\.)*[^a-z]\d*$ - name: pip_package From 78d9bbddbe6a628d375315adfa21f4c066eaad53 Mon Sep 17 00:00:00 2001 From: Chris B Date: Sat, 7 Jul 2018 19:36:39 +0100 Subject: [PATCH 15/24] Fixed auto merge logic error. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d6dcfa0..2e61b99 100644 --- a/.travis.yml +++ b/.travis.yml @@ -115,7 +115,6 @@ jobs: - provider: pages skip_cleanup: true github_token: $GITHUB_TOKEN - fqdn: parambokeh.pyviz.org local_dir: ./doc/_build/html repo: ioam-docs/parambokeh-dev on: @@ -126,6 +125,7 @@ jobs: skip_cleanup: true github_token: $GITHUB_TOKEN local_dir: ./doc/_build/html + fqdn: parambokeh.pyviz.org on: tags: true all_branches: true From 5e422625b8ad9e54b7cb7af877ec2e3bd2a188e3 Mon Sep 17 00:00:00 2001 From: Chris B Date: Sat, 7 Jul 2018 19:53:31 +0100 Subject: [PATCH 16/24] Tox test wheel --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index a65a2d9..138deb2 100644 --- a/tox.ini +++ b/tox.ini @@ -4,6 +4,7 @@ [tox] # python version test group extra envs extra commands envlist = {py27,py36}-{lint,unit,examples,all}-{default,examples}-{dev,pkg} +build = wheel [_lint] description = Flake check python and notebooks, and verify notebooks From 26ad4a1017fe62df6a2cdd621e33909906032fa7 Mon Sep 17 00:00:00 2001 From: Chris B Date: Sat, 7 Jul 2018 20:27:05 +0100 Subject: [PATCH 17/24] Also test sdist --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2e61b99..9810066 100644 --- a/.travis.yml +++ b/.travis.yml @@ -79,8 +79,8 @@ jobs: before_install: pip install pyctdev && doit ecosystem=pip ecosystem_setup install: - unset PYENV_VERSION && pyenv global 3.6 2.7 - - doit ecosystem=pip package_build $PKG_TEST_PYTHON --test-group=unit - - doit ecosystem=pip package_build $PKG_TEST_PYTHON --test-group=all + - doit ecosystem=pip package_build $PKG_TEST_PYTHON --test-group=unit --sdist-install-build-deps --sdist-run-tests + - doit ecosystem=pip package_build $PKG_TEST_PYTHON --test-group=all --sdist-install-build-deps --sdist-run-tests script: doit ecosystem=pip package_upload -u $PYPIUSER -p $PYPIPASS --pypi ${PYPI} - &conda_pkg From cf001590f8dc1c94afb5a1ad0b5098d04f137dbb Mon Sep 17 00:00:00 2001 From: Chris B Date: Sat, 7 Jul 2018 21:05:28 +0100 Subject: [PATCH 18/24] Can't test sdists w/build deps until some future tox release. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9810066..cd7014e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -79,8 +79,8 @@ jobs: before_install: pip install pyctdev && doit ecosystem=pip ecosystem_setup install: - unset PYENV_VERSION && pyenv global 3.6 2.7 - - doit ecosystem=pip package_build $PKG_TEST_PYTHON --test-group=unit --sdist-install-build-deps --sdist-run-tests - - doit ecosystem=pip package_build $PKG_TEST_PYTHON --test-group=all --sdist-install-build-deps --sdist-run-tests + - doit ecosystem=pip package_build $PKG_TEST_PYTHON --test-group=unit --sdist-install-build-deps + - doit ecosystem=pip package_build $PKG_TEST_PYTHON --test-group=all --sdist-install-build-deps script: doit ecosystem=pip package_upload -u $PYPIUSER -p $PYPIPASS --pypi ${PYPI} - &conda_pkg From 6e5576cf9e840782b81112bb4a03babff29a64b7 Mon Sep 17 00:00:00 2001 From: Chris B Date: Sat, 7 Jul 2018 21:35:30 +0100 Subject: [PATCH 19/24] It's going to be license.txt in the wheel anyway. --- LICENSE => LICENSE.txt | 0 MANIFEST.in | 2 +- setup.cfg | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename LICENSE => LICENSE.txt (100%) diff --git a/LICENSE b/LICENSE.txt similarity index 100% rename from LICENSE rename to LICENSE.txt diff --git a/MANIFEST.in b/MANIFEST.in index 1e664fb..15bd6af 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -include LICENSE +include LICENSE.txt include README.md include parambokeh/.version graft examples diff --git a/setup.cfg b/setup.cfg index 8f18f0b..51034d1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,7 +5,7 @@ description = ParamBokeh provides an easy way to generate a UI for param based c long_description = file: README.md long_description_content_type = text/markdown license = BSD 3-Clause License -license_file = LICENSE +license_file = LICENSE.txt classifiers = License :: OSI Approved :: BSD License Operating System :: OS Independent From ab47b7ce9c2fe99a2935d0e8e436f7b12b953793 Mon Sep 17 00:00:00 2001 From: Chris B Date: Sat, 7 Jul 2018 22:15:32 +0100 Subject: [PATCH 20/24] Don't lint check notebooks in package. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cd7014e..b9029b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -80,7 +80,7 @@ jobs: install: - unset PYENV_VERSION && pyenv global 3.6 2.7 - doit ecosystem=pip package_build $PKG_TEST_PYTHON --test-group=unit --sdist-install-build-deps - - doit ecosystem=pip package_build $PKG_TEST_PYTHON --test-group=all --sdist-install-build-deps + - doit ecosystem=pip package_build $PKG_TEST_PYTHON --test-group=examples --sdist-install-build-deps script: doit ecosystem=pip package_upload -u $PYPIUSER -p $PYPIPASS --pypi ${PYPI} - &conda_pkg From 75c4bf38bf43c33bd46e72719920b2ef351e0670 Mon Sep 17 00:00:00 2001 From: Chris B Date: Sat, 7 Jul 2018 23:28:59 +0100 Subject: [PATCH 21/24] Remove travis testing code. Fix doc build. --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index b9029b5..70c7419 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,8 +13,7 @@ env: - PYENV_VERSION=3.6 - CHANS_DEV="-c pyviz/label/dev" - CHANS_REL="-c pyviz" - # TODO: update before merge (along with stage branch checks) - - LABELS_DEV="--label devtmp" + - LABELS_DEV="--label dev" - LABELS_REL="--label dev --label main" - PKG_TEST_PYTHON="--test-python=py27 --test-python=py36" @@ -109,7 +108,7 @@ jobs: stage: docs env: DESC="docs" script: - - doit develop_install $CHANS_DEV -o doc -c conda-forge # phantomjs still not on defaults + - doit develop_install $CHANS_DEV -o doc -o examples -c conda-forge # phantomjs still not on defaults - doit docs deploy: - provider: pages From e17c43db95460520d5f6e28b338744bd8cb6dd2c Mon Sep 17 00:00:00 2001 From: Chris B Date: Sun, 8 Jul 2018 15:42:32 +0100 Subject: [PATCH 22/24] More to ignore. --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2b460ba..bdf54ce 100644 --- a/.gitignore +++ b/.gitignore @@ -64,4 +64,5 @@ target/ # Editor files *~ -.doit.db.db +*.doit* + From fd526a3a46e2fc7f34b3290b57d5cdde08fbad9f Mon Sep 17 00:00:00 2001 From: Chris B Date: Sun, 8 Jul 2018 15:43:36 +0100 Subject: [PATCH 23/24] It's pyct[cmd] from pip for pyct.cmd deps. --- conda.recipe/meta.yaml | 4 ++-- parambokeh/__init__.py | 2 +- setup.cfg | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index 644e202..9e01fe2 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -27,7 +27,7 @@ requirements: run: - python {{ sdata['python_requires'] }} {% for dep in sdata.get('install_requires',{}) %} - - {{ dep }} + - "{{ dep }}" {% endfor %} test: @@ -35,7 +35,7 @@ test: - parambokeh requires: {% for dep in sdata['extras_require']['tests'] %} - - {{ dep }} + - "{{ dep }}" {% endfor %} about: diff --git a/parambokeh/__init__.py b/parambokeh/__init__.py index 5305449..e030c27 100644 --- a/parambokeh/__init__.py +++ b/parambokeh/__init__.py @@ -42,7 +42,7 @@ fetch_data = partial(_fetch, 'parambokeh') examples = partial(_examples, 'parambokeh') except ImportError: - def _missing_cmd(*args,**kw): return("install pyct to enable this command (e.g. `conda install pyct` or `pip install pyct`)") + def _missing_cmd(*args,**kw): return("install pyct to enable this command (e.g. `conda install pyct` or `pip install pyct[cmd]`)") _copy = _fetch = _examples = _missing_cmd def _err(): raise ValueError(_missing_cmd()) fetch_data = copy_examples = examples = _err diff --git a/setup.cfg b/setup.cfg index 51034d1..93e0d12 100644 --- a/setup.cfg +++ b/setup.cfg @@ -41,7 +41,7 @@ tests = pytest >=2.8.5 examples = - pyct + pyct[cmd] holoviews >=1.9.0 pandas jupyter From f67e003c133123ef91f3835d4fcac3d349b94bb9 Mon Sep 17 00:00:00 2001 From: Chris B Date: Sun, 8 Jul 2018 15:45:14 +0100 Subject: [PATCH 24/24] Updated website location --- doc/conf.py | 2 +- setup.cfg | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index faa5550..66e32b7 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -28,7 +28,7 @@ 'PROJECT': project, 'DESCRIPTION': description, 'AUTHOR': authors, - 'WEBSITE_URL': 'https://ioam.github.io/parambokeh', + 'WEBSITE_URL': 'https://parambokeh.pyviz.org', 'VERSION': version, 'NAV': _NAV, 'LINKS': _NAV, diff --git a/setup.cfg b/setup.cfg index 93e0d12..7b10a2d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,10 +18,10 @@ author = PyViz author_email = holoviews@gmail.com maintainer = PyViz maintainer_email = holoviews@gmail.com -url = https://ioam.github.io/parambokeh +url = https://parambokeh.pyviz.org project_urls = Bug Tracker = https://github.com/ioam/parambokeh/issues - Documentation = https://ioam.github.io/parambokeh + Documentation = https://parambokeh.pyviz.org Source Code = https://github.com/ioam/parambokeh