toolchain-python
Python Toolchain
Common commands for Python projects.
Virtual environments
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
# Poetry
poetry install
poetry shell
poetry add requests
poetry add --group dev pytest
# uv (fast)
uv venv
uv pip install -r requirements.txt
uv pip install requests
Testing
# pytest
python3 -m pytest
python3 -m pytest -v --tb=short
python3 -m pytest tests/test_api.py -k "test_login"
python3 -m pytest --cov=src --cov-report=term-missing
# unittest
python3 -m unittest discover -s tests
Linting & formatting
# Ruff (fast, replaces flake8+isort+black)
ruff check .
ruff check --fix .
ruff format .
# Black
black .
# Mypy (type checking)
mypy src/
Running
python3 src/main.py
python3 -m mypackage
# Flask
flask run --debug
# Django
python3 manage.py runserver
python3 manage.py migrate
python3 manage.py createsuperuser
Debugging
python3 -m pdb src/main.py # PDB debugger
python3 -c "import sys; print(sys.version)"
python3 -c "import pkg; print(pkg.__version__)"
Packaging
pip install build
python3 -m build # Build wheel + sdist
pip install -e . # Editable install
Dependencies
pip list --outdated
pip freeze > requirements.txt
pip-audit # Security audit
Notes
- Check for
pyproject.toml,setup.py, orrequirements.txtto understand project structure. - Prefer virtual environments to avoid global package conflicts.
- Use
python3explicitly (notpython) for portability.
More from thinkfleetai/thinkfleet-engine
local-whisper
Local speech-to-text using OpenAI Whisper. Runs fully offline after model download. High quality transcription with multiple model sizes.
148flyio-cli-public
Use the Fly.io flyctl CLI for deploying and operating apps on Fly.io: deploys (local or remote builder), viewing status/logs, SSH/console, secrets/config, scaling, machines, volumes, and Fly Postgres (create/attach/manage databases). Use when asked to deploy to Fly.io, debug fly deploy/build/runtime failures, set up GitHub Actions deploys/previews, or safely manage Fly apps and Postgres.
24kagi-search
Web search using Kagi Search API. Use when you need to search the web for current information, facts, or references. Requires KAGI_API_KEY in the environment.
22feishu-bridge
Connect a Feishu (Lark) bot to ThinkFleet via WebSocket long-connection. No public server, domain, or ngrok required. Use when setting up Feishu/Lark as a messaging channel, troubleshooting the Feishu bridge, or managing the bridge service (start/stop/logs). Covers bot creation on Feishu Open Platform, credential setup, bridge startup, macOS launchd auto-restart, and group chat behavior tuning.
13bambu-local
Control Bambu Lab 3D printers locally via MQTT (no cloud). Supports A1, A1 Mini, P1P, P1S, X1C.
10voice-transcribe
Transcribe audio files using OpenAI's gpt-4o-mini-transcribe model with vocabulary hints and text replacements. Requires uv (https://docs.astral.sh/uv/).
10