-
-
Notifications
You must be signed in to change notification settings - Fork 146
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
Add scanfilter to Module constructor #139
base: master
Are you sure you want to change the base?
Conversation
Can you elaborate? The industry rightfully doesn't favor monkey-patching private members ... |
Since you're familiar with the issue, what is your opinion of the proposed override using __pdoc__ = {"some.package.module": False} # Skips some.package.module and descendants |
also move _iter_modules out of method scope
Yes, indeed. I have a very singular use case - not at all common - where I basically build a virtual tree of packages that does not exist on the disk, i.e. I want to override the whole package tree scanning. Now, the clean way to achieve this would be to add some kind of |
As far as I understand it, My use case is building docs for third-party packages (e.g. bokeh, scikit-learn) that I don't control - I need to externally exclude subpackages. Some of these subpackages include test packages and experimental stuff with esoteric dependencies, or won't run at all due to legacy problems or hard exceptions (stuff like "this package is obsolete, don't use it", which happens with plotly). Currently pdoc will stop on the importing on these subpackages. So I need to intercept them before they even get parsed or imported. Now, my whole use case of using pdoc on libs that already have docs might of course seem nutty. But pdoc is the best tool out there to try to build unified documentation for a set of libraries. |
Not necessarily. As the docs state:
So IIUC, if you set: __pdoc__ = {'sklearn': False} the whole of scikit-learn should become disabled. This doesn't prevent the loud importation of odd or "broken" modules, though.
If you have
As an alternative approach, why not create and clean a tree of files on disk? Filesystem is a great abstraction. |
456869b
to
94d26e8
Compare
One way to address #99: adds a new
scanfilter
parameter that allows excluding specific submodules/sub trees.This also moves
_iter_modules
out of the method scope, which makes it monkey-patchable for extreme cases, where one would want to override the whole package scan logic (which I need to do right now).