Skip to content

numpydoc_xref_aliases always triggers sphinx rebuild #231

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

Closed
bashtage opened this issue Aug 21, 2019 · 10 comments
Closed

numpydoc_xref_aliases always triggers sphinx rebuild #231

bashtage opened this issue Aug 21, 2019 · 10 comments

Comments

@bashtage
Copy link

Sphinx 2.2 reports the reason why a rebuild is needed. In a pretty simple demo site I am seeing:

updating environment: [config changed ('numpydoc_xref_aliases')] 179 added, 0 changed, 0 removed

as part of the build. This suggests that something about numpydoc_xref_aliases makes sphinx think that it is changing. I have not defined this variable, and I have no intersphinx.

@bashtage
Copy link
Author

I am using master,

In [1]: import numpydoc
The history saving thread hit an unexpected error (OperationalError('attempt to write a readonly database')).History will not be written to the database.

In [2]: numpydoc.__version__
Out[2]: '1.0.0.dev0'

#226 seems related.

@bashtage
Copy link
Author

When I load the pickle I see

In [11]: pkl.config.numpydoc_xref_aliases
Out[11]: 
{'None': ':data:`python:None`',
 'bool': ':ref:`bool <python:bltin-boolean-values>`',
 'boolean': ':ref:`bool <python:bltin-boolean-values>`',
 'True': ':data:`python:True`',
 'False': ':data:`python:False`',
 'list': ':class:`python:list`',
 'tuple': ':class:`python:tuple`',
 'str': ':class:`python:str`',
 'string': ':class:`python:str`',
 'dict': ':class:`python:dict`',
 'float': ':class:`python:float`',
 'int': ':class:`python:int`',
 'callable': ':func:`python:callable`',
 'iterable': ':term:`python:iterable`',
 'sequence': ':term:`python:sequence`',
 'contextmanager': ':func:`python:contextlib.contextmanager`',
 'namedtuple': ':func:`python:collections.namedtuple`',
 'generator': ':term:`python:generator`',
 'array': 'numpy.ndarray',
 'ndarray': 'numpy.ndarray',
 'np.ndarray': 'numpy.ndarray',
 'array-like': ':term:`numpy:array_like`',
 'array_like': ':term:`numpy:array_like`',
 'scalar': ':ref:`scalar <numpy:arrays.scalars>`',
 'RandomState': 'numpy.random.RandomState',
 'np.random.RandomState': 'numpy.random.RandomState',
 'np.inf': ':data:`numpy.inf`',
 'np.nan': ':data:`numpy.nan`',
 'numpy': ':mod:`numpy`'}

which are the defaults. Shouldn't this be an empty dict since I'm not passing in any options?

@larsoner
Copy link
Collaborator

#226 should have fixed this as it no longer modifies numpydoc_xref_aliases directly. Are you certain you're testing on latest master?

@bashtage
Copy link
Author

Completely. I did an uninstall and then pip install git+https:// to make sure. I also verified the 226 function is present. Perhaps something new in Sphinx 2.2, which is pretty fresh?

@larsoner
Copy link
Collaborator

I run sphinx master most of the time and do not see this problem.

Are you sure your sphinx-build command is using that numpydoc install, though? For example if you add a raise RuntimeError in the func from 226 does your build break?

@bashtage
Copy link
Author

100%. I ran sphinx in a debug build and stopped it in the #226 function.

@bashtage
Copy link
Author

I'm using autosummary, not that this should make a difference.

@larsoner
Copy link
Collaborator

I can't replicate on master with our tinybuild env:

larsoner@bunk:~/python/numpydoc/numpydoc/tests/tinybuild$ make
rm -rf _build/*
rm -rf generated/
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v3.0.0+/aa290a1
making output directory... done
loading intersphinx inventory from https://docs.python.org/3/objects.inv...
[autosummary] generating autosummary for: index.rst
[autosummary] generating autosummary for: /home/larsoner/python/numpydoc/numpydoc/tests/tinybuild/generated/numpydoc_test_module.MyClass.rst, /home/larsoner/python/numpydoc/numpydoc/tests/tinybuild/generated/numpydoc_test_module.my_function.rst
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 3 added, 0 changed, 0 removed
reading sources... [100%] index                                                                                                                                                     
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index                                                                                                                                                      
generating indices...  genindex py-modindexdone
writing additional pages...  searchdone
copying static files... ... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded.

The HTML pages are in _build/html.
larsoner@bunk:~/python/numpydoc/numpydoc/tests/tinybuild$ make html
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v3.0.0+/aa290a1
loading pickled environment... done
[autosummary] generating autosummary for: generated/numpydoc_test_module.MyClass.rst, generated/numpydoc_test_module.my_function.rst, index.rst
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 0 changed, 0 removed
looking for now-outdated files... none found
no targets are out of date.
build succeeded.

The HTML pages are in _build/html.

Do you see the same thing? If so then there must be some difference between our tinybuld and your doc build that causes the problem.

@bashtage
Copy link
Author

Sorry for the trouble. Turns out it was a convoluted case of PEBCAK.

@larsoner
Copy link
Collaborator

:) No problem, glad it works properly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants