tox.ini•4.22 kB
###############################################################################
# 📦 tox.ini - multi-interpreter test matrix powered by uv #
###############################################################################
#
# ➡ Why tox-uv?
# - one-shot lock-file-free dependency resolution (⚡ fast)
# - identical logic on macOS / Linux / Windows
# - ultra-small virtualenvs under ~/.cache/uv/venv
#
# ➡ Quickstart
# uv pip install tox tox-uv # install once
# tox -p auto # run whole matrix
#
# ➡ Environments
# py310 / py311 / py312 / py313 → full test-suite (pytest)
# lint → Ruff + Black + isort + etc.
# type → mypy strict type-checking
# pkg → build sdist + wheel with uv
#
###############################################################################
#############################
# Core tox configuration
#############################
[tox]
requires = tox>=4 # 🔗 plugin discovery happens through this
envlist = py310, py311, py312, py313, lint, type, pkg
skip_missing_interpreters = true # dev machines that miss 3.13-dev
#########################################
# GitHub-Actions / Azure DevOps mapping
#########################################
[gh-actions]
python =
3.10: py310
3.11: py311
3.12: py312
3.13: py313
#####################################################################
# 🔬 Default test environment #
# Every pyXY uses the same definition; only the interpreter differs. #
#####################################################################
[testenv] # <-- inherited by py310 / py311 / ...
runner = uv-venv-runner # tox-uv: create venv via 'uv venv'
package = uv-editable # install our package *editable* with 'uv pip'
extras = dev # pulls in pytest, coverage, ruff, ...
description = Run pytest against {basepython}
commands =
pytest -q {posargs}
passenv =
DATABASE_URL
MCPGATEWAY_* # <-- commonly used by this repo's tests
AUTH_* #
CACHE_* #
setenv =
PYTHONWARNINGS = ignore::DeprecationWarning
##########################
# 🧹 Code style & lint
##########################
[testenv:lint]
runner = uv-venv-runner
skip_install = true # linting doesn't need our package importable
extras = dev
description = Static-analysis (ruff + black -check + isort -check + bandit)
commands =
ruff check .
black --check .
isort --check-only .
bandit -r mcpgateway -n 5
pre-commit run --all-files --show-diff-on-failure
###################################
# 🔍 Strict static type checking
###################################
[testenv:type]
runner = uv-venv-runner
skip_install = true
extras = dev
description = Mypy strict type-checking
commands =
mypy mcpgateway tests --install-types --non-interactive
################################
# 📦 Build sdist + universal wheel
################################
[testenv:pkg]
runner = uv-venv-runner
skip_install = true
deps = build # minimal requirement for PEP 517 build
description = Build wheel + sdist via uv
commands =
python3 -m build --sdist --wheel --outdir {toxworkdir}/dist
###############################################################################
# ☑︎ Advanced uv knobs (optional - uncomment if you need them)
###############################################################################
# [testenv]
# uv_seed = true # ⤷ inject pip/setuptools/wheel (legacy builds)
# uv_resolution = lowest # ⤷ lowest, lowest-direct, highest (default)
# system_site_packages = false # ⤷ give env access to global site-pkgs
#
# [testenv:lock-example]
# runner = uv-venv-lock-runner # use uv.lock + uv sync
# extras = dev # install [dev] extras listed in uv.lock
###############################################################################