Skip to main content

Import Python packages from remote.

Project description

Fetch-import

It is convenient to quickly import Python packages from the network.

Docs

Example remote module file is "https://fastly.jsdelivr.net/gh/zmaplex/fetch_import@main/example/sets.py"

@im_fetch

Using this Decorator, you can load resources remotely as conveniently as import.

  1. Replace import
import sets
sets.def_function()

Equivalent:

from fetch_import import im_fetch

url = "https://fastly.jsdelivr.net/gh/zmaplex/fetch_import@main/example/sets.py"

@im_fetch(url)
def main():
    sets.def_function()
  1. Replace from package import *
from sets import *

obj = ObjectClass()
def_function()

Equivalent:

from fetch_import import im_fetch

@im_fetch(url,["*"])
def main():
    obj = ObjectClass()
    def_function()
  1. Replace from package import attr1,attr2
from sets import ObjectClass,def_function

obj = ObjectClass()
def_function()

Equivalent:

from fetch_import import im_fetch

@im_fetch(url,["ObjectClass","def_function"])
def main():
    obj = ObjectClass()
    def_function()

How to use?

step 1

pip install fetch-import
pip -r requirements.txt

step 2

from fetch_import import im_fetch


ydl_opts = {
    'f': 'bestvideo+bestaudio[ext=m4a]',
    'ratelimit': 1024 * 1024 * 1024,
    'merge-output-format': 'mp4'}

job_args = {
    "job_id": "63ba4e4e67cf417ab6a27365cecabec5",
    "plugin_args": {
        "url": "https://www.youtube.com/watch?v=UvuJx7rVUxg",
        "ydl_opts": ydl_opts
    }
}


url = "https://fastly.jsdelivr.net/gh/zmaplex/fetch_import@main/example/youtube_downloader.py"
@im_fetch(url)
def main():
    yd = youtube_downloader.YoutubeDownloader()
    yd.run(**job_args)


if __name__ == '__main__':
    main()

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

fetch_import-0.0.9.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

fetch_import-0.0.9-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file fetch_import-0.0.9.tar.gz.

File metadata

  • Download URL: fetch_import-0.0.9.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for fetch_import-0.0.9.tar.gz
Algorithm Hash digest
SHA256 26f4b072091c14e679299d107260fa9d7e93ab7f998aad54a419c3ee41306129
MD5 39ecc2ae6721448a040dd32386bedd8f
BLAKE2b-256 5cb1f487a4a21f51215abcf037b8b89f28ae2a590bd2825b6ebcc79b88a90230

See more details on using hashes here.

File details

Details for the file fetch_import-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: fetch_import-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for fetch_import-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 3fa98ace566ab289c3774c7ad1687bacb7cde119a251ace54599bd08664c9564
MD5 fc3c2ca91e866150d93856e37523a686
BLAKE2b-256 227894b24d67e7285410f50f21f882972c5450a3fb6cfe07785f855cceeef94f

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