Declare documented API public (for downstream ExplicitImports)#819
Draft
ChrisRackauckas-Claude wants to merge 1 commit into
Draft
Declare documented API public (for downstream ExplicitImports)#819ChrisRackauckas-Claude wants to merge 1 commit into
public (for downstream ExplicitImports)#819ChrisRackauckas-Claude wants to merge 1 commit into
Conversation
ForwardDiff `export`s only `DiffResults` and declares no names `public`. Downstream packages that access the documented API in qualified form (e.g. `ForwardDiff.jacobian`) therefore trip ExplicitImports' `check_all_qualified_accesses_are_public`, even though the docs present these as the public surface. This declares the already-documented public API with Julia's `public` keyword. Exports are unchanged. The declaration is `@static`-guarded so Julia 1.10 (which lacks `public`) is unaffected. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #819 +/- ##
=======================================
Coverage 90.74% 90.74%
=======================================
Files 11 11
Lines 1070 1070
=======================================
Hits 971 971
Misses 99 99 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
|
Xref #744, in which there are various suggestions for what to mark public, none exactly agreeing with the list here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
ForwardDiff currently
exports onlyDiffResultsand does not declare any namespublic. As a result, downstream packages that access the documented API in qualified form — e.g.ForwardDiff.jacobian,ForwardDiff.gradient,ForwardDiff.GradientConfig— get flagged by ExplicitImports.jl'scheck_all_qualified_accesses_are_public, because to that tool every one of these reads as "non-public" (not exported, not declaredpublic), even though the documentation presents them as the public API.Many SciML packages (and others) run ExplicitImports as part of their QA suite, so each currently has to carry a manual ignore-list entry for ForwardDiff names. Declaring the documented surface
publiclets that boilerplate go away and makes the package's public/internal boundary explicit to tooling.What this does
Adds a single
Expr(:public, ...)declaration near the end ofsrc/ForwardDiff.jlcovering the names that are documented as the public API:@docsblocks ofdocs/src/user/api.md):derivative,derivative!,gradient,gradient!,jacobian,jacobian!,hessian,hessian!@docsinapi.md):DerivativeConfig,GradientConfig,JacobianConfig,HessianConfigChunk(Configuring Chunk Size),Dual(Custom tags),value(Retrieving Lower-Order Results), andcan_dual(has aForwardDiff.can_dualdocstring and is referenced as a user-extensible hook in the cannot-dual error message)Exports are unchanged — this only marks names
public, it does not bring anything into downstream scope unqualified.publicwas added in Julia 1.11, so the declaration is@static-guarded (VERSION >= v"1.11.0-DEV.469"); Julia 1.10 is completely unaffected (the block is simply not evaluated there).Deliberately not included
I left out names that appear only in the internals/implementation doc (
docs/src/dev/how_it_works.md) and are not presented to users as public API:Partials,partials,npartials, andTag. If maintainers consider any of these part of the supported surface, I'm happy to add them.Note
This is a draft / proposal for maintainer consideration — please feel free to adjust the exact set of names. Marked draft and should be ignored until reviewed by @ChrisRackauckas.