Skip to content

Commit 966825c

Browse files
authored
Merge pull request #85 from vidartf/CI
Add some basic CI checks of examples and links
2 parents 07061c8 + 0f4dcbd commit 966825c

File tree

9 files changed

+82
-25
lines changed

9 files changed

+82
-25
lines changed

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,15 @@ pythreejs/static/
1313
# OS X
1414
.DS_Store
1515

16-
16+
# Autogen files
1717
*_autogen.py
1818
*.autogen.js
1919
js/src/**/index.js
2020
pythreejs/**/__init__.py
21+
22+
# Test and coverage
23+
.coverage
24+
.cache
25+
htmlcov/
26+
27+

.travis.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
language: python
2+
python:
3+
- 3.5
4+
- 3.4
5+
- 2.7
6+
sudo: false
7+
cache:
8+
pip: true
9+
directories:
10+
- ~/.npm # NPM cache
11+
before_install:
12+
- pip install -U pip setuptools
13+
- nvm install 6
14+
install:
15+
- pip install --upgrade -e ".[test, examples]"
16+
script:
17+
- py.test -l --nbval-lax --current-env examples
18+
- python -m pytest_check_links

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A Python / ThreeJS bridge utilizing the Jupyter widget infrastructure.
44

5-
![Screencast](/screencast.gif)
5+
![Screencast](screencast.gif)
66

77
## Getting Started
88

examples/Animation.ipynb

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,11 @@
288288
{
289289
"cell_type": "code",
290290
"execution_count": null,
291-
"metadata": {},
291+
"metadata": {
292+
"tags": [
293+
"nbval-skip"
294+
]
295+
},
292296
"outputs": [],
293297
"source": [
294298
"import numpy as np\n",
@@ -315,7 +319,11 @@
315319
{
316320
"cell_type": "code",
317321
"execution_count": null,
318-
"metadata": {},
322+
"metadata": {
323+
"tags": [
324+
"nbval-skip"
325+
]
326+
},
319327
"outputs": [],
320328
"source": [
321329
"pill_track = NumberKeyframeTrack(name='.morphTargetInfluences[0]', times=[0, 1.5, 3], values=[0, 2.5, 0])\n",
@@ -326,7 +334,11 @@
326334
{
327335
"cell_type": "code",
328336
"execution_count": null,
329-
"metadata": {},
337+
"metadata": {
338+
"tags": [
339+
"nbval-skip"
340+
]
341+
},
330342
"outputs": [],
331343
"source": [
332344
"camera3 = PerspectiveCamera( position=[5, 3, 5], aspect=view_width/view_height)\n",

js/scripts/generate-wrappers.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -955,17 +955,21 @@ function createPythonFiles() {
955955
return mapPromiseFnOverThreeModules(function(relativePath) {
956956
return createPythonWrapper(relativePath).then(function() {
957957
// ensures each dir has empty __init__.py file for proper importing of sub dirs
958-
createPythonModuleInitFile(relativePath);
958+
return createPythonModuleInitFile(relativePath);
959959
});
960960
})
961961
.then(function() {
962962
return mapPromiseFnOverFileList(CUSTOM_CLASSES, function(relativePath) {
963963
return createPythonWrapper(relativePath).then(function() {
964964
// ensures each dir has empty __init__.py file for proper importing of sub dirs
965-
createPythonModuleInitFile(relativePath);
965+
return createPythonModuleInitFile(relativePath);
966966
});
967967
});
968968
})
969+
.then(function() {
970+
// Manually ensure base init file is created
971+
return createPythonModuleInitFile('_base/__init__');
972+
})
969973
.then(function() {
970974
// top level __init__.py file imports *all* pythreejs modules into namespace
971975
return createTopLevelPythonModuleFile();

js/scripts/templates/py_wrapper.mustache

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import inspect
2-
1+
import six
32
from ipywidgets import Widget, DOMWidget, widget_serialization, Color, register
43
from traitlets import (
54
Unicode, Int, CInt, Instance, ForwardDeclaredInstance, This, Enum,
@@ -42,6 +41,7 @@ class {{ className }}({{ superClass.className }}):
4241
{{/each}}
4342

4443

45-
# Include explicit signature since the metaclass screws it up
46-
{{ className }}.__signature__ = inspect.signature({{ className }}.__init__)
47-
44+
if six.PY3:
45+
import inspect
46+
# Include explicit signature since the metaclass screws it up
47+
{{ className }}.__signature__ = inspect.signature({{ className }}.__init__)

pytest.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[pytest]
2+
norecursedirs = .git node_modules htmlcov .ipynb_checkpoints

pythreejs/core/Renderer.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
"""
3-
from inspect import Signature, Parameter
43

4+
import six
55
from ipywidgets import widget_serialization, Color
66
from traitlets import (
77
Unicode, CInt, Instance, Float, Tuple, Undefined, link)
@@ -57,15 +57,18 @@ def freeze(self):
5757
}
5858
self.send(content)
5959

60-
# Include explicit signature since the metaclass screws it up
61-
parameters = [
62-
Parameter('scene', Parameter.POSITIONAL_OR_KEYWORD),
63-
Parameter('camera', Parameter.POSITIONAL_OR_KEYWORD),
64-
Parameter('controls', Parameter.POSITIONAL_OR_KEYWORD, default=None),
65-
]
66-
for name in ('width', 'height', 'background', 'background_opacity'):
67-
parameters.append(Parameter(
68-
name, Parameter.KEYWORD_ONLY, default=getattr(Renderer, name).default_value))
69-
parameters.append(Parameter('kwargs', Parameter.VAR_KEYWORD))
70-
Renderer.__signature__ = Signature(parameters=tuple(parameters))
71-
del parameters
60+
61+
if six.PY3:
62+
from inspect import Signature, Parameter
63+
# Include explicit signature since the metaclass screws it up
64+
parameters = [
65+
Parameter('scene', Parameter.POSITIONAL_OR_KEYWORD),
66+
Parameter('camera', Parameter.POSITIONAL_OR_KEYWORD),
67+
Parameter('controls', Parameter.POSITIONAL_OR_KEYWORD, default=None),
68+
]
69+
for name in ('width', 'height', 'background', 'background_opacity'):
70+
parameters.append(Parameter(
71+
name, Parameter.KEYWORD_ONLY, default=getattr(Renderer, name).default_value))
72+
parameters.append(Parameter('kwargs', Parameter.VAR_KEYWORD))
73+
Renderer.__signature__ = Signature(parameters=tuple(parameters))
74+
del parameters

setup.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@
5252
'ipywidgets>=7,<8',
5353
'ipydatawidgets>=1.1.1'
5454
],
55+
'extras_require': {
56+
'test': [
57+
'nbval',
58+
'pytest-check-links',
59+
],
60+
'examples': [
61+
'scipy',
62+
'matplotlib',
63+
'scikit-image'
64+
],
65+
},
5566
'packages': find_packages(),
5667
'zip_safe': False,
5768
'cmdclass': cmdclass,

0 commit comments

Comments
 (0)