A Python manager for the modules __all__ variable.
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file allstar-1.1.5.tar.gz.
File metadata
- Download URL: allstar-1.1.5.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd64807501c25d9d221d5155b93ef4ed26f26330fd52cfd89a9c7b28eff2768e
|
|
| MD5 |
ab254e9c82d085e6a9b778b6f35b64a5
|
|
| BLAKE2b-256 |
867432f1728c9b1733e1641dec1fb20c092643b3becf30576d9f99cd5b0bd733
|
File details
Details for the file allstar-1.1.5-py3-none-any.whl.
File metadata
- Download URL: allstar-1.1.5-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70f4f5f2b05fad6d567084630a74823a503bf1f0336bc054a0a9c48efd5707e9
|
|
| MD5 |
c99ca39526ddc9ad3af16d1e0ea6e818
|
|
| BLAKE2b-256 |
449809154a40cc200ab87a6ce621ec28e9281b06bd2b56364af96c919a2ee9a7
|