AllStar
"allstar" is a simple library for managing the the __all__ attribute in modules.
The __all__ attribute is used to specify what is imported when using the from module import * syntax. This type of import is commonly used by project mapping tools like documentation generators. It is important to manage __all__ because, for example, you may not want to generate documentation for imported classes, only for the ones you have created.
The library is named "allstar" because the __all__ attribute is imported using the star (*) symbol.
Installation
pip install allstar
Usage
Basic usage
from allstar import Star
# manager instance
# __name__ is used to reference the module and its attributes
star = Star(__name__)
# star.sign adds a callable to the __all__ iterable
@star.sign
class TheClass:
pass
@star.sign
def the_function():
pass
print(__all__) # prints: ['TheClass', 'the_function']
Extended usage
import os, sys, builtins
from allstar import Star
__all__ = ['os'] # Star preserves the previous names
star = Star(__name__)
star.include('builtins') # include names using strings or references
star.include_all(['os', 'sys']) # include names using iterables
Some extra features
from allstar import Star
star = Star(__name__)
star.empty() # empties the __all__ iterable
star.freeze() # turns the __all__ iterable into a tuple
Author
Alejandro CR
https://github.com/virtualitems/
Project
https://pypi.org/project/allstar/
https://github.com/virtualitems/allstar
License
MIT License
Copyright (c) 2022 Virtual Items
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Release files for allstar 1.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| allstar-1.1.6.tar.gz | 4.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| allstar-1.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.9 kB
Release files / allstar-1.1.6.tar.gz
| Download URL | allstar-1.1.6.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d93ee46862d0a34e546b40728178d5be9d0391a917b4be25431572db6ee653f8
|
|
BLAKE2b-256 checksum How to use checksums |
38eb8cece865c58105aeb2235907b4b1035368f9dc3d14b22218198cedac6cf2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.2
|
Release files / allstar-1.1.6-py3-none-any.whl
| Download URL | allstar-1.1.6-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
be020b7b68b2e46f8dba75778db1b248d9e060d90b966b6c6163e7407f4e4b58
|
|
BLAKE2b-256 checksum How to use checksums |
29ec01262c373e542b45b728af66f912b936eae8088e66b725ab661a3110d257
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.2
|