Skip to content

JuliaFolds2/PublicAPI.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

PublicAPI.jl provides a simple API for declaring API without exporting the names. This package is still experimental!

Resources

License

Stars

Watchers

Forks

Languages