-
Notifications
You must be signed in to change notification settings - Fork 487
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
Replace isexported
with ispublic
to filter names in @autodocs
#2629
base: master
Are you sure you want to change the base?
Conversation
isexported
with ispublic
as criterion for @autodocs
isexported
with ispublic
to filter names in @autodocs
Co-authored-by: Anshul Singhvi <anshulsinghvi@gmail.com>
Thanks! I'm happy to approve this PR, but if you'd like to add a test I think Compat.jl has an |
Co-authored-by: Anshul Singhvi <anshulsinghvi@gmail.com>
I think this is good to go |
However I think this could break some workflows by including docstrings which are documented elsewhere, triggering a "duplicate docstrings" error. How does Documenter handle SemVer for this sort of thing? |
Could you expand a bit on what you mean here? I don't think there would be much of a difference between public and exported at this stage, since you need 1.11 compatibility for public anyway... IIRC we have a |
Yes, this is my main concern right now. I think this creates a behavior change if you have a package that already uses the Since Documenter is normally auto-upgraded, the policy is to be conservative and not introduce breaking changes of that sort. The easy solution is to guard this with an option to |
We could make public-but-not-exported docstrings non canonical by default? That would at least not be breaking, and maybe we could also issue a warning that contains all public-but-not-exported docstrings that have been documented elsewhere. This might also need a change to the check on whether all exported docstrings are documented - maybe we need to expand that criterion to all public or exported docstrings. |
That would be breaking for the same kind of reason I guess. |
Would that really be non-breaking? It may leave some symbols without any canonical docstring, whereas they had one before. Does that mean the links are dangling? |
We should be consistent, yes.. but it depends a bit on how we're phrasing things right now.
I think this will become confusing to users down the line. Thinking a bit more -- maybe we can be okay with it, if we add a big warning in the CHANGELOG? It would be a shame not to have Would it be feasible to check that, if a duplicate docstring error gets detected, we check if it's due to the "public-but-not-exported" case, and print a warning with the context? We'd might still break existing workflows, but we can immediately tell the user what's going on. We should still do the change in a minor release though, due to it's slightly "technically breaking change" character. |
Looking at |
Done in the latest commit.
Done in the latest commit. Do we need additional tests for these two changes? I think we would want at least one for the new warning, otherwise that line won't get hit. Where should it go? |
And thinking even more: I think giving context on the warning is a good idea also because you can run into this scenario:
But this is fine too, since the "problem" is actually the user declaring things public conditionally on the Julia version. So we can argue that it's not Documenter's fault. But we can still hopefully provide a useful error message. All in all, I think I'm warming up to doing the "breaking change" here. But let's leave this open for a week or so for feedback. And let me also solicit opinions from @fredrikekre, @goerz and @odow. |
Maybe here? https://github.com/JuliaDocs/Documenter.jl/blob/master/test/errors/make.jl |
I think there's another place where the warning should be included in case of duplicate docstrings, namely here: https://github.com/gdalle/Documenter.jl/blob/580be25b7b0f358674770909e799da270cf26308/src/expander_pipeline.jl#L421-L433 However I can't seem to get the module in which to test whether names are public or private. Can someone help? |
Partial fix for #1506
I don't know how to test this because it depends on the Julia version. I tried to do something like
in the test module
AutoDocs.Pages.E
but Julia wouldn't parse it.I also haven't added any badge to docstrings of private symbols. I think it might require more advanced modifications of e.g. the
DocsNode
orNode
struct. This struct could actually incorportate two bits of info: whether the symbol is exported, and whether it is public.