Skip to main content

A Python manager for the modules __all__ variable.

Project description

AllStar

Allstar is a simple library for modules __all__ iterable management.

The __all__ iterable is used to define what is imported when you use from module import *. This kind of import is used by project mappers like documentation generators. It is important because, for example, you don't want to generate the documentation for the defined classes and all the imported ones.

it is called "allstar" because __all__ is imported using an 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

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

allstar-1.1.4.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

allstar-1.1.4-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file allstar-1.1.4.tar.gz.

File metadata

  • Download URL: allstar-1.1.4.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.2

File hashes

Hashes for allstar-1.1.4.tar.gz
Algorithm Hash digest
SHA256 c3b57c9b1d125252ff3c37f7ff09703c3f04e0de9800946a0cd835c941160808
MD5 09dfda028ef9355207c8369d1a4f74c0
BLAKE2b-256 83404ef285b55714f8fb2772dab29c36f47678ff6990b6d6c41f38a76ab138b7

See more details on using hashes here.

File details

Details for the file allstar-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: allstar-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.2

File hashes

Hashes for allstar-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f0436acd3f98496cae527dd7022833ac90180aa26c668dacb941ac99c725f34e
MD5 b428c61a9b46e3b22682c9bd916e4be6
BLAKE2b-256 5192a58f27806ca82c0c599c0d55f8de1e35fed2fff69a72166e25921bde7818

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page