Skip to content

About

Explicitly mark your public APIs with @pub, much like PEP 844.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

Repository files navigation

pymakepublic

This is rather a tiny library that allows you to explicitly mark your public Python APIs with @pub rather than creating an __all__ list and adding to or updating it whenever you change your public APIs.

This isn't necessarily PEP 844, though it's the same idea. This library leaves classes and functions that are not explicitly marked with @pub alone (assuming they are supposedly private), and you may normally underscore them to indicate they are private APIs. Note that in Python you can still import those so-called private APIs, so this library doesn't make an exception on that.

Tests PyPI Python License t

Installation and Usage

$ pip install pymakepublic
# m.py
from pymakepublic import pub


@pub
class Foo: ...


class Bar: ...


@pub
def bar(): ...


def do_something(): ...
>>> import m
>>> m.__all__
['Foo', 'bar']

This works the same as manually adding them to __all__. Hence if you use both @pub and __all__ you get a DoubleExportsError.

Why?

PEP 844's motivation isn't far off from mine. Also checkout this StackOverflow comment.

Contributing

Issues and PRs are very welcome.

LICENSE

MIT

About

Explicitly mark your public APIs with @pub, much like PEP 844.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages