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

[ENH, MRG] Make orphan of unused API entries #983

Merged
merged 76 commits into from
Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
ab30be0
first draft api usage
alexrockhill Jul 30, 2022
b18d201
fix tests
alexrockhill Jul 30, 2022
e7478c8
another fix
alexrockhill Jul 30, 2022
55e307c
fix tests
alexrockhill Aug 2, 2022
59eaeeb
turned out wonderfully
alexrockhill Aug 2, 2022
6f19381
fix tests, clean up
alexrockhill Aug 2, 2022
74214ef
remove modules
alexrockhill Aug 2, 2022
a00f988
fix circle?
alexrockhill Aug 2, 2022
8064f09
save version trying to remove modules
alexrockhill Aug 2, 2022
41fc0fd
remove module removing
alexrockhill Aug 2, 2022
082d165
fix tests
alexrockhill Aug 3, 2022
358c50a
remove cruft
alexrockhill Aug 3, 2022
bbe8ebd
improvements: no leaves, separate usage by module
alexrockhill Aug 4, 2022
5e12cdb
fix whitespace
alexrockhill Aug 4, 2022
8792557
rerun tests, passed locally
alexrockhill Aug 4, 2022
1b219ae
add colors
alexrockhill Aug 4, 2022
5cbf751
huh passes tests locally, retry
alexrockhill Aug 4, 2022
80bc095
sort used API modules
alexrockhill Aug 4, 2022
4498020
hook into docstring
alexrockhill Aug 8, 2022
61109b5
cruft
alexrockhill Aug 8, 2022
379a0a4
cruft, add option
alexrockhill Aug 8, 2022
2a2a6c4
fix test
alexrockhill Aug 8, 2022
cb7fe36
fix logging
alexrockhill Aug 8, 2022
d4b9419
remove option, caused error not sure how to fix
alexrockhill Aug 8, 2022
5ac9e32
fix test
alexrockhill Aug 8, 2022
686e6b0
reorganize
alexrockhill Aug 8, 2022
9b6ad9a
fix import
alexrockhill Aug 8, 2022
5544d9a
should work but doesn't make html files
alexrockhill Aug 9, 2022
cdd1ef1
cruft
alexrockhill Aug 9, 2022
e1a3baa
fixed one issue but still stuck
alexrockhill Aug 9, 2022
978f8e0
new idea, init before, didn't work
alexrockhill Aug 9, 2022
cd92645
finally figured it out (with Eric's help, thanksgit add -A) and I thi…
alexrockhill Aug 16, 2022
477ddd4
fix and improve tests
alexrockhill Aug 16, 2022
df96aa5
cruft
alexrockhill Aug 16, 2022
87a5899
fix tests2
alexrockhill Aug 16, 2022
7fc73f8
fix test3
alexrockhill Aug 16, 2022
5bcf8c3
remove builtin api entries
alexrockhill Aug 16, 2022
81fb081
check for graphviz
alexrockhill Aug 16, 2022
8a45554
cruft
alexrockhill Aug 16, 2022
120e5e5
add space
alexrockhill Aug 16, 2022
b4e8078
missing doc ignore
alexrockhill Aug 16, 2022
7498c0a
Merge remote-tracking branch 'upstream/master' into api
larsoner Aug 17, 2022
285dc5f
add documentation, fix graphs
alexrockhill Aug 18, 2022
0bbdc4f
try and fix
alexrockhill Aug 18, 2022
d3ab04f
fix circle, only images on build
alexrockhill Aug 18, 2022
a2ad4d9
revert and ask for help
alexrockhill Aug 18, 2022
01e27ef
eric fixes
alexrockhill Aug 19, 2022
7f053b5
fix flake
alexrockhill Aug 19, 2022
09f339b
Merge branch 'master' into api
larsoner Aug 19, 2022
1945420
make collapsable used entries
alexrockhill Aug 19, 2022
5aad065
Merge branch 'api' of https://github.com/alexrockhill/sphinx-gallery …
alexrockhill Aug 19, 2022
0849ad5
fix dependencies
alexrockhill Aug 19, 2022
1eb6a64
try adding to sphinx_rtd_theme to conda, hopefully doesn't take forev…
alexrockhill Aug 19, 2022
c19f4cc
try using pip
alexrockhill Aug 19, 2022
cad9b36
eric suggestion
alexrockhill Aug 19, 2022
a59e5e6
fix format
alexrockhill Aug 19, 2022
6f3bb60
Update sphinx_gallery/utils.py
alexrockhill Aug 20, 2022
16d4a1b
Update sphinx_gallery/utils.py
alexrockhill Aug 20, 2022
c89ed83
fix ignore entries, make graphs options, add usage graphs under details
alexrockhill Aug 23, 2022
5f84d97
Merge branch 'api' of https://github.com/alexrockhill/sphinx-gallery …
alexrockhill Aug 23, 2022
acd606d
make entire section optional, not in details
alexrockhill Aug 23, 2022
f45114d
change tests to match
alexrockhill Aug 23, 2022
096e2c0
change example doc as well
alexrockhill Aug 23, 2022
4e68711
fix test
alexrockhill Aug 23, 2022
789dd18
fix test
alexrockhill Aug 23, 2022
8438550
match whole name
alexrockhill Aug 23, 2022
345e388
add config checks
alexrockhill Aug 24, 2022
479d2f8
fix percentages
alexrockhill Aug 24, 2022
30d6e9e
Lucy review
alexrockhill Aug 25, 2022
441657a
fix link
alexrockhill Aug 25, 2022
45fdb88
fix link
alexrockhill Aug 25, 2022
5cc9ec6
one more try
alexrockhill Aug 25, 2022
8ecd9c5
add orange description
alexrockhill Aug 26, 2022
3142579
fix color
alexrockhill Aug 26, 2022
6601406
fix comment
alexrockhill Aug 26, 2022
7ebbeec
Update doc/configuration.rst
alexrockhill Aug 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
sudo apt-get --no-install-recommends install -yq \
libosmesa6 libglx-mesa0 libopengl0 libglx0 libdbus-1-3 \
libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-xfixes0 libxcb-xinerama0 \
texlive texlive-latex-extra latexmk optipng tex-gyre
texlive texlive-latex-extra latexmk optipng tex-gyre graphviz
sudo ln -s /usr/lib/x86_64-linux-gnu/libxcb-util.so.0 /usr/lib/x86_64-linux-gnu/libxcb-util.so.1
- run:
name: Merge with upstream
Expand Down Expand Up @@ -41,7 +41,7 @@ jobs:
# PyVista 0.33 needs VTK >= 9.0.1, but Mayavi breaks with 9.1... so just pin PyVista for now
command: |
pip install --progress-bar off --only-binary ":all:" numpy matplotlib "pyqt5!=5.15.2,!=5.15.3" "vtk<=9.0.1"
pip install --progress-bar off --user seaborn statsmodels sphinx_rtd_theme pillow joblib sphinx pytest "traits<6.3.0" mayavi "pyvista<0.33" memory_profiler ipython plotly
pip install --progress-bar off --user seaborn statsmodels sphinx_rtd_theme pillow joblib sphinx pytest "traits<6.3.0" mayavi "pyvista<0.33" memory_profiler ipython plotly graphviz
- save_cache:
key: cache-pip
paths:
Expand Down
4 changes: 2 additions & 2 deletions continuous_integration/azure/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if [ "$DISTRIB" == "conda" ]; then
echo "##vso[task.prependpath]$CONDA/bin"
export PATH=${CONDA}/bin:${PATH}
CONDA_TO_INSTALL="$@"
CONDA_TO_INSTALL="$CONDA_TO_INSTALL python=$PYTHON_VERSION pip numpy setuptools matplotlib pillow pytest pytest-cov coverage seaborn statsmodels 'plotly>=4.0' joblib flake8 wheel libiconv"
CONDA_TO_INSTALL="$CONDA_TO_INSTALL python=$PYTHON_VERSION pip numpy setuptools matplotlib pillow pytest pytest-cov coverage seaborn statsmodels 'plotly>=4.0' joblib flake8 wheel libiconv graphviz"
PIP_DEPENDENCIES="$@"
PIP_DEPENDENCIES="$PIP_DEPENDENCIES sphinx_rtd_theme check-manifest"
if [ "$PYTHON_VERSION" != "3.7" -o "$LOCALE" != "C" ]; then
Expand Down Expand Up @@ -62,7 +62,7 @@ elif [ "$DISTRIB" == "nightly" ]; then
elif [ "$DISTRIB" == "minimal" ]; then
python -m pip install --upgrade . pytest pytest-cov coverage
elif [ "$DISTRIB" == "ubuntu" ]; then
sudo apt-get install --fix-missing python3-numpy python3-matplotlib python3-pip python3-coverage optipng
sudo apt-get install --fix-missing python3-numpy python3-matplotlib python3-pip python3-coverage optipng graphviz
python3 -m pip install --upgrade pip setuptools
python3 -m pip install -r dev-requirements.txt | cat
python3 -m pip install --upgrade pytest pytest-cov coverage
Expand Down
1 change: 1 addition & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ flake8
check-manifest
plotly
absl-py
graphviz
2 changes: 2 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx_gallery.gen_gallery',
'sphinx.ext.graphviz',
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -397,6 +398,7 @@ def setup(app):
'matplotlib_animations': True,
'image_srcset': ["2x"],
'nested_sections': False,
'show_api_usage': True,
}

# Remove matplotlib agg warnings from generated doc when using plt.show
Expand Down
34 changes: 34 additions & 0 deletions doc/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ file:
- ``log_level`` (:ref:`log_level`)
- ``capture_repr`` and ``ignore_repr_types`` (:ref:`capture_repr`)
- ``nested_sections`` (:ref:`nested_sections`)
- ``api_usage_ignore`` (:ref:`api_usage_ignore`)
- ``show_api_usage`` (:ref:`show_api_usage`)

Some options can also be set or overridden on a file-by-file basis:

Expand Down Expand Up @@ -1861,3 +1863,35 @@ This index file will contain descriptions for the whole gallery as well as for
each subsection, and a specific toctree for each subsection.
In particular, sidebars generated using these toctrees might not reflect the
actual section / folder structure.

.. _show_api_usage:

Showing API Usage
=================

Optionally, graphs can be made of the usage of each API entry in examples,
grouped by module. In large projects, there are many modules so this is
set to ``False`` by default. Setting ``show_api_usage`` to ``True``
will make one graph per module showing all of the API entries connected to
the example that they are used in. This could be helpful for making a map
of which examples to look at if you want to learn about a particular
module. Note: documentation and graphs of which API examples are unused
will always be made, only the documentation and graphs of which
examples each API entry are used in is controlled by this configuration
parameter. ``graphviz`` is required for making the unused and used API
entry graphs. See the
`Sphinx-Gallery API usage documentation and graphs <sg_api_usage.html>`_
for example. This report can be found in the sphinx output directory under
``sg_api_usage.html``.

.. _api_usage_ignore:

Ignoring API entries
====================

By default, ``api_usage_ignore='.*__.*__'`` ignores files that match this
regular expression in documenting and graphing the usage of API entries
within the example gallery. This regular expression can be modified to
ignore any kind of file that should not be considered. The default regular
expression ignores functions like ``__len__()`` for which it may not be
desirable to document if they are used in examples.
Loading