| name | toolchain-python |
| description | Python project toolchain -- venv, pip, testing, linting, packaging, and debugging. |
| metadata | {"thinkfleetbot":{"emoji":"🐍","requires":{"bins":["python3"]}}} |
Python Toolchain
Common commands for Python projects.
Virtual environments
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
poetry install
poetry shell
poetry add requests
poetry add --group dev pytest
uv venv
uv pip install -r requirements.txt
uv pip install requests
Testing
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
python3 -m unittest discover -s tests
Linting & formatting
ruff check .
ruff check --fix .
ruff format .
black .
mypy src/
Running
python3 src/main.py
python3 -m mypackage
flask run --debug
python3 manage.py runserver
python3 manage.py migrate
python3 manage.py createsuperuser
Debugging
python3 -m pdb src/main.py
python3 -c "import sys; print(sys.version)"
python3 -c "import pkg; print(pkg.__version__)"
Packaging
pip install build
python3 -m build
pip install -e .
Dependencies
pip list --outdated
pip freeze > requirements.txt
pip-audit
Notes
- Check for
pyproject.toml, setup.py, or requirements.txt to understand project structure.
- Prefer virtual environments to avoid global package conflicts.
- Use
python3 explicitly (not python) for portability.