Skip to main content

uaimodal

Project description

UAI Modal

Helper functions to build faster modal servers.

Examples

Check out the examples/examples.ipynb file for examples.

Deploy Module for uaimodal Python Package

Overview

The Deploy module is part of the uaimodal Python package and provides a suite of methods to assist with deploying and managing containerized applications. This module is designed to handle various tasks such as installing Python dependencies, copying files, downloading resources, and configuring containers.

Installation

To install the uaimodal package, you can use pip:

pip install uaimodal

Features

The Deploy module includes the following key methods:

1. installPythonRequirementsLocal(localPath: str)

Installs Python requirements from a local requirements.txt file.

Arguments:

  • localPath (str): The path to the local requirements.txt file.

Returns:

  • Updated Docker image with installed requirements.

2. installPythonRequirementsServer(serverPath: str = "/root/requirements.txt")

Installs Python requirements from a server requirements.txt file.

Arguments:

  • serverPath (str, optional): The path to the requirements.txt file on the server.

Returns:

  • Updated Docker image with installed requirements.

3. copyLocalFileAndDirectories(items: list)

Copies local files and directories to the image.

Arguments:

  • items (list): A list of directories to copy, each containing an input and output path.

Returns:

  • Updated Docker image with copied files and directories.

4. copyLocalFiles(files: list)

Copies local files to the specified image.

Arguments:

  • files (list, optional): A list of files and directories to be copied.

Returns:

  • Updated Docker image with copied files.

5. downloadFile(url: str, destination: str)

Downloads a file from a URL and saves it to the specified destination.

Arguments:

  • url (str): The URL of the file to download.
  • destination (str): The destination path where the file will be saved.

Returns:

  • Updated Docker image with the downloaded file.

6. unzipFile(source: str, destination: str)

Unzips a file from a source path to a destination path.

Arguments:

  • source (str): The path to the zip file.
  • destination (str): The path where the files will be extracted.

Returns:

  • Updated Docker image with the unzipped files.

7. installGitModule(repo_url: str, destination: str)

Clones and installs a Git module.

Arguments:

  • repo_url (str): The URL of the Git repository.
  • destination (str): The path where the module will be installed.

Returns:

  • Updated Docker image with the installed Git module.

8. initContainer(appName: str, ... various options ...)

Initializes a container with the given parameters, including optional file downloads, unzipping, Git module installations, and Python requirements installations.

Arguments:

  • appName (str): The name of the application to deploy.
  • python_version (str, optional): The Python version to use in the container.
  • firebaseServiceJson (str, optional): Path to Firebase service JSON file.
  • cmake (bool, optional): Whether to install CMake.
  • cudaVersion (str, optional): CUDA version to install.
  • filesToDownload (list, optional): List of files to download.
  • filesToUnzip (list, optional): List of files to unzip.
  • gitModules (list, optional): List of Git modules to install.
  • requirementsLocal (str, optional): Path to local Python requirements file.
  • requirementsServer (str, optional): Path to server Python requirements file.
  • postFunctions (list, optional): List of functions to run post-initialization.
  • pytorchCustom (str, optional): Path to custom PyTorch installation.
  • ffmpeg (bool, optional): Whether to install FFmpeg.
  • newDirectories (list, optional): List of new directories to create in the container.

Returns:

  • Initialized UAIModal object.

Usage

To use the Deploy module, first import it and then initialize it with the desired configuration:

from uaimodal.deploy import Deploy

deploy = Deploy()
deploy.installPythonRequirementsLocal('requirements.txt')
deploy.copyLocalFiles(['/path/to/file'])

This will set up your container with the specified Python dependencies and files.

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Contact

For any questions or issues, please contact the maintainer at support@uaimodal.io.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

uaimodal-1.0.3-py2.py3-none-any.whl (7.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file uaimodal-1.0.3-py2.py3-none-any.whl.

File metadata

  • Download URL: uaimodal-1.0.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for uaimodal-1.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6b9ba06608daaa2f974c4703794840e778a16eb489567bc7acd27365a6a4a4bf
MD5 fc3d906675f02db9dd80fd5b4c7d4590
BLAKE2b-256 9b75c42f4c5901378b5e4712343961789b3d8c15079d8ea4cf1dd5332ce40181

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