-
-
Notifications
You must be signed in to change notification settings - Fork 196
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
[Question] Is there any way to prevent pdoc from documenting method objects? #662
Comments
Not really, that all looks reasonable. We normally try to detect memory addresses and remove them from output, not sure why this is not happening here: Line 1183 in 3e93213
Could you please try to remove the dollar sign from the regex and see if that fixes things?
Yes, see https://pdoc.dev/docs/pdoc.html#exclude-submodules-from-being-documented |
Okay, so removing the #!/usr/bin/env perl
use strict;
use warnings;
use Tie::File;
@ARGV == 1
or usage("Incorrect number of arguments\n");
tie my @file, "Tie::File", $ARGV[0] or die $!;
for (@file) {
$_ =~ s/(<span[^<]+object<\/span>)\s*<span[^<]+at<\/span>\s*<span[^<]+0x[a-f0-9]+<\/span>/$1/gx;
} Which runs like this: find docs/ -type f -exec "${SCRIPT_DIR}/documentation-cleanup.pl" {} \; |
Thanks for the quick turnaround on the fix @mhils . Any idea on when you plan to make the next release? |
Happening now! :) |
Thanks @mhils ! 🏅 |
Problem Description
A clear and concise description of what the bug is.
In my application, I use
typer
as a CLI framework (https://typer.tiangolo.com/). Part of the framework uses decorators with annotations to manage flags, help text, etc.In the example below you can see that the
@callback
decorator uses a classCommonOptions
which provide a reusable set of options. When I runpdoc
thetyper.Option()
method (typer.models.OptionInfo
) is found to be an in-memory object, and as a result theid
value changes on every run ofpdoc
.This is problematic as the documentation related to the files which use this decorator are never "correct" (the
id
values are always different). I would like to usepdoc
in a pre-commit hook, but this behavior makes that infeasible.My question is: Is there any way to prevent this from happening?
There are a few possible "solutions" that would be acceptable if possible, for example:
pdoc
works that isn't obvious to me?pdoc
to write a static reference to the in-memory object? (I don't believe so)@private
in the docstring, however I would really prefer to have the methods documented. Also, sincetyper
uses the docstring for help text, this will show up in the help text and cause confusion.pdoc
to ignore / exclude an entire directory tree from documentation? So I don't have to add@private
to all of the docstrings individually.pdoc
?Including example code below in case there's something I can do to fix my code. I can try to produce a simpler example for reproducibility, if requested.
code:
documentation:
Steps to reproduce the behavior:
System Information
Paste the output of "pdoc --version" here.
Example source
CommonOptions
source:decorator source
The text was updated successfully, but these errors were encountered: