Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notebook flake fixes #2091

Merged
merged 1 commit into from
Nov 6, 2017
Merged

Notebook flake fixes #2091

merged 1 commit into from
Nov 6, 2017

Conversation

ceball
Copy link
Contributor

@ceball ceball commented Nov 4, 2017

I'm testing a notebook linting tool. These are the issues it found in the doc/ directory, running it with python3.

It's not clear to me that everything it's found is correct, e.g.

  • Is there a notebook about pandas that doesn't use pandas? Or is it because you need to import pandas to get features of the pandas backend?
  • Do notebooks work in python 2 and python 3 with both the print statement and function? One notebook had both in.
  • Are some things in notebooks deliberately imported and unused?

This is what I ran:

pip install pytest-nbsmoke
pytest --tb=short --nbsmoke-lint doc/

--tb=short is necessary because currently the combined pytest/nbconvert output is huge, unfortunately.

If I run nbsmoke on examples/, I get a lot more to fix. But first I wanted to see how you feel about these changes...

@ceball ceball changed the title Fixed flakes. Notebook flake fixes Nov 4, 2017
@ceball
Copy link
Contributor Author

ceball commented Nov 4, 2017

From running on examples/, I noticed two things: (1) you guys have done an unbelievable amount of work (!), and (2) you like to import numpy but not use it ;)

$ pytest --nbsmoke-lint examples/
===================================================== test session starts =====================================================
platform darwin -- Python 3.6.3, pytest-3.2.3, py-1.4.34, pluggy-0.4.0
rootdir: /Users/cball/code/ioam/holoviews3, inifile:
plugins: nbsmoke-0.1.5
collected 201 items                                                                                                            

examples/gallery/demos/bokeh/area_chart.ipynb .
examples/gallery/demos/bokeh/autompg_histogram.ipynb F
examples/gallery/demos/bokeh/bachelors_degrees_by_gender.ipynb F
examples/gallery/demos/bokeh/bars_economic.ipynb F
examples/gallery/demos/bokeh/boxplot_chart.ipynb F
examples/gallery/demos/bokeh/dot_example.ipynb F
examples/gallery/demos/bokeh/dragon_curve.ipynb .
examples/gallery/demos/bokeh/dropdown_economic.ipynb F
examples/gallery/demos/bokeh/histogram_example.ipynb .
examples/gallery/demos/bokeh/iris_density_grid.ipynb F
examples/gallery/demos/bokeh/iris_example.ipynb F
examples/gallery/demos/bokeh/iris_splom_example.ipynb F
examples/gallery/demos/bokeh/legend_example.ipynb .
examples/gallery/demos/bokeh/lesmis_example.ipynb .
examples/gallery/demos/bokeh/lorenz_attractor_example.ipynb .
examples/gallery/demos/bokeh/mandelbrot_section.ipynb .
examples/gallery/demos/bokeh/measles_example.ipynb .
examples/gallery/demos/bokeh/network_graph.ipynb .
examples/gallery/demos/bokeh/quiver_demo.ipynb .
examples/gallery/demos/bokeh/scatter_economic.ipynb F
examples/gallery/demos/bokeh/square_limit.ipynb .
examples/gallery/demos/bokeh/step_chart.ipynb F
examples/gallery/demos/bokeh/stocks_example.ipynb .
examples/gallery/demos/bokeh/texas_choropleth_example.ipynb F
examples/gallery/demos/bokeh/topographic_hillshading.ipynb F
examples/gallery/demos/bokeh/us_unemployment.ipynb .
examples/gallery/demos/bokeh/verhulst_mandelbrot.ipynb .
examples/gallery/demos/matplotlib/area_chart.ipynb .
examples/gallery/demos/matplotlib/autompg_histogram.ipynb F
examples/gallery/demos/matplotlib/bachelors_degrees_by_gender.ipynb F
examples/gallery/demos/matplotlib/bars_economic.ipynb F
examples/gallery/demos/matplotlib/boxplot_chart.ipynb F
examples/gallery/demos/matplotlib/dragon_curve.ipynb .
examples/gallery/demos/matplotlib/dropdown_economic.ipynb F
examples/gallery/demos/matplotlib/histogram_example.ipynb .
examples/gallery/demos/matplotlib/iris_density_grid.ipynb F
examples/gallery/demos/matplotlib/iris_example.ipynb F
examples/gallery/demos/matplotlib/iris_splom_example.ipynb F
examples/gallery/demos/matplotlib/legend_example.ipynb .
examples/gallery/demos/matplotlib/lorenz_attractor_example.ipynb .
examples/gallery/demos/matplotlib/mandelbrot_section.ipynb .
examples/gallery/demos/matplotlib/measles_example.ipynb .
examples/gallery/demos/matplotlib/network_graph.ipynb .
examples/gallery/demos/matplotlib/polar_scatter_demo.ipynb .
examples/gallery/demos/matplotlib/quiver_demo.ipynb .
examples/gallery/demos/matplotlib/scatter_economic.ipynb F
examples/gallery/demos/matplotlib/square_limit.ipynb .
examples/gallery/demos/matplotlib/step_chart.ipynb F
examples/gallery/demos/matplotlib/stocks_example.ipynb .
examples/gallery/demos/matplotlib/surface_3d.ipynb .
examples/gallery/demos/matplotlib/texas_choropleth_example.ipynb F
examples/gallery/demos/matplotlib/topographic_hillshading.ipynb F
examples/gallery/demos/matplotlib/trisurf3d_demo.ipynb .
examples/gallery/demos/matplotlib/us_unemployment.ipynb .
examples/gallery/demos/matplotlib/verhulst_mandelbrot.ipynb .
examples/gallery/demos/plotly/surface_3d.ipynb .
examples/gallery/demos/plotly/trisurf3d_demo.ipynb .
examples/getting_started/1-Introduction.ipynb .
examples/getting_started/2-Customization.ipynb .
examples/getting_started/3-Tabular_Datasets.ipynb .
examples/getting_started/4-Gridded_Datasets.ipynb F
examples/getting_started/5-Live_Data.ipynb .
examples/reference/containers/bokeh/DynamicMap.ipynb .
examples/reference/containers/bokeh/GridSpace.ipynb .
examples/reference/containers/bokeh/HoloMap.ipynb .
examples/reference/containers/bokeh/Layout.ipynb .
examples/reference/containers/bokeh/NdLayout.ipynb .
examples/reference/containers/bokeh/NdOverlay.ipynb .
examples/reference/containers/bokeh/Overlay.ipynb .
examples/reference/containers/matplotlib/DynamicMap.ipynb .
examples/reference/containers/matplotlib/GridSpace.ipynb .
examples/reference/containers/matplotlib/HoloMap.ipynb .
examples/reference/containers/matplotlib/Layout.ipynb .
examples/reference/containers/matplotlib/NdLayout.ipynb .
examples/reference/containers/matplotlib/NdOverlay.ipynb .
examples/reference/containers/matplotlib/Overlay.ipynb .
examples/reference/elements/bokeh/Area.ipynb .
examples/reference/elements/bokeh/Arrow.ipynb .
examples/reference/elements/bokeh/Bars.ipynb .
examples/reference/elements/bokeh/Bivariate.ipynb .
examples/reference/elements/bokeh/Bounds.ipynb F
examples/reference/elements/bokeh/Box.ipynb .
examples/reference/elements/bokeh/BoxWhisker.ipynb .
examples/reference/elements/bokeh/Contours.ipynb .
examples/reference/elements/bokeh/Curve.ipynb .
examples/reference/elements/bokeh/Distribution.ipynb .
examples/reference/elements/bokeh/Ellipse.ipynb .
examples/reference/elements/bokeh/ErrorBars.ipynb .
examples/reference/elements/bokeh/Graph.ipynb F
examples/reference/elements/bokeh/HLine.ipynb .
examples/reference/elements/bokeh/HSV.ipynb .
examples/reference/elements/bokeh/HeatMap.ipynb .
examples/reference/elements/bokeh/Histogram.ipynb .
examples/reference/elements/bokeh/Image.ipynb .
examples/reference/elements/bokeh/ItemTable.ipynb F
examples/reference/elements/bokeh/Path.ipynb .
examples/reference/elements/bokeh/Points.ipynb .
examples/reference/elements/bokeh/Polygons.ipynb .
examples/reference/elements/bokeh/QuadMesh.ipynb .
examples/reference/elements/bokeh/RGB.ipynb .
examples/reference/elements/bokeh/Raster.ipynb .
examples/reference/elements/bokeh/Scatter.ipynb .
examples/reference/elements/bokeh/Spikes.ipynb .
examples/reference/elements/bokeh/Spline.ipynb F
examples/reference/elements/bokeh/Spread.ipynb .
examples/reference/elements/bokeh/Table.ipynb F
examples/reference/elements/bokeh/Text.ipynb .
examples/reference/elements/bokeh/VLine.ipynb .
examples/reference/elements/bokeh/VectorField.ipynb .
examples/reference/elements/matplotlib/Area.ipynb .
examples/reference/elements/matplotlib/Arrow.ipynb .
examples/reference/elements/matplotlib/Bars.ipynb .
examples/reference/elements/matplotlib/Bivariate.ipynb .
examples/reference/elements/matplotlib/Bounds.ipynb F
examples/reference/elements/matplotlib/Box.ipynb .
examples/reference/elements/matplotlib/BoxWhisker.ipynb .
examples/reference/elements/matplotlib/Contours.ipynb .
examples/reference/elements/matplotlib/Curve.ipynb .
examples/reference/elements/matplotlib/Distribution.ipynb .
examples/reference/elements/matplotlib/Ellipse.ipynb .
examples/reference/elements/matplotlib/ErrorBars.ipynb .
examples/reference/elements/matplotlib/Graph.ipynb F
examples/reference/elements/matplotlib/HLine.ipynb .
examples/reference/elements/matplotlib/HSV.ipynb .
examples/reference/elements/matplotlib/HeatMap.ipynb .
examples/reference/elements/matplotlib/Histogram.ipynb .
examples/reference/elements/matplotlib/Image.ipynb .
examples/reference/elements/matplotlib/ItemTable.ipynb F
examples/reference/elements/matplotlib/Path.ipynb .
examples/reference/elements/matplotlib/Points.ipynb .
examples/reference/elements/matplotlib/Polygons.ipynb .
examples/reference/elements/matplotlib/QuadMesh.ipynb .
examples/reference/elements/matplotlib/RGB.ipynb .
examples/reference/elements/matplotlib/Raster.ipynb .
examples/reference/elements/matplotlib/Scatter.ipynb .
examples/reference/elements/matplotlib/Scatter3D.ipynb .
examples/reference/elements/matplotlib/Spikes.ipynb .
examples/reference/elements/matplotlib/Spline.ipynb F
examples/reference/elements/matplotlib/Spread.ipynb .
examples/reference/elements/matplotlib/Surface.ipynb .
examples/reference/elements/matplotlib/Table.ipynb F
examples/reference/elements/matplotlib/Text.ipynb .
examples/reference/elements/matplotlib/Trisurface.ipynb .
examples/reference/elements/matplotlib/VLine.ipynb .
examples/reference/elements/matplotlib/VectorField.ipynb .
examples/reference/elements/plotly/BoxWhiskers.ipynb .
examples/reference/elements/plotly/Curve.ipynb .
examples/reference/elements/plotly/Distribution.ipynb .
examples/reference/elements/plotly/ErrorBars.ipynb .
examples/reference/elements/plotly/HeatMap.ipynb .
examples/reference/elements/plotly/Image.ipynb .
examples/reference/elements/plotly/ItemTable.ipynb F
examples/reference/elements/plotly/Points.ipynb .
examples/reference/elements/plotly/Raster.ipynb .
examples/reference/elements/plotly/Scatter.ipynb .
examples/reference/elements/plotly/Scatter3D.ipynb .
examples/reference/elements/plotly/Surface.ipynb .
examples/reference/elements/plotly/Table.ipynb F
examples/reference/elements/plotly/Trisurface.ipynb .
examples/reference/features/bokeh/table_hooks_example.ipynb F
examples/reference/streams/bokeh/Bounds.ipynb .
examples/reference/streams/bokeh/BoundsX.ipynb .
examples/reference/streams/bokeh/BoundsY.ipynb .
examples/reference/streams/bokeh/PointerX.ipynb F
examples/reference/streams/bokeh/PointerXY.ipynb .
examples/reference/streams/bokeh/RangeXY.ipynb F
examples/reference/streams/bokeh/Selection1D.ipynb .
examples/reference/streams/bokeh/Selection1D_paired.ipynb .
examples/reference/streams/bokeh/Selection1D_points.ipynb .
examples/reference/streams/bokeh/Selection1D_tap.ipynb .
examples/reference/streams/bokeh/Tap.ipynb F
examples/topics/geometry/lsystems.ipynb .
examples/topics/geometry/square_limit.ipynb .
examples/topics/simulation/boids.ipynb .
examples/topics/simulation/hipster_dynamics.ipynb .
examples/topics/simulation/sri_model.ipynb F
examples/user_guide/01-Annotating_Data.ipynb F
examples/user_guide/02-Composing_Elements.ipynb .
examples/user_guide/03-Customizing_Plots.ipynb .
examples/user_guide/04-Dimensioned_Containers.ipynb F
examples/user_guide/05-Building_Composite_Objects.ipynb .
examples/user_guide/06-Live_Data.ipynb .
examples/user_guide/07-Tabular_Datasets.ipynb .
examples/user_guide/08-Gridded_Datasets.ipynb F
examples/user_guide/09-Indexing_and_Selecting_Data.ipynb .
examples/user_guide/10-Transforming_Elements.ipynb .
examples/user_guide/11-Responding_to_Events.ipynb F
examples/user_guide/12-Custom_Interactivity.ipynb .
examples/user_guide/13-Data_Pipelines.ipynb F
examples/user_guide/14-Large_Data.ipynb F
examples/user_guide/15-Streaming_Data.ipynb .
examples/user_guide/16-Dashboards.ipynb F
examples/user_guide/Continuous_Coordinates.ipynb .
examples/user_guide/Deploying_Bokeh_Apps.ipynb .
examples/user_guide/Exporting_and_Archiving.ipynb F
examples/user_guide/Installing_and_Configuring.ipynb .
examples/user_guide/Network_Graphs.ipynb F
examples/user_guide/Plots_and_Renderers.ipynb F
examples/user_guide/Plotting_with_Bokeh.ipynb .
examples/user_guide/Plotting_with_Matplotlib.ipynb .
examples/user_guide/Tips_and_Tricks.ipynb F
[...]
=========================================== 54 failed, 147 passed in 28.52 seconds ============================================

@jbednar
Copy link
Member

jbednar commented Nov 4, 2017

  • In general, I'd be surprised if a notebook imported something for its use as a side effect; I don't think any of those would be intentional.
  • Pandas shouldn't have to be imported in the notebook to be used; it's imported with try/except whether or not a notebook imports it.
  • All uses of print should be with parentheses, to work in py2 and 3. Extra imports of numpy can surely be deleted.

Copy link
Member

@jbednar jbednar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of those look controversial to me!

@jlstevens
Copy link
Contributor

The changes I see in the diffs all look helpful. Thanks!

@philippjfr
Copy link
Member

Agreed, happy to merge this. Looks like there are more failures than fixes though. Do you want to make the other fixes too or should we just go ahead and merge this?

@ceball
Copy link
Contributor Author

ceball commented Nov 6, 2017

I'd merge this, saying it relates to doc only.

I'll do examples next, separately.

@philippjfr
Copy link
Member

Great thanks for doing this!

@philippjfr philippjfr merged commit 4b33029 into master Nov 6, 2017
@philippjfr philippjfr deleted the notebook_lint branch February 11, 2018 17:03
@ceball ceball mentioned this pull request Mar 12, 2018
@ceball ceball mentioned this pull request Mar 10, 2019
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants