-
Notifications
You must be signed in to change notification settings - Fork 12
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
Don't warn on missing inventory in import statement if import target resolves #103
Comments
Thanks for submitting! I might have misunderstood your details, so I'll try the example later myself. But at a glance everything seems to be working as intended, because we do want to link import statements as well. You didn't expect missing modules to warn as well, and I can see how that would be beneficial here, but I'm quite cautious to start ignoring them because arguably if you've asked for extra warnings you want them all. Similarly, leaving the top-level namespace out of the object inventory is a choice (or omission) by the library's developers. |
I suppose in the working example https://github.com/sqlalchemy/sqlalchemy/blob/main/doc/build/orm/extensions/declarative/index.rst, perhaps it's Fwiw I'm happy for modules that literally dont exist to warn, but in this case, you're For example It's not like you could omit the |
Could be, although I only know that it happens on
Fair enough, but as a library developer, if I wanted to be careful and make sure that all links work, I'd want to know that the top level namespace isn't referenced anywhere. I'd want to add it along with any submodules as well. And I'd want to structure my library so that the module links make sense and take a user to sensible locations, not just random modules where a class happens to be defined. I feel like the warnings help in that case. But this doesn't help you, does it 😅 and I think having yet another configuration option for "show me warnings but not quite as much" seems a bit weird. So what's your current situation? Would you consider just checking the warnings once and leaving them off once you've dealt with every case you have control over?
I think we can't assume that the module is documented on the same page as its objects. |
I was hoping to leave these one and set Naively it seems like the logic i think i want is (using vocab that hopefully matches your code and makes sense): If a given From my perspective, it seems like a progression of increasing strictness (rather than "show me warnings but not quite as much") especially because I can't actually avoid triggering this kind of warning because the |
That would be a nice use of the option. Btw, look out for sphinx-doc/sphinx#10110 for -W not working quite correctly in our case. But, I have a slight issue with the proposition that we should use other missing inventory items (or a whole module) as the marker. Firstly, modules may have different names to the libraries that they are shipped with. A common one is Maybe we could have a directive for suppressing warnings in a particular example. I think that would suppress all warnings. But I'll have to think about it. How would that sound? Not a promise though 😄 |
I dont think i'm suggesting using other missing items as a marker. from sqlalchemy import Column If So i'm just suggesting taking into account whether the right hand side of |
Thanks for clarifying. I'm not willing to dilute the value of our extra warnings by default though, so I've opened #104 to consider other ways of suppressing warnings. I still think that any failed inventory access should produce a warning if you've explicitly asked for it. |
Issue
Example given below. Generally, it seems that many modules or packages will erroneously warn, presumably when they dont have dedicated pages.
In the below example,
sqlalchemy.ext.declarative
resolves and is clickable, as it brings you to the correctly annotated page.Versus
from sqlalchemy.orm import declarative_base
wheresqlalchemy.orm
has no corresponding page and warngs, butdeclarative_base
resolves correctly.Expected behavior
Perhaps for successfully resolved imported items, the package or module in which it resides should not warn if there's no corresponding link for it.
That still leaves
import sqlalchemy
. Naively i might expect that to link to the root of the docs if there's otherwise no resolved link for it.Steps to reproduce
Although, and this may still be user error, I'm seeing:
for
with
Column
,types
,sqlalchemy.ext.declarative
, and the 2nddeclarative_base
are clickable.The text was updated successfully, but these errors were encountered: