Skip to content

Nonexisting references in docstrings #142

Closed
cdeil opened this Issue Dec 11, 2012 · 2 comments

3 participants

@cdeil
the rootpy project member
cdeil commented Dec 11, 2012

When I build the docs, there are some failed imports from autodoc. I think these are cases where the docstrings were not updated with moved or removed modules. Could someone please clean this up for 0.7? I don't actually know the details for these modules, so I think you'll be able to do this much more quickly.

@ndawe You did put print __doc__ in most of the examples, and this stuff gets printed in the docs build. I don't see the advantage of printing __doc__, because the purpose of the example is to look at the code, so I would propose to remove these print statements. But obviously this is not important at all, feel free to ignore if you disagree.

I think having the ImportError in the docs build if root_numpy is not installed is actually OK, it's a reminder to install it.

$ make doc
python setup.py build_ext -i

                 _
 _ __ ___   ___ | |_ _ __  _   _
| '__/ _ \ / _ \| __| '_ \| | | |
| | | (_) | (_) | |_| |_) | |_| |
|_|  \___/ \___/ \__| .__/ \__, |
                    |_|    |___/
      dev

running build_ext
make -C docs/ html
sphinx-build -b html -d _build/doctrees   . _build/html
Running Sphinx v1.1.3
loading pickled environment... done
[autosummary] generating autosummary for: auto_examples/array/tree_to_array.rst, auto_examples/index.rst, auto_examples/io/file.rst, auto_examples/plotting/plot_hist.rst, auto_examples/plotting/plot_hist_fill_array.rst, auto_examples/plotting/plot_matplotlib_hist.rst, auto_examples/plotting/plot_style.rst, auto_examples/tree/chain.rst, auto_examples/tree/chain_overwrite.rst, auto_examples/tree/model.rst, ..., modules/rootpy.logging.rst, modules/rootpy.math.linalg.rst, modules/rootpy.math.physics.rst, modules/rootpy.math.rst, modules/rootpy.math.stats.rst, modules/rootpy.plotting.rst, modules/rootpy.root2array.rst, modules/rootpy.tree.rst, start.rst, user_guide.rst
Failed to import 'rootpy.root2array': no module named rootpy.root2array
Failed to import 'rootpy.root2array.root2array': no module named rootpy.root2array.root2array
Failed to import 'rootpy.plotting.pyplot': no module named rootpy.plotting.pyplot
Failed to import 'rootpy.rootcint': no module named rootpy.rootcint
plotting plot_hist.py

============================
Working with ROOT histograms
============================

This example demonstrates how to create and work with ROOT histogram in rootpy.

ce25a24c90b14c1aa1ac18e9027f755c
my hist
Some Data
1.0
INFO:rootpy.logger] | No default log handler configured. See `logging` module |
INFO:rootpy.logger] \    To suppress: 'rootpy.log.basic_config_colorized()'   /
INFO:ROOT.TCanvas.Print] png file /private/tmp/rootpy/docs/auto_examples/plotting/images/root_plot_hist_1.png has been created
 - time elapsed : 0.16 sec
plotting plot_hist_fill_array.py

===================================
Fill a histogram with a NumPy array
===================================

This example demonstrates how a 1D, 2D, or 3D ROOT histogram can be efficiently
filled with a NumPy array.

CRITICAL:rootpy.plotting.hist] root_numpy is needed for Hist*.fill_array. Is it installed and importable?
________________________________________________________________________________
plot_hist_fill_array.py is not compiling:
Traceback (most recent call last):
  File "/private/tmp/rootpy/docs/sphinxext/gen_rst.py", line 313, in generate_file_rst
    execfile(os.path.basename(src_file), my_globals)
  File "plot_hist_fill_array.py", line 17, in <module>
    a.fill_array(np.random.randn(1000000))
  File "/Users/deil/Library/Python/2.7/lib/python/site-packages/rootpy-dev-py2.7.egg/rootpy/plotting/hist.py", line 384, in fill_array
    from root_numpy import fill_array
ImportError: cannot import name fill_array
________________________________________________________________________________
 - time elapsed : 0 sec
plotting plot_style.py

==========================
Setting the plotting style
==========================

This example demonstrates how to set the plotting style.

INFO:rootpy.plotting.style] using style 'ATLAS'
INFO:ROOT.TCanvas.Print] png file /private/tmp/rootpy/docs/auto_examples/plotting/images/root_plot_style_1.png has been created
 - time elapsed : 0.18 sec
building [html]: targets for 15 source files that are out of date
updating environment: 0 added, 18 changed, 0 removed
Traceback (most recent call last):modules                                                                                                                     
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in import_object
    __import__(self.modname)
ImportError: No module named rootcint
Traceback (most recent call last):rootpy.plotting                                                                                                             
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in import_object
    __import__(self.modname)
ImportError: No module named pyplot
Traceback (most recent call last):rootpy.root2array                                                                                                           
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in import_object
    __import__(self.modname)
ImportError: No module named root2array
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in import_object
    __import__(self.modname)
ImportError: No module named root2array.root2array

/private/tmp/rootpy/docs/modules/modules.rst:23: WARNING: autodoc can't import/find module 'rootpy.rootcint', it reported error: "No module named rootcint", please check your spelling and sys.path
/private/tmp/rootpy/docs/modules/rootpy.plotting.rst:55: WARNING: autodoc can't import/find module 'rootpy.plotting.pyplot', it reported error: "No module named pyplot", please check your spelling and sys.path
/private/tmp/rootpy/docs/modules/rootpy.root2array.rst:7: WARNING: autodoc can't import/find module 'rootpy.root2array', it reported error: "No module named root2array", please check your spelling and sys.path
/private/tmp/rootpy/docs/modules/rootpy.root2array.rst:15: WARNING: autodoc can't import/find module 'rootpy.root2array.root2array', it reported error: "No module named root2array.root2array", please check your spelling and sys.path
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] user_guide                                                                                                                           
writing additional files... (40 module code pages) _modules/index
 genindex py-modindex search
copying images... [100%] auto_examples/plotting/images/plot_matplotlib_hist_1.png                                                                             
copying downloadable files... [100%] /private/tmp/rootpy/docs/auto_examples/tree/object_branch.py                                                             
copying static files... done
dumping search index... done
dumping object inventory... done
build succeeded, 4 warnings.

Build finished. The HTML pages are in _build/html.
@pwaller pwaller was assigned Feb 24, 2013
@ndawe ndawe added a commit to ndawe/rootpy that referenced this issue Feb 26, 2013
@ndawe ndawe more incremental fixes for #142 b817a3a
@ndawe ndawe was assigned Feb 26, 2013
@cdeil
the rootpy project member
cdeil commented Mar 19, 2013

This issue has been resolved.

@cdeil cdeil closed this Mar 19, 2013
@ndawe
the rootpy project member
ndawe commented Mar 19, 2013

Just a note about printing __doc__: this is done so they show up in the example docs automatically. scikit-learn does the same thing and I quite like it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.