Skip to main content

Import python code from anywhere.

Project description

Package Version Package Downloads

Import python code from anywhere.

Installation

pip install importit

Examples

Importing gist

We will import this gist: Test Gist

from importit import import_gist

# We give it the module name and gist id from the end of the gist link.
hellos = import_gist("hellos", "51dcf067f4e445c3f837d26efd2c138e")
hellos.hello.say_hello() # output: hello
hellos.hello_again.say_hello_again() # output: hello again

Importing python file

from importit import import_local_file, import_remote_file

foo = import_local_file("foo", local_python_file_path)
bar = import_remote_file("bar", remote_python_file_url)

Importing python code

from importit import import_code

python_code = """
def say_hello():
    print("hello")
"""
dummy = import_code("dummy", python_code)
dummy.say_hello() # output: hello

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

importit-0.1.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

importit-0.1.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file importit-0.1.1.tar.gz.

File metadata

  • Download URL: importit-0.1.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for importit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4a4f5cb6bc454e5a565d962a6754e5ee75dc19599bd76c8eeb5582ff37c92cb6
MD5 41b56742d008479bc13e05aaa1b77d0b
BLAKE2b-256 c28e1ca0e770de845721c7c4488c285a29801d2d1641c5d48d0a0078424e3d51

See more details on using hashes here.

File details

Details for the file importit-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: importit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.10

File hashes

Hashes for importit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 755dcec218a894584a2bce1a2f9b4e3dfb4e03fe5130caf68cca5db21ba1bc07
MD5 5e16eaf0e59e580381b65867f5a288a9
BLAKE2b-256 c4ab8dfdabcead08c1d31d3bceadd3159a257d62bbbe4662b45565ee96712a1d

See more details on using hashes here.

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