-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Added test case for importing a class from a private submodule into a public one #190
Conversation
…into a public one
e689b14
to
1775419
Compare
For now this just adds the regression test. One way to solve that specific use case is to do:
however this could get tedious if we ever did use this pattern of private submodules extensively in a package. I wonder if actually what we want to do is to have an option to respect |
I think I found the solution - the issue is that currently we were not trusting |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #190 +/- ##
==========================================
+ Coverage 90.25% 90.29% +0.04%
==========================================
Files 28 30 +2
Lines 1201 1206 +5
==========================================
+ Hits 1084 1089 +5
Misses 117 117 ☔ View full report in Codecov by Sentry. |
@@ -0,0 +1,5 @@ | |||
from ._private import Camelot |
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.
Can we have a test where we import from a non-private module? I mean those cases worked (before this PR), so I just want to make sure that keeps being the case.
(although I see cases where they listed in multiple __all__
s, probably those should be cleaned up, and (which is beyond scope here) preferably errored out by sphinx-automodapi?)
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.
Sounds good, will adjust the test
I'm not familiar with the internals of this package. I know it uses
The relevant Is that what's happening here? |
Camelot | ||
======= | ||
|
||
.. currentmodule:: sphinx_automodapi.tests.example_module.public | ||
|
||
.. autoclass:: Camelot | ||
:show-inheritance: |
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.
@nstarman we actually generate the stub files ourselves and they contain individual eg autoclass calls so the fix has to be and is in our code.
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.
Then all LGTM. The results files seem reasonable :)
In future we might want to re examine using Sphinx directly to generate all the API docs (this package predates the ability of Sphinx to generate stub files) |
I really wondered about this, too as a lot has happened in the past 10 years on sphinx land... |
@bsipocz - I adjusted the test as you requested to include a class imported from a public submodule |
Re: Using Sphinx directly -- We have issue at #147 |
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.
Looks good now, thanks @astrofrog!
Yes, I think we're circling back to that question but I can't recall if someone looked into it carefully and made a full assessment. Btw, things like these can be funded short projects; as it's absolutely in the remit of long-term sustainability and maintenance (and IMO has a better impact on the project than bombarding the codebase with automated ruff and such refactorings forcing a lot of rebase and conflicts on PRs and such) |
Would be nice! Cycle 4 already ongoing... I wonder if someone wants to take this on for Cycle 5 or some other alternate funding. |
Thanks, all! @astrofrog , do you plan to do a release here or you need help? |
Already done! (v0.18) |
Investigating the issue from astropy/astropy#16974