Skip to main content

Adaptive test discovery for Python projects

Project description

adaptive-tests-py

Python port of the adaptive discovery engine. It mirrors the JavaScript API so polyglot teams can keep their testing strategy consistent across stacks while preserving the zero-runtime guarantees of static analysis.

Installation

pip install adaptive-tests-py

Usage

from adaptive_tests_py import DiscoveryEngine, Signature

engine = DiscoveryEngine(root=".")
result = engine.discover(
    Signature(name="TodoService", methods=["add", "complete", "list"]),
    load=False,
)

print(result.module, result.methods)
TodoService = result.load()  # module imported on demand
service = TodoService()
service.add("Ship adaptive tests")

Use engine.discover_all(signature) to inspect every ranked match when tuning signatures or debugging coverage. The engine now mirrors the JavaScript implementation more closely:

  • Configurable scoring – drop an adaptive-tests.config.json (or pass inline overrides) to tweak path/file/method weighting.
  • Persistent cache – results are stored in .adaptive-tests-cache.json and re-used on future runs when the target file is unchanged.
  • Lens explanations – call engine.explain(signature) to retrieve top candidates with per-factor score breakdowns.

CLI

The package ships with a lightweight CLI so you can run discovery diagnostics and scaffold pytest stubs without writing code:

adaptive-tests-py why '{"name": "TodoService"}' --root examples/python/src --limit 3
adaptive-tests-py why signature.json --json
adaptive-tests-py discover '{"name": "TodoService"}' --root .
adaptive-tests-py scaffold src/services/user_service.py --tests-dir tests/adaptive

Use --no-cache for a fresh scan and --config path/to/config.json to supply overrides ad-hoc.

Configuration can also be placed in pyproject.toml under the [tool.adaptive_tests] table to match modern Python tooling conventions.

Python Example Project

See examples/python/ for a full pytest demo, custom configuration, and advanced signatures.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adaptive-tests-py-0.2.5.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adaptive_tests_py-0.2.5-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file adaptive-tests-py-0.2.5.tar.gz.

File metadata

  • Download URL: adaptive-tests-py-0.2.5.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for adaptive-tests-py-0.2.5.tar.gz
Algorithm Hash digest
SHA256 f09a2ab69cd56a62266f28cfd0ba7e43925bbd413c5dde9a8509de0b7c953c70
MD5 4ef996911977cf1ca78adb6b51b6b4c6
BLAKE2b-256 247232fca7a7763b9fb51d8418f25416b3ab80146530de5b8833f674c05f74fd

See more details on using hashes here.

File details

Details for the file adaptive_tests_py-0.2.5-py3-none-any.whl.

File metadata

File hashes

Hashes for adaptive_tests_py-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bcd04cec96d66731230a8202b213e2175a7748ad5d47e5df804dccc237042ea8
MD5 23721e9cf43c068a77364b59ebb07ef2
BLAKE2b-256 a407d515acd9c2e4de8671fb0b353b0819021a7b746de014f57e028e0ece5184

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page