Python

Python development with FastAPI, data processing, audio analysis with librosa. Type hints, async patterns, Pydantic models. Don't use for JavaScript/TypeScript code.

neuron-one 63428ac 1.1 KB Updated

File contents

Python Development

FastAPI Patterns

  • Pydantic models for all request/response
  • Dependency injection for services
  • Async/await for all I/O operations
  • Background tasks for heavy processing
  • Proper error handling with HTTPException

Type Hints

  • Required for all function signatures
  • Use Optional[] for nullable params
  • Use Union[] for multiple types
  • Generic types for collections

Data Processing

  • pandas for structured data
  • numpy for numerical operations
  • asyncio for concurrent I/O
  • ThreadPoolExecutor for CPU-bound tasks

Audio (librosa)

  • BPM detection: librosa.beat.beat_track
  • Key detection: librosa.feature.chroma_cqt
  • Energy: librosa.feature.rms
  • Spectral features: centroid, bandwidth, rolloff

Project Structure

project/
  ├── app/
  │   ├── main.py
  │   ├── models/
  │   ├── services/
  │   └── routes/
  ├── tests/
  ├── requirements.txt
  └── pyproject.toml

neuron-one/godmode/tree/main/skills/development/python commit 63428ac601

Frequently asked questions

npx skillmds@latest add neuron-one/python