This is an automated email from the ASF dual-hosted git repository. tqchen pushed a commit to branch tqchen/printer-refinement in repository https://gitbox.apache.org/repos/asf/tvm.git
commit ed13ec061b0e2b7fd459bf704e7f1aebe7af383f Author: Tianqi Chen <[email protected]> AuthorDate: Thu Oct 1 22:06:15 2026 +0000 [CI] Use Python 3.12 for TVMScript round trips --- .github/actions/setup/action.yml | 10 ++++++++-- .github/workflows/main.yml | 6 ++++++ docs/contribute/testing.rst | 5 +++++ docs/reference/api/python/script/printer.rst | 10 ++++++++++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 980e5d087f..0ce25f3e4f 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -1,6 +1,12 @@ name: Setup TVM CI environment description: Set up the cached conda build environment and install tvm-ffi. +inputs: + python-version: + description: Python version for the build and test environment. + required: false + default: "3.10" + runs: using: "composite" steps: @@ -19,7 +25,7 @@ runs: environment-file: ci/scripts/package/build-environment.yaml auto-activate-base: false miniforge-version: latest - python-version: "3.10" + python-version: ${{ inputs.python-version }} condarc-file: tests/conda/condarc conda-remove-defaults: true - uses: conda-incubator/[email protected] @@ -31,7 +37,7 @@ runs: auto-activate-base: false miniforge-version: latest use-only-tar-bz2: true - python-version: "3.10" + python-version: ${{ inputs.python-version }} condarc-file: tests/conda/condarc conda-remove-defaults: true - name: Conda info diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7a524732cf..a177aa4054 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -47,6 +47,9 @@ jobs: submodules: 'recursive' - name: Set up environment uses: ./.github/actions/setup + with: + # Generated TVMScript type parameter headers require Python 3.12+. + python-version: "3.12" - name: Detect environment variables uses: ./.github/actions/detect-env-vars id: env_vars @@ -103,6 +106,9 @@ jobs: submodules: 'recursive' - name: Set up environment uses: ./.github/actions/setup + with: + # Generated TVMScript type parameter headers require Python 3.12+. + python-version: "3.12" - name: Detect environment variables uses: ./.github/actions/detect-env-vars id: env_vars diff --git a/docs/contribute/testing.rst b/docs/contribute/testing.rst index 8dd71ca4ca..af50ea714f 100644 --- a/docs/contribute/testing.rst +++ b/docs/contribute/testing.rst @@ -212,6 +212,11 @@ Running Locally To run the Python unit tests locally, use the command ``pytest`` in the ``${TVM_HOME}`` directory. +Use Python 3.12 or newer for TVMScript printer and round-trip tests, including +when running the full Python test suite. Eligible printed functions use PEP 695 +type parameter headers, which older Python versions cannot parse. This generated +syntax requirement is separate from the package's minimum Python version. + - Environment variables - ``TVM_TEST_TARGETS`` should be a semicolon-separated list of targets to run. If unset, will default to the targets defined in diff --git a/docs/reference/api/python/script/printer.rst b/docs/reference/api/python/script/printer.rst index cc16c55c3b..adb8bcc34f 100644 --- a/docs/reference/api/python/script/printer.rst +++ b/docs/reference/api/python/script/printer.rst @@ -18,6 +18,16 @@ tvm.script.printer ------------------------- +Generated syntax +**************** + +Printed functions use PEP 695 type parameter headers, such as +``def main[n](...)``, when their symbolic parameters can be declared locally. +Parsing or executing this generated syntax requires Python 3.12 or newer. +The printer uses the same syntax on older Python versions; it does not select +a compatibility spelling based on the host interpreter. Symbols shared across +functions retain their shared bindings instead of becoming local type parameters. + tvm.script.printer ************************* .. automodule:: tvm.script.printer
