Skip to main content

PyTSCheck

PyTSCheck logo: white PyTS lettering and checkmark on blue

Type-check TypeScript from Python, without installing Node.js or Go.

PyTSCheck wraps Microsoft's native TypeScript compiler, tsgo, and returns structured diagnostics for source strings, files, and projects. Platform wheels include the compiler and TypeScript standard-library declarations. The Python runtime has no third-party dependencies.

Documentation · Quick start · Python API · Publishing

Install

Requires Python 3.11 or later on a supported platform.

The current package version is 0.2.0, an initial release. Once that version is published to PyPI:

python -m pip install --only-binary=:all: "pytscheck==0.2.0"

Before publication, install the wheel for your operating system and Python architecture from a successful Build PyPI distributions Actions run:

python -m pip install /path/to/pytscheck-platform-wheel.whl
python -m pytscheck --version

Replace the example path with the actual downloaded .whl filename. See installation for Windows, offline installation, and source checkouts.

Check TypeScript

from pytscheck import check

result = check('export const age: number = "twenty";')
assert not result.success
assert result.errors[0].code == 2322

for error in result.errors:
    print(error.file, error.line, error.column, error.message)

Type errors return a Result. Missing compilers, invalid configuration, timeouts, and other operational failures raise exceptions.

from pytscheck import CompilerOptions, check_file, check_project

file_result = check_file("src/app.ts")
project_result = check_project(
    ".",
    options=CompilerOptions(target="es2022", module="nodenext"),
)

Project checking uses the root tsconfig.json when present. Without one, it checks discovered .ts, .tsx, .mts, and .cts files, excluding node_modules. The defaults enable strict checking and disable emission. See configuration for option precedence and project limitations.

JavaScript and JSDoc

Check JSDoc-typed JavaScript using a project tsconfig with allowJs, checkJs, and noEmit enabled, then run pytscheck project .. Strings and individual .js files can also be checked through CompilerOptions(extra={"allowJs": True, "checkJs": True}).

See the JSDoc guide and examples/check_jsdoc.py for working examples.

Command line

python -m pytscheck string 'export const x: number = 1;'
python -m pytscheck file src/app.ts --json
python -m pytscheck project .
python -m pytscheck --where

The installed pytscheck command accepts the same arguments. Exit codes are 0 for success, 1 for compiler errors, 2 for usage/configuration errors, and 3 for operational failures. See the CLI guide.

Integrate generated TypeScript

An adapter can provide generated TypeScript through SourceFile objects:

from pytscheck import SourceFile, check_project

class GeneratedAdapter:
    name = "example-generated"
    protocol_version = "1.0"

    def get_sources(self, project_root: str) -> list[SourceFile]:
        return [SourceFile(path="generated.ts", text="export const x: number = 1;")]

result = check_project(".", adapter=GeneratedAdapter())
assert result.success

Adapters live in consuming packages; core does not ship framework integrations. Source-map v3 positions can be translated back to original files. Optional ProjectContext adds inherited settings, real-project imports, and declarations bundled in Python packages. Read the adapter guide before integrating a component compiler.

Scope and compatibility

  • Python 3.11, 3.12, and 3.13 are exercised in CI.
  • Six wheels cover Linux, Windows, and macOS on x64 and ARM64. Linux wheels target glibc 2.17+; macOS wheels require macOS 12+.
  • The bundled compiler is pinned to 7.0.2. Its TypeScript behavior may differ from another tsc or tsgo version.
  • Checks run locally. Installing a wheel requires no compiler download at check time; building from source can download the pinned binary.
  • This is a checker API, not a JavaScript bundler, language server, or incremental build service. Project references are not automatically built with tsgo -b.

See compatibility, security, and troubleshooting.

Development and verification

git clone https://github.com/aldanedev-create/pytscheck.git
cd pytscheck
python -m venv .venv
# Activate .venv for your shell, then:
python -m pip install -e ".[dev]"
python scripts/build_binaries.py linux-x64
python -m pytest tests
python conformance/run.py

Use your platform identifier instead of linux-x64. Run the suite serially; failure tests temporarily replace the compiler. Full setup and release checks are in development and testing.

License and contributions

PyTSCheck is licensed under Apache-2.0. Bundled upstream components retain their own licenses and notices. Read CONTRIBUTING.md to contribute and SECURITY.md to report vulnerabilities.

Metadata

Release files for pytscheck 0.2.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 pytscheck 0.2.0
File Size Uploaded Provenance Actions
pytscheck-0.2.0.tar.gz 506.6 kB Without provenance Details for pytscheck-0.2.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pytscheck 0.2.0
File Actions
pytscheck-0.2.0-py3-none-win_arm64.whl Python 3 none Windows ARM64 Details for pytscheck-0.2.0-py3-none-win_arm64.whl
pytscheck-0.2.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for pytscheck-0.2.0-py3-none-win_amd64.whl
pytscheck-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64, Linux glibc 2.17+ x86-64 Details for pytscheck-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_2_x86_64.whl
pytscheck-0.2.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.musllinux_1_2_armv7l.whl Python 3 none Linux glibc 2.17+ ARMv7l, Linux musl 1.2+ ARMv7l Details for pytscheck-0.2.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.musllinux_1_2_armv7l.whl
pytscheck-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64, Linux glibc 2.17+ ARM64 Details for pytscheck-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_2_aarch64.whl
pytscheck-0.2.0-py3-none-macosx_12_0_x86_64.whl Python 3 none macOS 12.0+ x86-64 Details for pytscheck-0.2.0-py3-none-macosx_12_0_x86_64.whl
pytscheck-0.2.0-py3-none-macosx_12_0_arm64.whl Python 3 none macOS 12.0+ ARM64 Details for pytscheck-0.2.0-py3-none-macosx_12_0_arm64.whl

Total release size: 67.6 MB

Release files / pytscheck-0.2.0.tar.gz

Download URL pytscheck-0.2.0.tar.gz
Size 506.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f1149ed1e3a10af65721fd548c0390d80d3c193feac8ab0c71c121a8ba78f8f4
BLAKE2b-256 checksum
How to use checksums
82d6b558accd24fa61bf63d9b86effa9998c230722bf5723bbbb2253c117e6ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / pytscheck-0.2.0-py3-none-win_arm64.whl

Download URL pytscheck-0.2.0-py3-none-win_arm64.whl
Size 9.1 MB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
b99fe6d899be5439bce740b4731b33fa82782d526ddead59c6f85b7b5aa37b8b
BLAKE2b-256 checksum
How to use checksums
a0743bf2d11dc9f19c9dcbd8b2ea05cd512a566c0f8b89ada82c0b070abb7fbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / pytscheck-0.2.0-py3-none-win_amd64.whl

Download URL pytscheck-0.2.0-py3-none-win_amd64.whl
Size 10.0 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
a4cc2ec3013e48a35975f5b982d4159701247a661be754a7bbc64385e23d8384
BLAKE2b-256 checksum
How to use checksums
b3535a445f84d20879e6d063bc72845bbbc3ed20daa8489359449d2a49871810
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / pytscheck-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_2_x86_64.whl

Download URL pytscheck-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_2_x86_64.whl
Size 9.9 MB
Tags Linux glibc 2.17+ x86-64 Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
ec25357351875c3f371b57732d992430b0ea7790d50d2c4ab58ec71d760697ea
BLAKE2b-256 checksum
How to use checksums
56810bd341cfac8dd89b54878a8f355d3caed26719bb31929b97e45b5d24d5e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / pytscheck-0.2.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.musllinux_1_2_armv7l.whl

Download URL pytscheck-0.2.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.musllinux_1_2_armv7l.whl
Size 9.3 MB
Tags Linux glibc 2.17+ ARMv7l Linux musl 1.2+ ARMv7l Python 3
SHA-256 checksum
How to use checksums
66f32348d22f1c5f38382316774bdd38f9694bec3ea0452647fd085bafaf9e25
BLAKE2b-256 checksum
How to use checksums
7ffb0405f7be23617acfb6e7aea948954a8651a1c8487d898e4faaa8da6bf505
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / pytscheck-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_2_aarch64.whl

Download URL pytscheck-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_2_aarch64.whl
Size 9.1 MB
Tags Linux glibc 2.17+ ARM64 Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
5fcc69f968901d863bb41163caa3b6d94736b1c097a0baa382d8e4e6fbf612f6
BLAKE2b-256 checksum
How to use checksums
9386a92ab5a2c7ed53418891e181a56a2c592898145a05a3062287a7050ebdcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / pytscheck-0.2.0-py3-none-macosx_12_0_x86_64.whl

Download URL pytscheck-0.2.0-py3-none-macosx_12_0_x86_64.whl
Size 10.3 MB
Tags Python 3 macOS 12.0+ x86-64
SHA-256 checksum
How to use checksums
eb2fae3607e0d8b83d0ea84c7e10740efccdb698ce13e9495665336e57cfbe10
BLAKE2b-256 checksum
How to use checksums
d3e83fd45eb41d2109942eed86160277bb7111fb34de20ea1cadb598a407d4d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / pytscheck-0.2.0-py3-none-macosx_12_0_arm64.whl

Download URL pytscheck-0.2.0-py3-none-macosx_12_0_arm64.whl
Size 9.5 MB
Tags Python 3 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
8c1fffa5b859b45d537085c8c7229ace9004507e9a1863c6ee966915dcf2de3a
BLAKE2b-256 checksum
How to use checksums
6907e92887b290e19b9319a43b5730e6066454c11c03e4862589711aee3118d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Security for pytscheck 0.2.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.

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