Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tombulled/export

Expose module functionality
https://github.com/tombulled/export

export python

Last synced: 23 days ago
JSON representation

Expose module functionality

Awesome Lists containing this project

README

        

# export
Control module exports

## About
This library dynamically generates an `__all__` attribute for modules

## Install
```console
pip install export
```

## Usage

### Private by Default
*Does* export objects marked **public**, *doesn't* export everything else

```python
# lib.py

import export

export.init(default=export.PRIVATE)

@export.public
def foo():
pass

def bar():
pass

def baz():
pass
```

```python
>>> import lib
>>>
>>> lib.__all__
['foo']
```

### Public by Default
*Doesn't* export objects marked **private**, *does* export everything else

```python
# lib.py

import export

export.init(default=export.PUBLIC)

def foo():
pass

@export.private
def bar():
pass

@export.private
def baz():
pass
```

```python
>>> import lib
>>>
>>> lib.__all__
['export', 'foo']
```