-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sphinx: Add inventory decoder for Sphinx #73
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #73 +/- ##
===========================================
- Coverage 89.81% 60.48% -29.33%
===========================================
Files 22 23 +1
Lines 746 777 +31
===========================================
- Hits 670 470 -200
- Misses 76 307 +231
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
It looks like those discussions, tools, and patches, revolve around the same topics. Maybe Markdown output has not been considered yet? Problem statements
Solutions
Proposals
NB: This post has been edited multiple times to progressively include relevant references. Feel free to suggest further edits. /cc @bskinn, @webknjaz, @chrisjsewell |
@amotl I also consider sphinx-doc/sphinx#8211 related |
output? Why? |
Dear @webknjaz, thanks a stack for your reply, and for suggesting the reference to your post sphinx-doc/sphinx#8211, I've added it to the summary note above. Markdown FTW
We usually reach out to Markdown generation these days, because the output can be used both as a text-only variant, and for upgrading to HTML by sending it through a corresponding Markdown renderer. In this way, text output from utility programs becomes super versatile, because it can be easily shared on all systems understanding Markdown, like GitHub and Discourse 1, which we use most of the time. By using Markdown, it was easy to convey different sections of output into a single output file. In this case, the inventory decoder needed to take into account that we wanted to include intersphinx references for multiple projects, effectively all inventory files listed in sphinx-inventories.txt. This has now converged into crate/crate-docs#105, not quite reaching the goal yet, because the generated Markdown became too large to be shared on behalf of a GitHub comment 🙈. General ThoughtsWe discovered the resources shared above per #73 (comment), including intersphinx-untangled, only after writing this little program just out of the need that we needed it, for the same reason you outlined at sphinx-doc/sphinx#8211, mostly frustration about needing to go the extra mile each time again and again to discover corresponding link targets from a huge documentation tree spanning multiple projects. So, we are effectively doing corresponding orentiation flights only in retrospective, now, disovering your work on the same topic. Thank you so much! Now, taking both sphobjinv and intersphinx-untangled into consideration, and also citing @chrisjsewell from https://github.com/orgs/sphinx-doc/discussions/12152:
Is the actual problem in (shippable) tooling here, that both sphobjinv and intersphinx-untangled work on a per-project level, but both @chrisjsewell and we are looking for a multi-project intersphinx summary output of some sorts? With kind regards, Footnotes
|
Do you mean that you would like something like the following, which would generate a Markdown-formatted report of the objects in the inventory: $ sphobjinv convert markdown objects.inv objects.md If so, that should be feasible, I'd be happy to take it as a feature request.
For It would be straightforward to write a wrapper that parses I don't consider it within |
Dear @bskinn, thanks a stack for your swift reply. Markdown SupportWe appreciate your understanding about Markdown output, and look forward for corresponding support in sphobjinv. If the code in this PR, and the blueprint at cratedb-sphinx-inventory-nodocs.md is helpful for that, please take it into consideration but also recognize it is just a minimal variant what could be done. For example, at the cost of increased file size, output could optionally use Markdown tables instead of just wrapping the main output verbatim into Multi-Project Support
We will be happy to explore this on behalf of
In this spirit, we are offering wdyt? With kind regards, |
Actually, now that I think about it further, I'm less certain whether direct Markdown output support in So, to make sure you're aware: >>> import sphobjinv as soi
>>> inv_local = soi.Inventory('/path/to/local/objects.inv')
>>> inv_remote = soi.Inventory(url='https://example.com/doc/latest/objects.inv') As a specific example: >>> import sphobjinv as soi
>>> ( inv := soi.Inventory(url="https://sphobjinv.readthedocs.io/en/latest/objects.inv") )
Inventory(project='sphobjinv', version='2.3', source_type=<SourceTypes.URL: 'url'>)
>>> ( obj := inv.objects[0] )
DataObjStr(name='sphobjinv.cli.convert', domain='py', role='module', priority='0', uri='cli/implementation/convert.html#module-$', dispname='-')
>>> print(f"\n## {obj.name}\n\n{obj.domain}:{obj.role} ({obj.priority})\nURI Within Docset: {obj.uri_expanded}\nDefault
display name: {obj.dispname_expanded}")
## sphobjinv.cli.convert
py:module (0)
URI Within Docset: cli/implementation/convert.html#module-sphobjinv.cli.convert
Default display name: sphobjinv.cli.convert So, I think |
All of those make sense! And, it seems to me there's already interest out there in multiple of those possible modes of multi-docset cross-reference compilation. Seems like a great thing to put energy into, to me. |
Thanks a stack for your guidance.
After actually learning about |
👍Good luck! Please ping me any time with questions. |
Filtering / DWIMRegarding DWIM, as you can see in tasks.py, we already need filtering capacities ( Other Intersphinx Community OperationsIn order to further increase community support and leverage, fragments of your nice operations could also be absorbed into code instead of hosting it on behalf of a text file in a gist, if you like that idea. My thinking is that if you already have a tool in hand that takes care about those topics in a generalized way, it would feel like an artifical boundary why it would only work on local projects.
In the same spirit like @webknjaz curated a list of popular Python projects on behalf of intersphinx-untangled in YAML format, and you did on behalf of the intersphinx_mappings.txt Gist, those lists could also be written down or wrapped through Python, in order to provide easy command-line access, right? So, instead of a possible reference research scenario like that:
What about such a command, effectively wrapping sphobjinv and the intersphinx_mappings gist into another variant of DWIM?
|
If I'm understanding you correctly---the >sphobjinv suggest -u https://matplotlib.org/stable/users/explain/quick_start.html#parts-of-a-figure draw
Attempting https://matplotlib.org/stable/users/explain/quick_start.html#parts-of-a-figure ...
... no recognized inventory.
Attempting "https://matplotlib.org/stable/users/explain/quick_start.html/objects.inv" ...
... HTTP error: 404 Not Found.
Attempting "https://matplotlib.org/stable/users/explain/objects.inv" ...
... HTTP error: 404 Not Found.
Attempting "https://matplotlib.org/stable/users/objects.inv" ...
... HTTP error: 404 Not Found.
Attempting "https://matplotlib.org/stable/objects.inv" ...
... inventory found.
------------------------------------------------------------------------
The intersphinx_mapping for this docset is LIKELY:
(https://matplotlib.org/stable/, None)
------------------------------------------------------------------------
Project: Matplotlib
Version: 3.8.3
10431 objects in inventory.
------------------------------------------------------------------------
1 result found at/above current threshold of 75.
:std:label:`draw_idle` So, if |
Yeah exactly like this. Thanks for telling me about the
Ah I see, it already has the auto-discovery on board. I should actually start using sphobjinv more instead of just extrapolating ;]. Thanks! |
Only if you provide it a link from within the docset where it lives on the web.
|
Hi again, thank you very much for this excellent conversation.
Cheers, |
About
Operational tasks about decoding Sphinx inventories.
References