API Reference#

API reference for public:

public.public(thing: public.types.ModuleAware) public.types.ModuleAware#
public.public(**kws: Any) None

Add a name or names to __all__

There are two forms of use for this function. Most commonly it will be used as a decorator on a class or function at module scope. In this case, thing will be an object with both __module__ and __name__ attributes, and the name is added to the module’s __all__ list, creating that if necessary.

When used in its function call form, thing will be None. __all__ is looked up in the globals at the function’s call site, and each key in the keyword arguments is added to the __all__. In addition, the key will be bound to the value in the globals.

Only one or the other format may be used.

Parameters
  • thing – None, or an object with both a __module__ and a __name__ argument.

  • kws – Keyword arguments.

Returns

The original thing object.

Raises

ValueError – When the inputs are invalid, or this function finds a non-list __all__ attribute.

public.private(thing)#

Remove names from __all__

This decorator documents private names and ensures that the names do not appear in the module’s __all__.

Parameters

thing (TypeVar(ModuleAware, bound= Callable[..., Any])) – An object with both a __module__ and a __name__ argument.

Return type

TypeVar(ModuleAware, bound= Callable[..., Any])

Returns

The original thing object.

Raises

ValueError – When this function finds a non-list __all__ attribute.

public.install()#

Install @public and @private into builtins.

Return type

None