Skip to content

Automagically import single file Python modules from GitHub.

License

Notifications You must be signed in to change notification settings

yoavram/antipackage

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AntiPackage

Automagically import single file Python modules from GitHub.

Installation

The antipackage package can be installed from GitHub using pip:

pip install git+https://github.com/ellisonbg/antipackage.git#egg=antipackage

Usage

Enable antipackage by simply importing it:

import antipackage

Once antipackage has been imported you can simply import modules from GitHub using the syntax:

from github.username.repo import module

When you do this, the import hook will automatically download and install single file Python modules into the location ~/.antipackage/github/username/repo/module.py. If the module every changes on GitHub it will be updated next time you import it.

Absolute imports

The antipackage package is written looking forward to the days when Python 2 is no longer supported. Because of this, the import hooks used in antipackage assume that relative imports are not used in the single file modules that are being imported. To enable this behavior for Python 2, add the following line at the top of your modules:

from __future__ import absolute_import

Like this: https://github.com/ellisonbg/misc/blob/master/vizarray.py#L26

About

Automagically import single file Python modules from GitHub.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%