83 lines
2.3 KiB
Markdown
83 lines
2.3 KiB
Markdown
|
|
# Fission Python Skill
|
||
|
|
|
||
|
|
Skill for creating, analyzing, and managing Fission Python projects.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## When to Use
|
||
|
|
|
||
|
|
- Creating new Fission Python projects from templates
|
||
|
|
- Analyzing Fission configuration (.fission files) in existing projects
|
||
|
|
- Parsing and updating embedded Fission configuration in function docstrings
|
||
|
|
|
||
|
|
## Key Concepts
|
||
|
|
|
||
|
|
- **Fission Project Structure**: Standard layout with src/, .fission/, specs/ directories
|
||
|
|
- **Function Docstring Configuration**: Fission configuration embedded in Python function docstrings between ```fission markers
|
||
|
|
- **Configuration Files**: .fission/deployment.json defines environments, packages, functions, secrets, and configmaps
|
||
|
|
|
||
|
|
## Patterns
|
||
|
|
|
||
|
|
### Project Template
|
||
|
|
Standard Fission Python project includes:
|
||
|
|
- `src/` - Python function source files with build.sh and requirements.txt
|
||
|
|
- `.fission/` - Fission configuration (deployment.json, etc.)
|
||
|
|
- `specs/` - Generated Fission specs
|
||
|
|
- `test/` - Unit tests
|
||
|
|
- `manifests/` - Kubernetes manifests
|
||
|
|
- `migrates/` - Database migrations
|
||
|
|
- `.devcontainer/` - Development container configuration
|
||
|
|
- `.gitea/workflows/` - CI/CD deployment workflows
|
||
|
|
|
||
|
|
All functions should use pydantic models for request/response validation and include comprehensive docstrings.
|
||
|
|
|
||
|
|
### Docstring Format
|
||
|
|
Fission configuration in docstrings follows this pattern:
|
||
|
|
```python
|
||
|
|
def main():
|
||
|
|
"""
|
||
|
|
Function description
|
||
|
|
|
||
|
|
```fission
|
||
|
|
{
|
||
|
|
"name": "function-name",
|
||
|
|
"http_triggers": {
|
||
|
|
"trigger-name": {
|
||
|
|
"url": "/endpoint",
|
||
|
|
"methods": ["GET", "POST"]
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
```
|
||
|
|
"""
|
||
|
|
# function implementation
|
||
|
|
```
|
||
|
|
|
||
|
|
## Tools
|
||
|
|
|
||
|
|
| Tool | Purpose |
|
||
|
|
|------|---------|
|
||
|
|
| `create-project.sh` | Create new Fission Python project from template |
|
||
|
|
| `analyze-config.sh` | Analyze .fission configuration in a project |
|
||
|
|
| `update-docstring.sh` | Parse and update docstrings in fission function methods |
|
||
|
|
|
||
|
|
## Examples
|
||
|
|
|
||
|
|
### Create a new project
|
||
|
|
```bash
|
||
|
|
fission-python-skill create-project my-new-function ./projects/
|
||
|
|
```
|
||
|
|
|
||
|
|
### Analyze project configuration
|
||
|
|
```bash
|
||
|
|
fission-python-skill analyze-config ./my-fission-project
|
||
|
|
```
|
||
|
|
|
||
|
|
### Update function docstring
|
||
|
|
```bash
|
||
|
|
fission-python-skill update-docstring ./src/my_function.py main
|
||
|
|
```
|
||
|
|
|
||
|
|
## Related Skills
|
||
|
|
|
||
|
|
- None - this is a specialized skill for Fission Python projects
|