New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

import-export

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

import-export

A Python module methods decorator

  • 0.3.1
  • PyPI
  • Socket score

Maintainers
1

import export

A Python package methods decorator

Lines of code Downloads Statistic GitHub

Let me show here

1. install

pip install -U import-export

2. use

"""mypack.py"""
import export

def fee():
    return 'twee'
	
@export
def moo():
    return 'moow'
    
@export
class C(object):
    pass
> from mypack import *
> print(fee())
NameError: name 'fee' is not defined
> print(moo())
moow
> print(C())
<mypack.C object at 0x00********>

NB:

> import mypack
> print(mypack.fee())
twee

How it work

  • just add decorated resource name to the tuple module.__all__

Implementation features

  • no requirements, but sys only
  • uses some hack from sys import modules and so won't leave beta
  • does not store itself in module variables
  • runs for all version python

License

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

Credits

TODO

  • export(None) == raise Exception('doesn't work')
  • may be implement private() public() etc decorator to classes as new version of competing library
  • next part coming soon!

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc