python-sphinx

Basic Syntax of comments and docstrings in Python code

自作多情 提交于 2020-07-09 12:04:57
问题 I'm learning how to use Sphinx to create a documentation for my code. After I saw some examples like this: def complex(real=0.0, imag=0.0): """Form a complex number. Keyword arguments: real -- the real part (default 0.0) imag -- the imaginary part (default 0.0) """ if imag == 0.0 and real == 0.0: return complex_zero ... What is the language used in comments to make Sphinx understand and catch them? Without this syntax and logic, Sphinx doesn't see the comments in my code and when I generate

Basic Syntax of comments and docstrings in Python code

天涯浪子 提交于 2020-07-09 12:04:52
问题 I'm learning how to use Sphinx to create a documentation for my code. After I saw some examples like this: def complex(real=0.0, imag=0.0): """Form a complex number. Keyword arguments: real -- the real part (default 0.0) imag -- the imaginary part (default 0.0) """ if imag == 0.0 and real == 0.0: return complex_zero ... What is the language used in comments to make Sphinx understand and catch them? Without this syntax and logic, Sphinx doesn't see the comments in my code and when I generate

Sphinx cannot find module but Python can

浪子不回头ぞ 提交于 2020-07-08 12:04:41
问题 Sphinx, the Python documentation generator, does not seem to understand my modules/packages. On make clean && make html , when this code is ran: from statstuff import statistics as stats , it outputs: ImportError: No module named 'statstuff' I have also tried to reference the module as from . import statistics as stats , since the modules are in the same package, but Sphinx outputs: SystemError: Parent module '' not loaded, cannot perform relative import Also, the config.py seems to be

Sphinx cannot find module but Python can

你离开我真会死。 提交于 2020-07-08 12:03:12
问题 Sphinx, the Python documentation generator, does not seem to understand my modules/packages. On make clean && make html , when this code is ran: from statstuff import statistics as stats , it outputs: ImportError: No module named 'statstuff' I have also tried to reference the module as from . import statistics as stats , since the modules are in the same package, but Sphinx outputs: SystemError: Parent module '' not loaded, cannot perform relative import Also, the config.py seems to be

Is it possible to hide Python function arguments in Sphinx?

邮差的信 提交于 2020-07-08 03:58:11
问题 Suppose I have the following function that is documented in the Numpydoc style, and the documentation is auto-generated with the Sphinx autofunction directive: def foo(x, y, _hidden_argument=None): """ Foo a bar. Parameters ---------- x: str The first argument to foo. y: str The second argument to foo. Returns ------- The barred foo. """ if _hidden_argument: _end_users_shouldnt_call_this_function(x, y) return x + y I don't want to advertise the hidden argument as part of my public API, but it

Using Sphinx Extension to convert svg to pdf

喜你入骨 提交于 2020-07-06 19:20:16
问题 My company is using Sphinx to create the manuals for our products. Our products are shipped with PDF and HTML documentations. We are using Windows as a sole developer environment. A necessary requirement is to generate both kind of format from the same sources (*.rst files). A legacy documentation uses extensive SVG-Images, but the sphinx build format latex does not support SVG-Files in \includegraphics{} environments. Now I found the promising Sphinx-Extension sphinx.ext.imgconverter and

Can Python autodoc tuple/list format be changed?

牧云@^-^@ 提交于 2020-07-06 11:13:48
问题 I have some Python code in a project that I want to document, however I have run into a problem with documenting class constants that are tuples or lists. See code and image below. It's very hard to read the documentation when there are several items on each row and the lines are split randomly. Can the tuple be formatted in another way? Like each element on a new row. I still want to use autodoc (on the whole file), so manually adding the classes is not acceptable. I can change the code,

How to turn warnings into errors when building sphinx documentation with setuptools?

南楼画角 提交于 2020-07-06 08:22:14
问题 I am using setuptools to build my sphinx documentation of a python project ( python setup.py build_sphinx ). As found on, e.g., this site, I have configured the build process using the setup.cfg: [build_sphinx] source-dir = docs/source build-dir = docs/build all_files = 1 However, I would like to add some more options. Specifically, I would like to turn all warnings into errors, which would work with the sphinx-build command with the option -W : sphinx-build --help Sphinx v1.1.3 Usage: /usr

How to turn warnings into errors when building sphinx documentation with setuptools?

北战南征 提交于 2020-07-06 08:21:12
问题 I am using setuptools to build my sphinx documentation of a python project ( python setup.py build_sphinx ). As found on, e.g., this site, I have configured the build process using the setup.cfg: [build_sphinx] source-dir = docs/source build-dir = docs/build all_files = 1 However, I would like to add some more options. Specifically, I would like to turn all warnings into errors, which would work with the sphinx-build command with the option -W : sphinx-build --help Sphinx v1.1.3 Usage: /usr

random.choice error due to np.linspace and np.logspace during Sphinx build

独自空忆成欢 提交于 2020-07-03 13:24:06
问题 I'm having a hard time with Sphinx where it won't import all the modules. There error it is encountering reads as follows: File “file path”, line 36, in Individual ml_params = {'C': random.choice(svr_C), 'gamma': random.choice(svr_gamma)} File "/usr/local/Cellar/sphinx-doc/3.1.1/libexec/lib/python3.8/random.py", line 290, in choice raise IndexError('Cannot choose from an empty sequence') from None IndexError: Cannot choose from an empty sequence I set sphinx up per the instructions in the