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

Auto-translate doctests to pure Python, with import statements #35791

Closed
mkoeppe opened this issue Jun 17, 2023 · 1 comment · Fixed by #37083
Closed

Auto-translate doctests to pure Python, with import statements #35791

mkoeppe opened this issue Jun 17, 2023 · 1 comment · Fixed by #37083

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Jun 17, 2023

I think we would be able to generate import statements from the # optional (or # needs - #35779) annotations.

The necessary cross-referencing information is going to be in sage.features.sagemath.
See:

This would also have the huge advantage to support users that want to use sage as a normal python package without loading the sage environment.

+1.

I could imagine that the code blocks in the formatted HTML could offers tabs for different views, as is done for example in https://setuptools.pypa.io/en/latest/userguide/package_discovery.html: The example in monolithic Sage (goes through preparser, no imports), and the example in plain Python (some prettified version of the preparsed example + imports). This would also address @williamstein's comment (https://groups.google.com/g/sage-devel/c/utA0N1it0Eo/m/79aD4-RQAAAJ)

Originally posted by @mkoeppe in #35750 (comment)

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jan 14, 2024

The sphinx-inline-tabs package for this type of presentation in the HTML documentation is added in #37056

@vbraun vbraun closed this as completed in f81e21f Mar 25, 2024
@mkoeppe mkoeppe added this to the sage-10.4 milestone Mar 25, 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 a pull request may close this issue.

1 participant