This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new a72d57c616 [CI] Derive the version from Git tags via setuptools_scm 
(#19665)
a72d57c616 is described below

commit a72d57c616bdbf8d288e68687847599344e9fcb5
Author: Shushi Hong <[email protected]>
AuthorDate: Wed Jun 3 18:02:26 2026 -0400

    [CI] Derive the version from Git tags via setuptools_scm (#19665)
    
    Replace manual version.py stamping with scikit-build-core's
    setuptools_scm metadata provider, so local builds no longer call
    version.py. The Python distribution/runtime version comes from the
    generated python/tvm/_version.py (libinfo.py reads it with a fallback);
    the C++ TVM_VERSION is injected from SKBUILD_PROJECT_VERSION_FULL with a
    #ifndef default in base.h for bare cmake builds.
    
    version.py is removed. The publish workflow's wheel build checks out
    full history (fetch-depth: 0) so setuptools_scm can derive the version,
    and drops the version.py stamping step. release_process.rst is updated
    to the tag-driven release flow.
---
 .github/workflows/publish_wheel.yml |  20 +--
 .gitignore                          |   2 +
 CMakeLists.txt                      |  13 ++
 docs/conf.py                        |  15 +--
 docs/contribute/release_process.rst |  89 +++++++++-----
 include/tvm/runtime/base.h          |   6 +-
 pyproject.toml                      |  23 +++-
 python/tvm/libinfo.py               |  12 +-
 version.py                          | 234 ------------------------------------
 9 files changed, 114 insertions(+), 300 deletions(-)

diff --git a/.github/workflows/publish_wheel.yml 
b/.github/workflows/publish_wheel.yml
index 7e252ed7de..298c8234b7 100644
--- a/.github/workflows/publish_wheel.yml
+++ b/.github/workflows/publish_wheel.yml
@@ -167,7 +167,9 @@ jobs:
         with:
           ref: ${{ inputs.tag }}
           submodules: recursive
-          fetch-depth: 1
+          # Full history + tags so setuptools_scm can derive the wheel version 
from
+          # the most recent Git tag during the build (shallow clones break it).
+          fetch-depth: 0
           fetch-tags: true
 
       # Land the sidecar where -DTVM_PACKAGE_EXTRA_LIBS / cibuildwheel's 
/project
@@ -179,22 +181,6 @@ jobs:
           name: tvm-cuda-runtime-${{ matrix.arch }}
           path: build-wheel-cuda/lib
 
-      # Provide a known host Python (3.10) for the version-stamp step below; 
the wheel
-      # builds themselves use cibuildwheel's own interpreters.
-      - name: Set up Python (host)
-        uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # 
v6.2.0
-        with:
-          python-version: "3.10"
-
-      # Stamp the version from the git tag (git describe) so the wheel version 
comes
-      # from the ref being built, not the hardcoded value in pyproject.toml. 
version.py
-      # rewrites pyproject.toml (and libinfo.py etc.) in place; on a non-tag 
ref it
-      # falls back to the in-repo __version__. Runs on the host before 
cibuildwheel
-      # reads pyproject.
-      - name: Stamp wheel version from git
-        shell: bash
-        run: python version.py --git-describe
-
       - name: Build TVM wheel
         uses: ./.github/actions/build-wheel-for-publish
         with:
diff --git a/.gitignore b/.gitignore
index 5f97f3fc61..180eea6c4e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -289,6 +289,8 @@ STATUS.md
 
 # Local editable-install artifacts (pip install -e .)
 python/tvm_ffi/
+# Generated by setuptools_scm at build time
+python/tvm/_version.py
 python/bin/
 python/typing_extensions.py
 python/*.dist-info/
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9591352e4d..6e25f10e7f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,19 @@
 cmake_minimum_required(VERSION 3.18)
 project(tvm C CXX)
 
+# --- TVM version (no dependency on version.py) ---
+# When built via scikit-build-core the version is resolved by setuptools_scm 
and
+# passed in as SKBUILD_PROJECT_VERSION_FULL; bake it into the C++ TVM_VERSION 
macro.
+# A bare `cmake` build (no scikit-build-core) leaves the checked-in default in
+# include/tvm/runtime/base.h untouched. An explicit -DTVM_VERSION always wins.
+if(NOT DEFINED TVM_VERSION AND DEFINED SKBUILD_PROJECT_VERSION_FULL)
+  set(TVM_VERSION "${SKBUILD_PROJECT_VERSION_FULL}")
+endif()
+if(DEFINED TVM_VERSION)
+  message(STATUS "TVM_VERSION=${TVM_VERSION}")
+  add_compile_definitions(TVM_VERSION="${TVM_VERSION}")
+endif()
+
 # Utility functions
 include(cmake/utils/Utils.cmake)
 include(cmake/utils/Summary.cmake)
diff --git a/docs/conf.py b/docs/conf.py
index eadff4cd61..9fe2fc07f2 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -64,22 +64,13 @@ github_doc_root = 
"https://github.com/apache/tvm/tree/main/docs/";
 os.environ["TVM_BUILD_DOC"] = "1"
 
 
-def git_describe_version(original_version):
-    """Get git describe version."""
-    ver_py = tvm_path.joinpath("version.py")
-    libver = {"__file__": ver_py}
-    exec(compile(open(ver_py, "rb").read(), ver_py, "exec"), libver, libver)
-    _, gd_version = libver["git_describe_version"]()
-    if gd_version != original_version:
-        print(f"Use git describe based version {gd_version}")
-    return gd_version
-
-
 # Version information.
 import tvm
 from tvm import te, testing, topi
 
-version = git_describe_version(tvm.__version__)
+# The version is derived from the Git tag by setuptools_scm at build time and 
exposed
+# as tvm.__version__ (see [tool.setuptools_scm] in pyproject.toml).
+version = tvm.__version__
 release = version
 
 
diff --git a/docs/contribute/release_process.rst 
b/docs/contribute/release_process.rst
index a38fffe127..bd0ad48205 100644
--- a/docs/contribute/release_process.rst
+++ b/docs/contribute/release_process.rst
@@ -32,7 +32,7 @@ The release manager role in TVM means you are responsible for 
a few different th
 
   - Cutting a release branch
   - Informing the community of timing
-  - Making code changes in that branch with necessary version updates
+  - Making any necessary code changes in that branch (versions are derived 
from Git tags, so there are no manual version-number edits)
 
 - Running the voting process for a release
 
@@ -46,6 +46,30 @@ The release manager role in TVM means you are responsible 
for a few different th
   - Announcing the release
 
 
+Versioning
+----------
+
+TVM's version is derived automatically from the most recent Git tag by
+`setuptools_scm <https://setuptools-scm.readthedocs.io/>`_ at build time 
(configured
+under ``[tool.setuptools_scm]`` in ``pyproject.toml``). There are **no version 
numbers
+to edit by hand** in ``pyproject.toml``, ``python/tvm/libinfo.py`` or
+``include/tvm/runtime/base.h``; releasing is driven entirely by pushing Git 
tags:
+
+- ``main`` carries a ``vMAJOR.MINOR.devN`` tag (e.g. ``v0.7.dev0``). Commits 
after it
+  are versioned ``0.7.devN`` where ``N`` is the number of commits since the 
tag. This
+  is why the next dev tag must be pushed on ``main`` when a release branch is 
cut:
+  without it, follow-up commits would keep deriving their version from the 
previous
+  cycle's tag.
+- A release branch (e.g. ``v0.6``) is tagged ``v0.6.0.rc0`` for a candidate 
(wheel
+  version ``0.6.0rc0``) and ``v0.6.0`` for the formal release (wheel version
+  ``0.6.0``). Release wheels are built on the exact tag, so the version is the 
tag
+  itself.
+
+The legacy ``version.py`` stamping script has been removed. 
``web/package.json`` (npm,
+a separate ecosystem) is no longer auto-stamped; bump it by hand when starting 
a new dev
+cycle or cutting a release. ``docs/conf.py`` reads ``tvm.__version__`` 
directly.
+
+
 Prepare the Release Notes
 -------------------------
 
@@ -57,7 +81,9 @@ It is recommended to open a GitHub issue to collect feedbacks 
for the release no
 Prepare the Release Candidate
 -----------------------------
 
-There may be some code changes necessary to the release branch before the 
release. Ensure all version numbers are up to date
+There may be some code changes necessary on the release branch before the 
release (for
+example cherry-picked fixes). Version numbers are derived from the release 
tags (see
+`Versioning`_), so there are no version numbers to update by hand.
 
 
 Prepare the GPG Key
@@ -86,38 +112,46 @@ The last step is to update the KEYS file with your code 
signing key https://www.
 Cut a Release Candidate
 -----------------------
 
-To cut a release candidate branch for v0.6 release:
+To cut a release candidate for the ``v0.6`` release:
 
-- Need push two commits in one pull request: the first commit need update 
version number from 0.6.dev0 to 0.6.0, second commit in same one pull request 
updating version number from 0.6.0 to 0.7.dev0. For this title of pull request, 
need specify: `[Dont Squash]`;
-- After merged, cut a branch on first version number commit. Branches should 
be named with the base release version without the patch. For example, to cut a 
candidate for ``v0.6.0``, the branch should be ``v0.6`` and a tag named 
``v0.6.0.rc0`` pushed to the HEAD of that branch once cut.
+#. On the ``main`` commit that should be the last one included in the release, 
push the
+   **next** dev-cycle tag ``v0.7.dev0``. This tag is what makes subsequent 
``main``
+   commits versioned ``0.7.devN`` (see `Versioning`_), so it must be pushed 
*before*
+   branching.
+#. Cut the release branch off that same commit. Branches are named with the 
base
+   release version without the patch, e.g. ``v0.6`` for the ``v0.6.0`` release.
+#. Push the first release-candidate tag ``v0.6.0.rc0`` on the release branch. 
CI then
+   builds the candidate wheel (version ``0.6.0rc0``) for PyPI/TestPyPI 
testing. Keep
+   this tag on a ``v0.6`` branch commit that is **not** also the 
``v0.7.dev0``-tagged
+   branch point: when two tags share one commit, which one ``setuptools_scm`` 
picks is
+   fragile, so put the candidate tag on a release-prep commit on the branch.
 
 .. code-block:: bash
 
        git clone https://github.com/apache/tvm.git
        cd tvm/
 
-       # Update version numbers of first commit
-       # ...
-       git add .
-       git commit -m "Bump version numbers to v0.6.0"
-
-       # Update version numbers of second commit
-       # ...
-       git add .
-       git commit -m "Bump version numbers to v0.7.dev0"
+       # 1. Tag the next dev cycle on main (drives main's 0.7.devN version),
+       #    on the last commit to be included in the release.
+       git checkout <last-commit-for-release>
+       git tag v0.7.dev0
+       git push origin refs/tags/v0.7.dev0
 
-       # After pull request merged
-       # cut branch on first commit
-       git checkout <first-commit-id>
-
-       # Replace v0.6 with the relevant version
+       # 2. Cut the release branch off that same commit.
        git branch v0.6
        git push --set-upstream origin v0.6
 
+       # 3. Tag the first release candidate on the release branch. Keep this 
tag on a
+       #    release-prep commit, NOT the v0.7.dev0-tagged branch point, so the 
two tags
+       #    never share a commit.
+       git checkout v0.6
+       # ... make any release-prep commits (release notes, etc.) here ...
        git tag v0.6.0.rc0
        git push origin refs/tags/v0.6.0.rc0
 
-Make sure the version numbers in the source code are correct (example: 
https://github.com/apache/tvm/pull/14300). Run ``python3 version.py`` to update 
the version. Version numbers should be updated immediately after a release 
candidate branch is pushed.
+The wheel/distribution version is derived from these tags by 
``setuptools_scm`` at build
+time, so no source files need editing and you no longer run ``version.py`` to 
stamp the
+version (see `Versioning`_).
 
 Go to the GitHub repositories "releases" tab and click "Draft a new release",
 
@@ -170,12 +204,13 @@ Create GPG signature as well as the hash of the file,
 Update TVM Version on ``main``
 ------------------------------
 
-After cutting a release candidate, make sure to update the version numbers 
throughout ``main``. For example if we are
-releasing ``v0.10.0`` we want to bump the version numbers throughout the 
codebase from ``v0.10.dev0`` to ``v0.11.dev0``. An
-example of how to do this can be found here: 
`https://github.com/apache/tvm/pull/12190 
<https://github.com/apache/tvm/pull/12190>`_.
-Tag the commit on ``main`` immediately after the last one included in the 
release branch with the dev tag (e.g. ``v0.11.dev0``)
-for the next release. This tag is necessary so that the nightly packages built 
from ``main`` have the correct version
-number.
+The next dev-cycle tag pushed on ``main`` during the cut (step 1 above, e.g. 
``v0.7.dev0``)
+is what gives ``main`` its ``0.7.devN`` version — ``setuptools_scm`` derives 
it from that
+tag, so there are **no source version numbers to bump** (the old two-commit 
``[Dont Squash]``
+bump and the ``python version.py`` stamping step are no longer needed). Make 
sure that tag
+sits on the ``main`` commit immediately after the last one included in the 
release branch;
+it is required so that nightly/dev packages built from ``main`` carry the 
correct
+``0.7.devN`` version.
 
 Upload the Release Candidate
 ----------------------------
@@ -276,4 +311,4 @@ Send out an announcement email to [email protected], and 
[email protected]. T
 
 Patch Releases
 --------------
-Patch releases should be reserved for critical bug fixes. Patch releases must 
go through the same process as normal releases, with the option at the release 
manager's discretion of a shortened release candidate voting window of 24 hours 
to ensure that fixes are delivered quickly. Each patch release should bump the 
version numbers on the release base branch (e.g. ``v0.11``) and tags created 
for release candidates (e.g. ``v0.11.1.rc0``).
+Patch releases should be reserved for critical bug fixes. Patch releases must 
go through the same process as normal releases, with the option at the release 
manager's discretion of a shortened release candidate voting window of 24 hours 
to ensure that fixes are delivered quickly. A patch release is cut purely by 
tagging the release base branch (e.g. ``v0.11``): push ``v0.11.1.rc0`` for the 
candidate and ``v0.11.1`` for the formal patch release; no source version 
numbers need bumping.
diff --git a/include/tvm/runtime/base.h b/include/tvm/runtime/base.h
index 8f3f65cfeb..977ed67152 100644
--- a/include/tvm/runtime/base.h
+++ b/include/tvm/runtime/base.h
@@ -28,8 +28,12 @@
 // we will avoid defining extra C APIs here
 #include <tvm/ffi/c_api.h>
 
-// TVM version
+// TVM version. Overridable at build time via -DTVM_VERSION="..." 
(scikit-build-core
+// passes the setuptools_scm-resolved version through CMake). The literal 
below is the
+// fallback for a bare build with no override.
+#ifndef TVM_VERSION
 #define TVM_VERSION "0.25.dev0"
+#endif
 
 // TVM ships two shared libraries: libtvm_compiler and libtvm_runtime.
 // Each exposes its own DLL macro pair.  The two families are defined
diff --git a/pyproject.toml b/pyproject.toml
index baf38b3bcf..f4a5556eee 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -16,13 +16,14 @@
 # under the License.
 
 [build-system]
-requires = ["scikit-build-core>=0.11"]
+requires = ["scikit-build-core>=0.11", "setuptools-scm>=8"]
 build-backend = "scikit_build_core.build"
 
 [project]
 name = "tvm"
-# Note: Call version.py to update the version before building the wheel
-version = "0.25.dev0"
+# The version is derived from the most recent Git tag by setuptools_scm at 
build
+# time (see [tool.setuptools_scm]); no manual version stamping is required.
+dynamic = ["version"]
 description = "Apache TVM: An End-to-End Deep Learning Compiler Stack"
 readme = "README.md"
 license = "Apache-2.0"
@@ -88,6 +89,10 @@ build-dir = "build/{wheel_tag}"
 wheel.packages = ["python/tvm"]
 wheel.install-dir = "tvm"
 
+# Derive the project version from the Git tag via setuptools_scm
+# (configured under [tool.setuptools_scm]).
+metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
+
 # Source distribution configuration
 sdist.include = [
   # Build files
@@ -135,6 +140,17 @@ TVM_BUILD_PYTHON_MODULE = "ON"
 USE_CUDA = "OFF"
 BUILD_TESTING = "OFF"
 
+[tool.setuptools_scm]
+# Version comes from the most recent Git tag (vMAJOR.MINOR.devN or 
vMAJOR.MINOR.PATCH).
+# guess-next-dev reproduces the previous version.py behaviour for 
vMAJOR.MINOR.devN
+# tags (e.g. v0.25.dev0 + N commits -> 0.25.devN). local_scheme = 
"no-local-version"
+# drops the +g<hash> local segment: PyPI/TestPyPI reject local versions on 
upload, and
+# this matches the public version the old version.py stamped.
+version_file = "python/tvm/_version.py"
+version_scheme = "guess-next-dev"
+local_scheme = "no-local-version"
+fallback_version = "0.25.dev0"
+
 [tool.pytest.ini_options]
 testpaths = ["tests"]
 addopts = "-v --tb=short"
@@ -158,7 +174,6 @@ include = [
   "ci/scripts/**/*.py",
   "conftest.py",
   "jvm/**/*.py",
-  "version.py",
   "web/tests/**/*.py",
 ]
 line-length = 100
diff --git a/python/tvm/libinfo.py b/python/tvm/libinfo.py
index 136d85a49f..d91db1f572 100644
--- a/python/tvm/libinfo.py
+++ b/python/tvm/libinfo.py
@@ -323,8 +323,10 @@ def find_include_path(name=None, search_path=None, 
optional=False):
     return include_found
 
 
-# current version
-# We use the version of the incoming release for code
-# that is under development.
-# The following line is set by version.py
-__version__ = "0.25.dev0"
+# The version is written by setuptools_scm into _version.py at build time
+# (see [tool.setuptools_scm] in pyproject.toml). The fallback keeps a source
+# checkout with no build run importable.
+try:
+    from ._version import version as __version__
+except ImportError:  # pragma: no cover - source tree without a build
+    __version__ = "0.25.dev0"
diff --git a/version.py b/version.py
deleted file mode 100644
index 61a346c780..0000000000
--- a/version.py
+++ /dev/null
@@ -1,234 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# ruff: noqa: E741
-
-"""
-This is the global script that set the version information of TVM.
-This script runs and update all the locations that related to versions
-
-List of affected files:
-- tvm-root/python/tvm/libinfo.py
-- tvm-root/pyproject.toml
-- tvm-root/include/tvm/runtime/base.h
-- tvm-root/web/package.json
-"""
-
-import argparse
-import logging
-import os
-import re
-import subprocess
-
-# Modify the following value during release
-# ---------------------------------------------------
-# Current version:
-# We use the version of the incoming release for code
-# that is under development.
-#
-# It is also fallback version to be used when --git-describe
-# is not invoked, or when the repository does not present the
-# git tags in a format that this script can use.
-#
-# Two tag formats are supported:
-# - vMAJ.MIN.PATCH (e.g. v0.8.0) or
-# - vMAJ.MIN.devN (e.g. v0.8.dev0)
-__version__ = "0.25.dev0"
-
-# ---------------------------------------------------
-
-PROJ_ROOT = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
-
-
-def py_str(cstr):
-    return cstr.decode("utf-8")
-
-
-def git_describe_version():
-    """Get PEP-440 compatible public and local version using git describe.
-
-    Returns
-    -------
-    pub_ver: str
-        Public version.
-
-    local_ver: str
-        Local version (with additional label appended to pub_ver).
-
-    Notes
-    -----
-    - We follow PEP 440's convention of public version
-      and local versions.
-    - Only tags conforming to vMAJOR.MINOR.REV (e.g. "v0.7.0")
-      are considered in order to generate the version string.
-      See the use of `--match` in the `git` command below.
-
-    Here are some examples:
-
-    - pub_ver = '0.7.0', local_ver = '0.7.0':
-      We are at the 0.7.0 release.
-    - pub_ver =  '0.8.dev94', local_ver = '0.8.dev94+g0d07a329e':
-      We are at the 0.8 development cycle.
-      The current source contains 94 additional commits
-      after the most recent tag(v0.7.0),
-      the git short hash tag of the current commit is 0d07a329e.
-    """
-    cmd = [
-        "git",
-        "describe",
-        "--tags",
-        "--match",
-        "v[0-9]*.[0-9]*.[0-9]*",
-        "--match",
-        "v[0-9]*.[0-9]*.dev[0-9]*",
-    ]
-    proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, 
stderr=subprocess.STDOUT, cwd=PROJ_ROOT)
-    (out, _) = proc.communicate()
-
-    if proc.returncode != 0:
-        msg = py_str(out)
-        if msg.find("not a git repository") != -1:
-            return __version__, __version__
-        logging.warning("git describe: %s, use %s", msg, __version__)
-        return __version__, __version__
-    describe = py_str(out).strip()
-    arr_info = describe.split("-")
-
-    # Remove the v prefix, mainly to be robust
-    # to the case where v is not presented as well.
-    if arr_info[0].startswith("v"):
-        arr_info[0] = arr_info[0][1:]
-
-    # hit the exact tag
-    if len(arr_info) == 1:
-        return arr_info[0], arr_info[0]
-
-    if len(arr_info) != 3:
-        logging.warning("Invalid output from git describe %s", describe)
-        return __version__, __version__
-
-    dev_pos = arr_info[0].find(".dev")
-
-    # Development versions:
-    # The code will reach this point in case it can't match a full release 
version, such as v0.7.0.
-    #
-    # 1. in case the last known label looks like vMAJ.MIN.devN e.g. v0.8.dev0, 
we use
-    # the current behaviour of just using vMAJ.MIN.devNNNN+gGIT_REV
-    if dev_pos != -1:
-        dev_version = arr_info[0][: arr_info[0].find(".dev")]
-    # 2. in case the last known label looks like vMAJ.MIN.PATCH e.g. v0.8.0
-    # then we just carry on with a similar version to what git describe 
provides, which is
-    # vMAJ.MIN.PATCH.devNNNN+gGIT_REV
-    else:
-        dev_version = arr_info[0]
-
-    pub_ver = f"{dev_version}.dev{arr_info[1]}"
-    local_ver = f"{pub_ver}+{arr_info[2]}"
-    return pub_ver, local_ver
-
-
-# Implementations
-def update(file_name, pattern, repl, dry_run=False):
-    update = []
-    hit_counter = 0
-    need_update = False
-    with open(file_name) as file:
-        for l in file:
-            result = re.findall(pattern, l)
-            if result:
-                assert len(result) == 1
-                hit_counter += 1
-                if result[0] != repl:
-                    l = re.sub(pattern, repl, l)
-                    need_update = True
-                    print(f"{file_name}: {result[0]} -> {repl}")
-                else:
-                    print(f"{file_name}: version is already {repl}")
-
-            update.append(l)
-    if hit_counter != 1:
-        raise RuntimeError(f"Cannot find version in {file_name}")
-
-    if need_update and not dry_run:
-        with open(file_name, "w") as output_file:
-            for l in update:
-                output_file.write(l)
-
-
-def sync_version(pub_ver, local_ver, dry_run):
-    """Synchronize version."""
-    # python uses the PEP-440: local version
-    update(
-        os.path.join(PROJ_ROOT, "python", "tvm", "libinfo.py"),
-        r"(?<=__version__ = \")[.0-9a-z\+]+",
-        local_ver,
-        dry_run,
-    )
-    # pyproject.toml
-    update(
-        os.path.join(PROJ_ROOT, "pyproject.toml"),
-        r"(?<=^version = \")[.0-9a-z\+]+",
-        pub_ver,
-        dry_run,
-    )
-    # Use public version for other parts for now
-    # Note that full git hash is already available in libtvm
-    # C++ header
-    update(
-        os.path.join(PROJ_ROOT, "include", "tvm", "runtime", "base.h"),
-        r'(?<=TVM_VERSION ")[.0-9a-z\+]+',
-        pub_ver,
-        dry_run,
-    )
-    # web
-    # change to pre-release convention by npm
-    dev_pos = pub_ver.find(".dev")
-    npm_ver = pub_ver if dev_pos == -1 else 
f"{pub_ver[:dev_pos]}.0-{pub_ver[dev_pos + 1 :]}"
-    update(
-        os.path.join(PROJ_ROOT, "web", "package.json"),
-        r'(?<="version": ")[.0-9a-z\-\+]+',
-        npm_ver,
-        dry_run,
-    )
-
-
-def main():
-    logging.basicConfig(level=logging.INFO)
-    parser = argparse.ArgumentParser(description="Detect and synchronize 
version.")
-    parser.add_argument(
-        "--print-version",
-        action="store_true",
-        help="Print version to the command line. No changes is applied to 
files.",
-    )
-    parser.add_argument(
-        "--git-describe",
-        action="store_true",
-        help="Use git describe to generate development version.",
-    )
-    parser.add_argument("--dry-run", action="store_true")
-
-    opt = parser.parse_args()
-    pub_ver, local_ver = __version__, __version__
-    if opt.git_describe:
-        pub_ver, local_ver = git_describe_version()
-    if opt.print_version:
-        print(local_ver)
-    else:
-        sync_version(pub_ver, local_ver, opt.dry_run)
-
-
-if __name__ == "__main__":
-    main()

Reply via email to