Typebridge
Typebridge is a small, dependency-free checker for mixed Python and TypeScript repositories. It inventories function parameters, return values, variables, class attributes, and TypeScript interface properties; measures annotation coverage; and compares same-named items across languages after normalizing common type spellings.
Install and run
Python 3.10 or newer is required.
python -m pip install typebridge-check
typebridge /path/to/repository
The distribution is named typebridge-check; the installed command is typebridge. Generate a starting configuration in a repository with:
typebridge . --init-config
typebridge . --init-config --force # replace an existing typebridge.yml
It also runs directly from a source checkout:
PYTHONPATH=src python -m typebridge .
PYTHONPATH=src python -m typebridge . --json
PYTHONPATH=src python -m typebridge . --show-items
Useful command checks:
typebridge --version
typebridge --help
To analyze only Python code reachable from a Django view, API handler, or other callable, pass its import path:
typebridge . --entry myapp.views:get_user
typebridge . --entry myapp.views:UserView.get --json
Entry mode reads pyproject.toml dependencies, locates their installed source without importing them, and follows calls into a dependency only when a reachable function calls that dependency. Calls made by reached dependency functions are followed transitively up to traversal.max_depth and traversal.max_files in typebridge.yml. Uncalled functions—even functions in an already reached file—are not scored. Repository TypeScript remains included so its declarations can be compared with the reachable Python contract.
For each statically resolvable call, Typebridge also compares annotated arguments and literal argument types with the called function's parameter annotations. These call-contract checks contribute to consistency and identify reachable dependency mismatches directly.
Local package roots default to . and src and can be changed with traversal.source_roots. Set traversal.include_installed_dependencies to false to confine traversal to the repository.
Scoring
- Coverage is the percentage of discovered items with an explicit type.
- Consistency is the percentage of cross-language matches whose normalized types agree. It is reported as
n/awhen there are no matches instead of awarding an artificial perfect score. - Overall combines those values using the weights in
typebridge.yml(40% coverage and 60% consistency by default).
Names are compared after converting camel case to snake case, so getUser.userId matches get_user.user_id. Built-in aliases make types such as Python str/int agree with TypeScript string/number. Add project-specific equivalents under type_aliases in typebridge.yml.
Set scoring.minimum_score to make the command exit with status 1 when the score is too low, which is useful in CI. Parse/configuration failures exit with status 2. JSON output contains every cross-language match and its source location.
This intentionally uses lightweight static parsing rather than invoking mypy or tsc: it measures annotation presence and repository agreement, while those compilers remain responsible for proving language-specific correctness.
Call traversal is also static. Direct calls, imported functions, module attributes, class methods through self, and relative imports are supported. Runtime-generated calls, reflection, monkey-patching, and dependency modules distributed only as compiled extensions cannot be followed safely and are skipped.
Test
PYTHONPATH=src python -m unittest discover -s tests -v
Build a release
python -m pip install -e '.[dev]'
python -m build
python -m twine check dist/*
Upload first to TestPyPI when preparing a release. Publishing requires a PyPI account and API token and is intentionally not performed by the package itself.
Metadata
Release files for typebridge-check 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| typebridge_check-0.0.1.tar.gz | 18.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| typebridge_check-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.5 kB
Release files / typebridge_check-0.0.1.tar.gz
| Download URL | typebridge_check-0.0.1.tar.gz |
|---|---|
| Size | 18.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
11ecd2627e1cf90bfd59abf70207fc1aa36e345275379177b7c6a8d73efdf1a5
|
|
BLAKE2b-256 checksum How to use checksums |
4d4b9ad8f93d2b73a4bbfbd60759dda14be76e852c172d8a09cbd9ee3a2d4b4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / typebridge_check-0.0.1-py3-none-any.whl
| Download URL | typebridge_check-0.0.1-py3-none-any.whl |
|---|---|
| Size | 18.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9f379012269d53d32520d014575d0e2ec17fccf8ff1b8ad5b3cb09af8931f881
|
|
BLAKE2b-256 checksum How to use checksums |
a07157cb0daaf784971b662c3b75f3472b323f32e7627128b16d6ed8aa9850bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for typebridge-check 0.0.1
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.