项目作者: i96751414

项目描述 :
Golang style imports in python
高级语言: Python
项目地址: git://github.com/i96751414/import-module.git
创建时间: 2018-03-06T17:20:56Z
项目社区:https://github.com/i96751414/import-module

开源协议:GNU General Public License v3.0

下载



import-module


import-module

Golang style imports in python


Codacy Badge
Build Status
License


import-module is a python package which allows to import packages as in golang.
Currently it supports modules from github.com, bitbucket.org, git.launchpad.net, and pypi.python.org.

Usage

Importing a module (with statement must be used):

  1. from import_module import ImportModule
  2. with ImportModule("github.com/i96751414/py-dummy"):
  3. import dummy
  4. print("The output of dummy.call is '{}'".format(dummy.call()))

Output:

  1. The output of dummy.call is 'call'

API

  • ImportModule(module, path=None, reload_module=False, use_pip=False)

    Import the specified module. If the module already exists and reload_module is True, then re-import the module. If path is given, the module will be imported to the given path. If use_pip is True, the module will be imported with pip, even if it is a git repository.