ZribeDev / cloudpip

CloudPIP is a dynamic Python package importer that simplifies the process of using Python packages on the fly.
GNU General Public License v3.0
1 stars 0 forks source link
cloud pip python python3

CloudPIP Documentation

Overview

CloudPIP is a dynamic Python package importer that simplifies the process of using Python packages on the fly. Unlike traditional package managers that require installation, CloudPIP downloads packages to a temporary folder and loads them at runtime. This approach is particularly useful for testing, experimenting with different package versions, or running Python scripts in environments where permanent package installation is not feasible.

Features

Installation

CloudPIP does not require installation. Ensure you have the Python file cloudpip.py in your project directory or in a location that's accessible to your Python scripts.

Usage

Importing from PyPI

To use a package from PyPI, you only need to import CloudPIP's download_and_load_package function, use it to load the desired package, and then use the package as usual.

Example:

from cloudpip import download_and_load_package as cloudimport, cleanup as cloudcleanup

# Load 'requests' package from PyPI
cloudimport("requests")

import requests
print(requests.get("https://pastebin.com/raw/MzcMMpxp").text)

# Optional: Clean up the temporary directories created by CloudPIP
cloudcleanup()

Importing from a CDN or Other URLs

CloudPIP can also load packages from other URLs, such as CDNs. Set is_pypi to False to load packages directly from the specified URL.

Example:

from cloudpip import download_and_load_package as cloudimport, cleanup as cloudcleanup

# Load a package directly from a URL
cloudimport("https://cdn.auth.ink/u/R48I86.gz", is_pypi=False)
# The URL `https://cdn.auth.ink/u/R48I86.gz` points to my CDN, where the `requests` package can be downloaded.
import some_package
# Use the imported package as needed

# Recommended: Clean up after use
cloudcleanup()

Cleanup

It's recommended to call the cleanup function after you're done using dynamically loaded packages. This function removes temporary directories and files created by CloudPIP, freeing up disk space.

from cloudpip import cleanup as cloudcleanup

# After using the packages
cloudcleanup()

For issues, suggestions, or contributions, please open an issue in the project's GitHub repository.