Skip to content

Commit

Permalink
Simplifications related to packaging and testing. (#220)
Browse files Browse the repository at this point in the history
* specify test dependencies in setup.py
* simplify running of test tools (conda and pip packages tested same way as developers test)
* reduce duplication of packaging metadata

Also, fixes detection of existing conda package (change missed when switching to autover).
  • Loading branch information
ceball authored Apr 3, 2018
1 parent 48ad8ba commit fff23c0
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 19 deletions.
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
python: pypy
env: TOX_ENV=pypy

# could consider running with_ipython,numpy over py36 and 27

- <<: *default
env: TOX_ENV=with_ipython

Expand All @@ -53,7 +55,7 @@ jobs:

- <<: *default
stage: lint
env: TOX_ENV=lint_checks
env: TOX_ENV=flakes

- stage: conda_package
install:
Expand All @@ -64,10 +66,9 @@ jobs:
- conda update conda
- conda install anaconda-client conda-build
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 upload --user pyviz --label dev `conda build --output conda.recipe`
- anaconda show pyviz/param/$(python setup.py --version) || anaconda --token $CONDA_UPLOAD_TOKEN upload --user pyviz --label dev $(conda build --output conda.recipe)

- <<: *default
stage: pypi_package
Expand Down
15 changes: 10 additions & 5 deletions conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,25 @@ requirements:
- python
- setuptools
run:
- python
- python {{ sdata['python_requires'] }}

test:
requires:
- nose
{% for dep in sdata['extras_require']['tests'] %}
- {{ dep }}
{% endfor %}
source_files:
# for nose config
- setup.cfg
- tests
imports:
- param
- numbergen
commands:
# https://github.com/ioam/param/issues/219
- nosetests tests

about:
home: https://github.com/ioam/param
summary: Make your Python code clearer and more reliable by declaring Parameters
license: BSD 3-Clause
home: {{ sdata['url'] }}
summary: {{ sdata['description'] }}
license: {{ sdata['license'] }}
8 changes: 8 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
universal = 1

[flake8]
# TODO tests (one day)
include = setup.py param numbergen
exclude = .git,__pycache__,.tox,.eggs,*.egg,doc,dist,build,_build,tests
ignore = E1,
E2,
E3,
Expand All @@ -16,3 +19,8 @@ ignore = E1,
E742,
E743,
W503

[nosetests]
verbosity = 2
with-doctest = 1
nologcapture = 1
18 changes: 17 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,22 @@ def get_setup_version(reponame):
else:
return json.load(open(version_file_path, 'r'))['version_string']

#############################

########## dependencies ##########

extras_require = {
# pip doesn't support tests_require
# (https://github.com/pypa/pip/issues/1197)
'tests': [
'nose',
'flake8',
]
}

extras_require['all'] = sorted(set(sum(extras_require.values(), [])))


########## metadata for setuptools ##########

setup_args = dict(
name='param',
Expand All @@ -72,6 +86,8 @@ def get_setup_version(reponame):
include_package_data = True,
python_requires=">=2.7",
install_requires=[],
extras_require=extras_require,
tests_require=extras_require['tests'],
classifiers=[
"License :: OSI Approved :: BSD License",
"Development Status :: 5 - Production/Stable",
Expand Down
25 changes: 15 additions & 10 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
[tox]
envlist = py36,py35,py34,py33,py27,pypy,flake8
envlist =
py36,py35,py34,py33,py27,pypy,
{py27,py36}-flakes,
{py27,py36}-with_numpy,
{py27,py36}-with_ipython

[testenv]
deps = nose
commands = nosetests --verbose --nologcapture --with-doctest
deps = .[tests]
commands = nosetests

[testenv:coverage]
# remove develop install if https://github.com/ioam/param/issues/219
# implemented
setdevelop = True
passenv = TRAVIS TRAVIS_*
deps = nose
deps = {[testenv]deps}
coveralls
commands = nosetests -vv --with-doctest --with-coverage --cover-package=param
commands = nosetests --with-coverage --cover-package=param
coveralls
# TODO missing numbergen

[testenv:with_numpy]
deps = nose
deps = {[testenv]deps}
numpy
setenv = PARAM_TEST_NUMPY = 1

[testenv:with_ipython]
deps = nose
deps = {[testenv]deps}
ipython
setenv = PARAM_TEST_IPYTHON = 1

[testenv:lint_checks]
deps = flake8
[testenv:flakes]
skip_install = true
commands = flake8 setup.py param numbergen # TODO tests (one day)
commands = flake8

0 comments on commit fff23c0

Please sign in to comment.