PublicAPI.jl

PublicAPI.jl provides a simple API for declaring API without exporting the names. This package is still experimental!
Author JuliaFolds2
Popularity
25 Stars
Updated Last
1 Year Ago
Started In
September 2021

PublicAPI - this package is still experimental!

Dev

NOTE: This is a proof-of-concept implementation of Feature request: Base.@public macro for declaring a public name without needing to export it · Issue #42117 · JuliaLang/julia.

PublicAPI.jl provides a simple API for declaring API without exporting the names:

using PublicAPI: @public
@public public_api_name
public_api_name() = 1

export exported_and_public_api_name
exported_and_public_api_name() = 2

The public API can be queried using PublicAPI.of(module). For example, the public API for PublicAPI.jl can be listed as:

julia> using PublicAPI

julia> apis = PublicAPI.of(PublicAPI);

julia> sort!(fullname.(apis))
3-element Vector{Tuple{Symbol, Symbol}}:
 (:PublicAPI, Symbol("@public"))
 (:PublicAPI, Symbol("@strict"))
 (:PublicAPI, :of)

Consumers of the public API can opt-in a stricter semantics of using via PublicAPI.@strict

import PublicAPI
PublicAPI.@strict using Upstream: api

which ensures that Upstream.api is either exported or marked as @public.

Required Packages

No packages found.

Used By Packages