Helix App Development
This outline describes how to develop and deploy applications using the Helix framework.
Building Helix Applications
Helix applications are built using Python and the Helix SDK. The SDK provides a set of tools and libraries for creating and deploying Helix applications.
Creating a Helix Application
Install the Helix SDK
pip install helix-sdk
Create a New Project Directory
mkdir my-helix-app cd my-helix-app
Initialize the Project
helix init
This command will create a new Helix project with the following files:
helix.yaml
: This file defines the configuration for your application, including the application name, dependencies, and deployment settings.main.py
: This file contains the main code for your application.
Write Your Application Code
In the
main.py
file, you can write your application logic using the Helix SDK. For example, the following code defines a simple Helix application that prints a message to the console:from helix.app import App def main(): app = App() app.log("Hello, world!") app.exit(0) if __name__ == "__main__": main()
This example demonstrates a simple application. You can explore other examples provided in the Helix SDK documentation.
Deploying Helix Applications
Once you have built your Helix application, you can deploy it to the Helix platform.
Deploying to a Helix Server
Build the Application Package
helix build
This command will create a compressed package of your application, including all dependencies.
Deploy the Package to the Server
helix deploy --server <server_url> --package <package_path>
Replace
<server_url>
with the URL of the Helix server you want to deploy to. Replace<package_path>
with the path to the built package.For example:
helix deploy --server https://my-helix-server.example.com --package my-helix-app/dist/my-helix-app.tar.gz
Running Helix Applications Locally
You can run Helix applications locally for testing and development.
Run the application
helix run
This command will start your application in a local development environment.
Helix Application Structure
Helix applications typically follow a specific structure, including a main application file, configuration file, and potential additional files for dependencies.
Main Application File (main.py)
The main.py
file contains the core logic for your Helix application. It’s responsible for setting up the application, handling events, and interacting with the Helix platform. You can define your application’s functions and classes within this file, using the Helix SDK’s libraries.
Configuration File (helix.yaml)
The helix.yaml
file defines the configuration for your Helix application. This includes settings for:
- Application name: This identifies your application on the Helix platform.
- Dependencies: This specifies the libraries and packages your application depends on.
- Deployment settings: This defines how your application is deployed to the Helix platform.
Dependencies
You can include dependencies in your Helix application by adding them to your requirements.txt
file. The helix.yaml
file should also include a dependencies
section that references the packages in your requirements.txt
file.
Example Helix Application
The following example demonstrates a simple Helix application that prints a message to the console. This example demonstrates the core elements of a Helix application, including configuration, dependencies, and a main application file.
# my-helix-app/helix.yaml
name: my-helix-app
dependencies:
- requests
- helix-sdk
# my-helix-app/main.py
from helix.app import App
import requests
def main():
app = App()
app.log("Hello, world!")
response = requests.get("https://example.com")
app.log(f"Response status code: {response.status_code}")
app.exit(0)
if __name__ == "__main__":
main()
Next Steps
- Explore the Helix SDK documentation to learn more about the tools and libraries available for developing Helix applications.
- Check out the Helix examples repository for more examples of Helix applications.
- Join the Helix community forum to ask questions and get help from other Helix developers.