pluto-lang / pluto

Pluto provides a unified programming interface that allows you to seamlessly tap into cloud capabilities and develop your cloud and AI applications.
https://pluto-lang.vercel.app
Apache License 2.0
87 stars 8 forks source link
ai deployment help-wanted iac ifc llm low-code programming programming-languages severless



English | 简体中文

slack license npm version npm download

Pluto is a development tool dedicated to helping developers build cloud and AI applications more conveniently, resolving issues such as the challenging deployment of AI applications and open-source models.

Developers are able to write applications in familiar programming languages like Python and TypeScript, directly defining and utilizing the cloud resources necessary for the application within their code base, such as AWS SageMaker, DynamoDB, and more. Pluto automatically deduces the infrastructure resource needs of the app through static program analysis and proceeds to create these resources on the specified cloud platform, simplifying the resources creation and application deployment process.

⚠️ Caution: Pluto is still in its early stages, please consider it for production environments with caution.

🌟 Example

Let's develop a text generation application based on GPT2, where the user input is processed by the GPT2 model to generate and return text. Below is how the development process with Pluto looks:

GPT2 Process

AWS SageMaker is utilized as the model deployment platform, and AWS Api Gateway and Lambda support the application's HTTP services. The deployed application architecture, as shown in the top right graphic ↗️, comprises two route handling functions: one to receive user input, invoke the SageMaker model, and return generated text, and another to provide the endpoint URL of the SageMaker model.

The top left graphic ↖️ captures a fragment of the application code, with the complete code accessible here. In the TypeScript code development process using Pluto, by creating a new SageMaker instance using new SageMaker(), you can directly interact with the SageMaker model using methods like sagemaker.invoke() and obtain the model endpoint URL using sagemaker.endpointUrl(). Establishing an Api Gateway requires only creating a new variable router with new Router(), and the function arguments within the methods of router, such as router.get(), router.post(), etc., will automatically be converted into Lambda functions. The same application could be implemented in Python as well.

Once the application code has been written, executing pluto deploy allows Pluto to deduce the application's infrastructure needs and automatically provision around 30 cloud resources, which includes instances such as SageMaker, Lambda, Api Gateway, along with setups like triggers, IAM roles, and policy permissions.

Finally, Pluto hands back the URL of the Api Gateway, providing direct access to use the application.

Interested in exploring more examples?

🚀 Quick Start

Online Experience: CodeSandbox provides an online development environment. We have constructed Pluto templates in both Python and TypeScript languages on this platform, allowing direct experience in the browser. After opening the project template, creating your own project is as easy as clicking the Fork button in the top right corner. The environment is pre-equipped with AWS CLI, Pulumi, and Pluto's basic dependencies, adhering to the README for operations.

Container Experience: We offer a container image plutolang/pluto:latest for application development, which contains essential dependencies like AWS CLI, Pulumi, and Pluto, along with Node.js 20.x and Python 3.10 environments pre-configured. If you are interested in developing only TypeScript applications, you can use the plutolang/pluto:latest-typescript image. You can partake in Pluto development within a container using the following command:

docker run -it --name pluto-app plutolang/pluto:latest bash

Local Experience: For local use, please follow these steps for setup:

1. Install Pluto

npm install -g @plutolang/cli

2. Deploy your application with Pluto

pluto new        # Interactively create a new project, allowing selection of TypeScript or Python
cd <project_dir> # Enter your project directory
npm install      # Download dependencies

# If it's a Python project, in addition to npm install, Python dependencies must also be installed.
pip install -r requirements.txt

pluto deploy     # Deploy with one click!

⚠️ Note:

For detailed steps, refer to the Getting Started Guide.

Currently, Pluto only supports single-file configurations. Inside each handler function, access is provided to literal constants and plain functions outside of the handler's scope; however, Python allows direct access to classes, interfaces, etc., outside of the scope, whereas TypeScript requires encapsulating these within functions for access.

🤯 Pain Points

Here you can find out why Pluto was created. To put it simply, we aim to address several pain points you might often encounter:

💡 Features

🔧 How Does Pluto Work?

Pluto Architecture

Overall, the Pluto deployment process comprises three stages—deduction, generation, and deployment:

  1. Deduction Phase: The deducer analyzes the application code to derive the required cloud resources and their interdependencies, resulting in an architecture reference. It also splits user business code into business modules, which, along with the dependent SDK, form the business bundle.
  2. Generation Phase: The generator creates IaC code that is independent of user code, guided by the architecture reference.
  3. Deployment Phase: Depending on the IaC code type, Pluto invokes the corresponding adapter, which, in turn, works with the respective IaC engine to execute the IaC code, managing infrastructure configuration and application deployment.

Components such as the deducer, generator, and adapter are extendable, which allows support for a broader range of programming languages and platform integration methods. Currently, Pluto provides deducers for Python and TypeScript, and a generator and adapter for Pulumi. Learn more about Pluto's processes in detail in this document.

🤔️ Differences from Other Projects?

Pluto distinguishes itself from other offerings by leveraging static program analysis techniques to infer resource dependencies directly from application code and generate infrastructure code that remains separate from business logic. This approach ensures infrastructure configuration does not intrude into business logic, providing developers with a development experience free from infrastructure concerns.

You can learn more about the differences with other projects in this document.

👏 Contributing

Pluto is still in its infancy, and we warmly welcome contributions from those who are interested. Any suggestions or ideas about the issues Pluto aims to solve, the features it offers, or its code implementation can be shared and contributed to the community. Please refer to our project contribution guide for more information.

🐎 Roadmap

Please see the Issue list for further details.

📊 Capability Matrix

✅: Indicates that all user-visible interfaces are available
🚧: Indicates that some of the user-visible interfaces are available
❌: Indicates not yet supported

TypeScript

Resource Type AWS Kubernetes Alibaba Cloud Simulation
Router 🚧 🚧 🚧
Queue
KVStore
Function
Schedule
Tester
SageMaker

Python

Resource Type AWS Kubernetes Alibaba Cloud Simulation
Router
Queue
KVStore
Function
Schedule
Tester
SageMaker

💬 Community

Join our Slack community to communicate and contribute ideas.