Skip to main content

A Python package methods decorator (not joke)

Project description

import export

A Python package methods decorator

Once upon a time, not very long time ago, about last Friday...

Let me show here! tldr

1. install

pip install import-export

2. use

"""mypack.py"""
import export

def fee():
    print 'twee'
	
@export
def moo():
    print 'moow'
> from mypack import *
> print(fee())
NameError: name 'fee' is not defined
> print(moo())
moow

How it work

  • Eeh... just add decorated resource name to the dictionary module.__all__[]

License

  • It's opensource and free software, see the LICENSE for more details.

Credits

TODO

  • export(None) - export nothing outside pkg
  • may be implement private() public() etc decorator to classes
  • your ideas?

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

import-export-0.2.67.dev6.tar.gz (3.2 kB view hashes)

Uploaded Source

Supported by

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