Python support on Spinini
Spinini runs Python 3.12 in isolated Docker containers. You can build scripts, web apps, data pipelines, APIs — anything Python can do.
Starting a Python project
Create a new project and choose Python (for scripts/CLIs) or Flask (for web apps). The starter file is main.py for Python and app.py for Flask.
Flask example
A minimal Flask app runs immediately:
from flask import Flask, jsonify, request
app = Flask(__name__)
todos = []
@app.route('/api/todos', methods=['GET'])
def get_todos():
return jsonify(todos)
@app.route('/api/todos', methods=['POST'])
def add_todo():
data = request.json
todo = {'id': len(todos) + 1, 'text': data['text'], 'done': False}
todos.append(todo)
return jsonify(todo), 201
if __name__ == '__main__':
app.run(host='0.0.0.0', port=3000, debug=True)Save and the preview updates instantly.
Installing packages
Use the Packages panel to search and install pip packages, or use the terminal:
pip install requests pandas numpy flask-corsPackages persist in your container session and reinstall automatically on next startup.
requirements.txt
Create a requirements.txt file for reproducibility:
flask==3.0.0
flask-cors==4.0.0
requests==2.31.0
python-dotenv==1.0.0The platform auto-installs these on container start.
Environment variables
Store API keys in Secrets — they become os.environ variables:
import os
api_key = os.environ.get('MY_API_KEY')Using the AI Agent
Ask the agent to build Flask apps for you:
> "Build a Flask REST API with SQLite for storing notes. Each note has a title, body, and timestamp. Add endpoints to list, create, update, and delete notes. Use flask-sqlalchemy."
The agent handles SQLAlchemy setup, model definitions, migrations, and all routes.
Deployment
Click Publish to deploy. Your Flask app runs on Gunicorn behind Caddy with automatic HTTPS. No server configuration needed.
Data science workflows
Python + Jupyter is a popular combo. Ask the agent:
> "Set up a data analysis script that reads a CSV from /workspace/data.csv, calculates summary statistics, and outputs an HTML report."
Upload your CSV via the file tree (drag and drop) and the script processes it in the container.