@exports
The DRY alternative to __all__
Installation
To install the exports package, you can use
python-exports on PyPI:
pip install python-exports
Usage
>>> from exports import export
Now you can use it to add to __all__ as
-
function decorator
>>> @export ... def spam(): ... ...
-
class decorator:
>>> @export ... class Ham: ... ...
-
by name:
>>> from functools import reduce as fold >>> export('fold')
Behaviour
If the module has no __all__, it is created.
Otherwise, __all__ is converted to a list, and the export is appended.
Caveats
Exporting a function or class directly relies on the __name__ attribute,
so consider the following example:
>>> def eggs():
... ...
>>> fake_eggs = eggs
If we want to export fake_eggs, then this will not work:
>>> export(fake_eggs) # BAD: this will add `'eggs'` to `__all__`
In such cases, use the name instead:
>>> export('fake_eggs') # GOOD
You'll be safe if you either
- decorate a function or a class directly with
@export, - pass the name string when using plain
export('...')calls.
Metadata
Release files for python-exports 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python_exports-1.3.0.tar.gz | 4.9 kB | With provenance | Details for python_exports-1.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_exports-1.3.0-py3-none-any.whl | Python 3 | none | any | Details for python_exports-1.3.0-py3-none-any.whl |
Total release size: 9.9 kB
Release files / python_exports-1.3.0.tar.gz
| Download URL | python_exports-1.3.0.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
124303d1f643b4e2c3bcbf5e1140f00da85b52c60bd11ce57f0104ae1dd0cad2
|
|
BLAKE2b-256 checksum How to use checksums |
4d13e0c77bb1d951e59af8a455c7280642c7e48a93febafb56b17f0931ef4176
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 10, 2026.
Transparency logRelease files / python_exports-1.3.0-py3-none-any.whl
| Download URL | python_exports-1.3.0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd1baafa2ced944a0df3baa79b78cb3e416f8dd9a10c329516de156d80ff3dc8
|
|
BLAKE2b-256 checksum How to use checksums |
1a534f96521f0402fce3a8a3642a3d4868c7320bfd9a2741dfbaf4c2b8cce641
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 10, 2026.
Transparency logSecurity for python-exports 1.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for python_exports-1.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 10, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.