@public change log¶
8.0.0 (202X-XX-XX)¶
New features¶
public()andprivate()now accept a single positional argument, which can be an object imported from another module, a module or submodule, or a string. The resolved name is added to (or removed from) the__all__of the module where the call appears. A string is used as given, and must be a valid Python identifier that isn’t a reserved word;ValueErroris raised otherwise. When no name can be inferred, such as is the case with a constant or an instance,TypeErroris raised, pointing you at the keyword argument form.@publicand@privatecan now be installed intobuiltinsat interpreter startup by installing the newinstallextra, i.e.pip install atpublic[install]. This pulls in the companionatpublic-installpackage, which enables the builtins at interpreter startup time via.pthor.startfiles.install(), which adds@publicand@privatetobuiltins, is now exported from the package itself, so it can be called asfrom public import install. Previously it was only reachable aspublic._startup.install, which still works but is no longer the documented spelling.Switch to pyrefly for type checking.
Backward incompatibilities¶
@privateno longer creates an__all__when the module doesn’t already have one. Previously, privatizing a name in a module with no__all__left an empty one behind, which is not the same thing as not having one: an empty__all__exports nothing, while no__all__exports every name that doesn’t start with an underscore.public(thing)andprivate(thing)used to operate onsys.modules[thing.__module__], i.e. the module wherethingwas defined. Passing in an imported object therefore added the name to the wrong module’s__all__, and in the case ofprivate(), removed it from the wrong module’s__all__. Both functions now always use the globals of the module where the call appears. Use as a decorator is unaffected, since a decorator is applied where its target is defined.The implementation modules are now private, having been renamed with a leading underscore:
public.modules,public.private,public.public, andpublic.typesare nowpublic._modules,public._private,public._public, andpublic._types. Import the package itself instead, as infrom public import public, private, populate_all. Among other things this settles whatpublic.publicrefers to; it used to name both a module and the function of the same name that the package exports.
7.0.0 (2025-11-28)¶
Drop Python 3.9.
Documentation improvements. furo has been fixed, so we no longer need the workaround.
pyproject.tomlupdates and improvements.
6.0.2 (2025-09-24)¶
Documentation improvements.
Temporary workaround for a furo theme bug in dark mode.
CI updates.
6.0.1 (2025-05-06)¶
Fix test suite when run with Python < 3.12. (GL#28)
Add test for Python 3.14.
6.0 (2025-05-06)¶
Added
populate_all()which can be called from the bottom of your module to infer and populate your module’s__all__. Use this if you don’t like the decorator syntax. (GL#27)Documentation improvements.
5.1 (2025-01-23)¶
Drop official support for Python 3.8, add support for Python 3.13.
5.0 (2024-07-24)¶
@publicis now properly type annotated.Adopt
hatch testandhatch fmtcommands. (GL#25)@publicand@privatenow raiseTypeErrorinstead ofValueErrorif__all__is not a concretelistobject. (GL#26)Other minor coding improvements identified by
ruff.Switch to Trusted Publishing for publishing new versions to PyPI. (GL#24)
4.1 (2024-03-29)¶
4.0 (2023-06-05)¶
Drop Python 3.7 support. (GL#16)
Remove
public.install()which was used to inject thepublicandprivatefunctions into thebuiltinsnamespace. This isn’t very helpful and could be actively harmful. Explicit is better than implicit. (GL#14)The functional form of
public()now returns the argument values in the order they are given. This allows you to explicitly bind those values to names in the global namespace. While this is redundant, it does solve some linter problems. (GL#12)Switch from
flake8andisorttorufffor code quality. (GL#32)Bump dependencies.
3.1.2 (2023-05-31)¶
Switch to
pdm-backend(GL#15)Bump dependencies.
More GitLab CI integration improvements.
3.1.1 (2022-09-02)¶
Improvements to the GitLab CI integration.
3.1 (2022-08-27)¶
Fix a typo in pyproject.toml file.
Exclude certain local cache files from the sdist/wheel.
Add support for Python 3.11.
Updates for pdm and dependencies.
3.0.1 (2022-01-10)¶
Fix a typo in the README.rst.
3.0 (2022-01-10)¶
Use modern package management by adopting pdm and
pyproject.toml, and droppingsetup.pyandsetup.cfg.Build the docs with Python 3.8.
Update to version 3.0 of Sybil.
Adopt the Furo documentation theme.
Use importlib.metadata.version() as a better way to get the package version number for the documentation.
Drop Python 3.6 support.
Update Windows GitLab runner to include Python 3.10.
Update copyright years.
The
masterbranch is renamed tomain. (GL#11)
2.3 (2021-04-13)¶
Do type hinting the right way. (GL#10)
2.2 (2021-04-13)¶
2.1.3 (2021-02-15)¶
I blue it!
2.1.2 (2021-01-01)¶
Update copyright years.
Include
test/__init__.pyanddocs/__init__.py(GL#9)
2.1.1 (2020-10-22)¶
Rename top-level tests/ directory to test/ (GL#8)
2.1 (2020-10-21)¶
Clean up some typing problems.
Reorganized docs and tests out of the code directory (GL#7).
Fix the Windows CI tests.
2.0 (2020-07-27)¶
Drop Python 3.4 and 3.5; add Python 3.8 and 3.9.
The C implementation is removed. (GL#4)
Added an
@privatedecorator (GL#3)Build and test on Windows in addition to Linux.
Fix the doctests so that they actually run and pass!
Add type annotations and API reference documentation.
Internal improvements and modernizations.
1.0 (2017-09-15)¶
1.0 release.
Documentation improvements.
0.5 (2016-12-14)¶
Fix MANIFEST.in inclusion of the src directory for the C extension.
0.4 (2016-11-28)¶
Add Python 3.6 support.
Make building the C extension optional, for environments without a C compiler.
0.3 (2016-05-25)¶
Raise
ValueErrorwhen__all__isn’t a list (or subclass) instance.
0.2 (2016-05-22)¶
Documentation updates based on initial feedback.
Some minor test suite clean up.
0.1 (2016-05-09)¶
Initial release.