-
Notifications
You must be signed in to change notification settings - Fork 136
Add xtensor docs #1504
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
base: main
Are you sure you want to change the base?
Add xtensor docs #1504
Conversation
a703ae4
to
d472f62
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other than fixing the environment everything looks good, there are a couple other things that could be done but also feel free to merge with just fixing the environment
doc/conf.py
Outdated
warnings.warn(f"Could not find source code for {domain}:{info}") | ||
filename = info["module"].replace(".", "/") + ".py" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warnings.warn(f"Could not find source code for {domain}:{info}") | |
filename = info["module"].replace(".", "/") + ".py" | |
filename = obj.__module__.replace(".", "/") + ".py" |
I would not commit the warning, it is useful for debugging but objects that are instances of Ops like part of the pytensor.tensor.math
module being an instance of Elemwise will end up here and I think it is fine.
Using obj.__module__
instead of info["module"]
should always point to the file where things are implemented, not a potentially higher module where things are exposed and documented at. Example again from math module, log
is exposed as pytensor.tensor.log
and documented there, so info["module"]
means the link points to pytensor/tensor.py
whereas using obj.__module__
makes it point to pytensor/tensor/math.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by obj you mean fn
that would be returned by find_source
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, I didn't realize obj
is only available within the function. I will take another look, we might need 3 levels of granularity:
- try to get
obj
if works go ahead to 2, otherwise useinfo["module"]
- try to get sourcefile and sourcelines, if works go to 3, otherwise use
obj.__module__
- Format sourcefile and line numbers into url.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed some changes, can you check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not everything that was an object ended up having a module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(exception: 'wrapper_descriptor' object has no attribute '__module__')
if I raise in the most nested except AttributeError now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be because of the wrappers, I will try if calling inspect.unwrap
on obj like numpy does helps with some of these. In general looks good, and from the docs preview it looks like we are getting to the right lines or at least the right file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the unwrap doesn't seem to fix anything. But I think it is working well enough after your updates
doc/library/xtensor/type.md
Outdated
## XTensorVariable creation functions | ||
|
||
```{eval-rst} | ||
.. currentmodule:: pytensor.xtensor.type | ||
.. autosummary:: | ||
:toctree: generated/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similar to previous comment, I might remove the toctree generated (keep autosummary here though) so all the pages have the same look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does autosummary do btw?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
goes over provided inputs in order to define their API pages from templates. The templates use autodoc
directives so it is a smallish layer on top of it that is often more convenient (e.g. allows to choose between everything embedded within the same page like pytensor has or object-specific pages all linked through the toctree like pymc has)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried not doing toctree generated, and listing members explicitly, but somehow the page is empty. Can you take a look?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taking a look
We get a lot of |
A lot of? For the pages we have added or other ones? This means those pages are not reachable through the navbar+sidebar navigation. Unless there are referenced in another page or the users magically know their url they won't be able to reach them. Ideally there wouldn't be toctree warnings, if we really want to have pages that are not on the toctree and are only referenced inline somewhere else they should include |
Co-authored-by: Oriol Abril-Pla <[email protected]>
Co-authored-by: Oriol Abril-Pla <[email protected]>
Co-authored-by: Oriol Abril-Pla <[email protected]>
Okay not a lot:
Some are the ones I removed that are tracked in #1512 the others are dot, concat which is odd, and the xtensor.type, that I mentioned is coming up blank
|
The ones in the generated folder is because they were automatically generated by autosummary at some point when |
If you are checking out the branch already feel free to push the removal of readme.md |
Codecov ReportAttention: Patch coverage is
❌ Your patch check has failed because the patch coverage (56.72%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #1504 +/- ##
==========================================
- Coverage 81.98% 81.82% -0.16%
==========================================
Files 231 231
Lines 52274 52467 +193
Branches 9206 9338 +132
==========================================
+ Hits 42856 42931 +75
+ Misses 7106 7095 -11
- Partials 2312 2441 +129
🚀 New features to boost your workflow:
|
It was |
That seems like a very fun afternoon xD |
Closes #1502
📚 Documentation preview 📚: https://pytensor--1504.org.readthedocs.build/en/1504/