https://github.com/andrewpetrochenkov/public.py
:snake: replace '__all__' with '@public.add' decorator
https://github.com/andrewpetrochenkov/public.py
python
Last synced: 5 months ago
JSON representation
:snake: replace '__all__' with '@public.add' decorator
- Host: GitHub
- URL: https://github.com/andrewpetrochenkov/public.py
- Owner: andrewpetrochenkov
- License: unlicense
- Created: 2015-09-06T06:36:13.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2020-12-03T21:14:50.000Z (about 5 years ago)
- Last Synced: 2025-07-09T10:53:48.722Z (6 months ago)
- Topics: python
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 15
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://pypi.org/project/public/)
[](https://unlicense.org/)
[](https://github.com/andrewp-as-is/public.py/actions)
### Installation
```bash
$ [sudo] pip install public
```
#### Features
+ replace [`__all__`](https://stackoverflow.com/questions/44834/can-someone-explain-all-in-python) with `@public.add` decorator
before
```python
__all__ = ["func"]
def func():
```
after
```python
import public
@public.add
def func():
```
#### Examples
```python
>>> import public
>>> @public.add
def func(): pass
>>> @public.add
class Cls: pass
>>> __all__
['Cls','func']
>>> public.add("name")
>>> public.add(*["name1","name2"])
>>> __all__
['Cls','func','name','name1','name2']
```
#### Links
+ [Importing * From a Package. Python documentation](https://docs.python.org/3/tutorial/modules.html#importing-from-a-package)
+ [Can someone explain __all__ in Python? Stackoverflow](https://stackoverflow.com/questions/44834/can-someone-explain-all-in-python)