Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# @public and @private – Document your module’s interface

This library provies two very simple decorators that document the publicness of the names in your module. They keep your module’s `__all__` in sync so you don’t have to.

Please note that while the package is called public and it provides a top-level module named `public`, the PyPI package is called `atpublic` due to name conflicts.

## Requirements

`public` requires Python 3.8 or newer.

## Documentation

A simple guide to using the library is available, along with a detailed API reference.

## Project details

> - Project home: https://gitlab.com/warsaw/public

> - Report bugs at: https://gitlab.com/warsaw/public/issues

> - Code hosting: https://gitlab.com/warsaw/public.git

> - Documentation: https://public.readthedocs.io

> - PyPI: https://pypi.python.org/pypi/atpublic

You can install it with pip:

    % pip install atpublic

Do not install “public”; that is a different package!

You can grab the latest development copy of the code using git. The main repository is hosted on GitLab. If you have git installed, you can grab your own branch of the code like this:

    $ git clone https://gitlab.com/warsaw/public.git

You can contact the author via barry@python.org.

## Copyright

Copyright (C) 2016-2024 Barry A. Warsaw

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

> http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

## Table of Contents and Index

- Index

- Using @public and @private
  - Background
  - The problem with __all__
  - The solution
  - Function call form
  - @private
  - Caveats
  - Alternatives
- API Reference
- @public change log
  - 4.1 (2024-03-29)
  - 4.0 (2023-06-05)
  - 3.1.2 (2023-05-31)
  - 3.1.1 (2022-09-02)
  - 3.1 (2022-08-27)
  - 3.0.1 (2022-01-10)
  - 3.0 (2022-01-10)
  - 2.3 (2021-04-13)
  - 2.2 (2021-04-13)
  - 2.1.3 (2021-02-15)
  - 2.1.2 (2021-01-01)
  - 2.1.1 (2020-10-22)
  - 2.1 (2020-10-21)
  - 2.0 (2020-07-27)
  - 1.0 (2017-09-15)
  - 0.5 (2016-12-14)
  - 0.4 (2016-11-28)
  - 0.3 (2016-05-25)
  - 0.2 (2016-05-22)
  - 0.1 (2016-05-09)