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

Intersphinx for cvxopt, cvxpy, cypari2, cysignals, flint, fpylll, gmpy2, ipywidgets, matplotlib, mpmath, networkx, numpy, rpy2, scipy, sympy #37575

Merged
merged 22 commits into from
Mar 31, 2024

Conversation

mkoeppe
Copy link
Contributor

@mkoeppe mkoeppe commented Mar 9, 2024

Intersphinx allows us to refer to functions and classes in other projects using the standard Sphinx roles :func:, :class:, ...

Examples in the documentation preview:

Based on a rebased version of #29231 by @mwageringel. In addition to the scipy intersphinx done in #29231, here we add a number of relevant Python libraries, as well as flint, whose docs are built with Sphinx as well.

To address concerns in the discussion there about the docbuild contacting remote servers for the inventory files, here we instead vendor the inventory files:

$ ls -l src/doc/common/_vendor
-rw-r--r--  1 mkoeppe  staff    1942 Mar  9 21:20 cvxopt.inv
-rw-r--r--  1 mkoeppe  staff   13251 Mar  9 21:20 cvxpy.inv
-rw-r--r--  1 mkoeppe  staff   10728 Mar  9 21:20 cypari2.inv
-rw-r--r--  1 mkoeppe  staff     775 Mar  9 21:20 cysignals.inv
-rw-r--r--  1 mkoeppe  staff  246266 Mar  9 21:20 flint.inv
-rw-r--r--  1 mkoeppe  staff    1603 Mar  9 21:20 fpylll.inv
-rw-r--r--  1 mkoeppe  staff    2891 Mar  9 21:20 gmpy2.inv
-rw-r--r--  1 mkoeppe  staff   10934 Mar  9 21:20 ipywidgets.inv
-rw-r--r--  1 mkoeppe  staff  105887 Mar  9 21:20 matplotlib.inv
-rw-r--r--  1 mkoeppe  staff    3115 Mar  9 21:20 mpmath.inv
-rw-r--r--  1 mkoeppe  staff   51830 Mar  9 21:20 networkx.inv
-rw-r--r--  1 mkoeppe  staff   78006 Mar  9 21:20 numpy.inv
-rw-r--r--  1 mkoeppe  staff    1449 Mar  9 21:20 pplpy.inv
-rw-r--r--  1 mkoeppe  staff  136166 Mar  9 21:20 python.inv
-rw-r--r--  1 mkoeppe  staff    3289 Mar  9 21:20 rpy2.inv
-rw-r--r--  1 mkoeppe  staff  112691 Mar  9 21:20 scipy.inv
-rw-r--r--  1 mkoeppe  staff   55596 Mar  9 21:20 sympy.inv

This extends our existing practice with the Python inventory (moved here from its previous location src/doc/common/python3.inv). The new command sage -python -m sage_docbuild.vendor retrieves the latest versions of these files. (Distribution notes: These files are not installed, as they are only needed at the build time of the documentation. After #36730, they are part of the sdist of sagemath-doc-html, but not part of the wheel.)

By setting SAGE_DOC_REMOTE_INVENTORIES=yes, this can be overridden, as previously suggested in #29231 (comment). In this case it is first tried to contact the remote servers.

Fixes #29231 (stalled since 2020).
Fixes #27164 (stalled since 2019).

Outside the scope of this PR:

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation accordingly.

⌛ Dependencies

@mkoeppe mkoeppe changed the title Intersphinx for scipy Intersphinx for scipy and flint Mar 10, 2024
@mkoeppe mkoeppe changed the title Intersphinx for scipy and flint Intersphinx for cvxopt, cvxpy, cypari2, cysignals, flint, fpylll, gmpy2, ipywidgets, matplotlib, mpmath, networkx, numpy, rpy2, scipy, sympy Mar 10, 2024
@mkoeppe mkoeppe self-assigned this Mar 10, 2024
@@ -27,8 +27,8 @@
order equations, return list of points.

- :func:`desolve_odeint` - Solve numerically a system of first-order ordinary
differential equations using ``odeint`` from `scipy.integrate module.
<https://docs.scipy.org/doc/scipy/reference/integrate.html#module-scipy.integrate>`_
differential equations using :func:`~scipy:scipy.integrate.odeint` from
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure to understand the meaning of the ~. Here we have :func:`~scipy:scipy.integrate.odeint`, but line 1502 you use :func:`scipy:scipy.integrate.odeint`. Why and why is it needed ?

Copy link
Contributor Author

@mkoeppe mkoeppe Mar 13, 2024

Choose a reason for hiding this comment

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

The ~ gives short links, such as "odeint()" instead of "scipy.integrate.odeint()"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here I use it because the text already says from what module it comes.

@@ -594,8 +594,8 @@ cdef class Matrix_double_dense(Matrix_numpy_dense):

ALGORITHM:

Computation is performed by the ``norm()`` function of
the SciPy/NumPy library.
Computation is performed by the :func:`~scipy:scipy.linalg.norm`
Copy link
Contributor

Choose a reason for hiding this comment

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

again, here we have a ~ but not line 742.

``'graphml'`` | :func:`networkx.readwrite.graphml.write_graphml`
``'multiline_adjlist'`` | :func:`networkx.readwrite.multiline_adjlist.write_multiline_adjlist`
``'pajek'`` | :func:`networkx.readwrite.pajek.write_pajek`
``'yaml'`` | :func:`networkx.readwrite.nx_yaml.write_yaml`
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this function simply does not exist any more in current versions of networkx. Is it tested anywhere?

Copy link
Contributor

Choose a reason for hiding this comment

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

It is no longer in networkx (https://networkx.org/documentation/stable/reference/readwrite/index.html).

It's not tested in method export_to_file and according to the code of the method, it is no longer in the list of considered formats. I think it has been removed sometime ago and we have forgotten to remove it from the documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I remove it here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in a55ee28

src/sage/graphs/generators/families.py Outdated Show resolved Hide resolved
Copy link

Documentation preview for this PR (built with commit a55ee28; changes) is ready! 🎉

Copy link
Contributor

@dcoudert dcoudert left a comment

Choose a reason for hiding this comment

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

I have checked several links in the generated documentation and it looks good.

However, I have not checked what may happen without Internet connection for both the construction of the documentation and its consultation on a local installation. Should someone check the before accepting this PR ?

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 16, 2024

Thanks!

I'll try right now, so let me disconnNO CARRIER

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 16, 2024

Tested: It builds correctly without access to the Internet, the HTML pages render correctly without access, obviously clicking the links to the external documentation give an error page, but after enabling access to the Internet, the links work.

Copy link
Contributor

@dcoudert dcoudert left a comment

Choose a reason for hiding this comment

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

Thanks for testing. I think it's an interesting feature.

LGTM.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 16, 2024

Thanks for the review!

vbraun pushed a commit to vbraun/sage that referenced this pull request Mar 30, 2024
…ppl, qepcad, scip, singular, soplex

    
<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

We create a standard way to refer to the online manuals of these
packages, which are generated by tools other than Sphinx and therefore
cannot be linked to using Intersphinx.

This extends what has been already done with Pari.

Examples:
- [Examples in the Developer Guide](https://deploy-preview-37598--
sagemath.netlify.app/html/en/developer/sage_manuals#hyperlinks)

Fixes sagemath#27495.

Outside of the scope of this PR:
- adding such extlinks everywhere
- working with upstream projects to upgrade to better documentation
tools
- projects that can be linked to using Intersphinx; that's sagemath#37575
- any consideration how to link instead to local copies of those
manuals, whether installed from SPKG or system packages.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#37598
Reported by: Matthias Köppe
Reviewer(s): Kwankyu Lee, Matthias Köppe, Max Horn
@vbraun vbraun merged commit 6406386 into sagemath:develop Mar 31, 2024
18 checks passed
@mkoeppe mkoeppe added this to the sage-10.4 milestone Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add intersphinx mapping for SciPy link sphinx docs of Sage components in reference manual
3 participants