Skip to main content

LangAdapter

PyPI version Python versions License: MIT Documentation

LangAdapter runs a project's own test, coverage, mutation and timing tools and reports what they observed as typed results. It supports Python and Java projects, locally and in a running Linux container you provide, and C projects on Linux. It works with any test suite, written by people or generated, and needs no model access.

Install

The library needs Python 3.10 or newer. It is supported on Windows and Linux, the systems where it confirms that a command and everything it started have ended. On macOS it is expected to work, but this release has not run on a Mac: Tested environments says what is known. On macOS and other POSIX systems it runs each command in its own process group and cannot confirm that every descendant ended, so it warns and records that in its observations. Install it into the Python environment of the program that uses it, such as a virtual environment. On Ubuntu 24.04, also in WSL, Python is python3, and a virtual environment needs the package python3-venv:

sudo apt-get install python3-venv
python3 -m venv .venv
.venv/bin/python -m pip install langadapter

On Windows:

py -m venv .venv
.venv\Scripts\python -m pip install langadapter

In a source checkout, .venv/bin/python -m pip install . installs it from the checkout. For C projects, install it with the extra for C: .venv/bin/python -m pip install "langadapter[c]". On Windows the environment's Python is .venv\Scripts\python.

The project under test keeps its own runtime and tools, which Getting started names for each language. On Ubuntu 24.04 on x86_64, langadapter toolchains installs them, as Install the toolchains describes.

Example

Run a Python project's tests with the project's interpreter and read the result:

import langadapter as la
from langadapter.runs import SuiteRunRequest

project = "path/to/project"
project_python = "path/to/project/.venv/bin/python"  # path/to/project/.venv/Scripts/python.exe on Windows
context = la.ProjectContext(root=project, interpreter=la.Interpreter(path=project_python))
adapter = la.create("python", context)
suite = la.Suite(project, ("tests/test_example.py",))
result = adapter.tests.run_suite(SuiteRunRequest(suite, timeout_s=120))
print(result.outcome, result.counts.passed, "passed")

If the project has a conftest.py in its directory or in tests, list it as a setup file, for example la.Suite(project, ("tests/test_example.py",), ("tests/conftest.py",)). A run refuses a suite that leaves out a setup file pytest would load.

Every result carries an outcome such as completed, test_failures, missing_setup or unsupported, and a reason, as Outcomes describes.

Documentation

The documentation site is https://k-kammler.github.io/langadapter/.

The guides also cover containers, source analysis and settings, and the explanations cover outcomes, prepared copies of a project and environment selection. The guides are also in the repository's docs directory and installed with the package under share/doc/langadapter/docs, without the API reference, which is on the site only: in the installed copy, Python's help() shows each name's documentation. Building the site yourself is described in CONTRIBUTING.md. What the library depends on and downloads, with each license, is in THIRD_PARTY_NOTICES.md.

License

MIT, see LICENSE.

Metadata

Release files for langadapter 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langadapter 0.1.0
File Size Uploaded Provenance Actions
langadapter-0.1.0.tar.gz 902.7 kB Without provenance Details for langadapter-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langadapter 0.1.0
File Interpreter ABI Platform Actions
langadapter-0.1.0-py3-none-any.whl Python 3 none any Details for langadapter-0.1.0-py3-none-any.whl

Total release size: 1.9 MB

Release files / langadapter-0.1.0.tar.gz

Download URL langadapter-0.1.0.tar.gz
Size 902.7 kB
Tags Source
SHA-256 checksum
How to use checksums
63578ae1cd156b7492949c8daa9cd830344e1c30b1c9cb63eddeacb3a43f6e1d
BLAKE2b-256 checksum
How to use checksums
a2c6060d7dfd361db103164b2aa6443055da6fc413e2823ce28968a417840d1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / langadapter-0.1.0-py3-none-any.whl

Download URL langadapter-0.1.0-py3-none-any.whl
Size 1.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
582b2f1bf0d57e66d6a170e62178bb663be545ee25b865b826bdd15eabb4f087
BLAKE2b-256 checksum
How to use checksums
be6624fa697f9be57d8f97c3498ceacb776646402862857eca9cfdd3032cf038
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for langadapter 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page