From 128d29b118af33df107a4451592b9705f021ab31 Mon Sep 17 00:00:00 2001 From: Abishek Sethuraman Date: Mon, 27 Oct 2025 14:20:16 -0700 Subject: [PATCH] Have versioning be in a single place for some cases (#1146) Summary: Goal here is to have one single place for version that will be manully updated. Reviewed By: kiukchung Differential Revision: D83858764 --- setup.py | 7 +++---- torchx/_version.py | 8 ++++++++ torchx/version.py | 4 ++-- 3 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 torchx/_version.py diff --git a/setup.py b/setup.py index ce29c7462..39f8689fb 100644 --- a/setup.py +++ b/setup.py @@ -14,10 +14,9 @@ def get_version(): - # get version string from version.py - # TODO: ideally the version.py should be generated when setup is run - version_file = os.path.join(os.path.dirname(__file__), "torchx/version.py") - version_regex = r"__version__ = ['\"]([^'\"]*)['\"]" + # get version string from _version.py + version_file = os.path.join(os.path.dirname(__file__), "torchx/_version.py") + version_regex = r"BASE_VERSION = ['\"]([^'\"]*)['\"]" with open(version_file, "r") as f: version = re.search(version_regex, f.read(), re.M).group(1) return version diff --git a/torchx/_version.py b/torchx/_version.py new file mode 100644 index 000000000..09810e2c1 --- /dev/null +++ b/torchx/_version.py @@ -0,0 +1,8 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +# pyre-strict +BASE_VERSION = "0.8.0dev0" diff --git a/torchx/version.py b/torchx/version.py index e3a7632f7..746df34a5 100644 --- a/torchx/version.py +++ b/torchx/version.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # @@ -7,6 +6,7 @@ # pyre-strict +from torchx._version import BASE_VERSION from torchx.util.entrypoints import load # Follows PEP-0440 version scheme guidelines @@ -18,7 +18,7 @@ # 0.1.0bN # Beta release # 0.1.0rcN # Release Candidate # 0.1.0 # Final release -__version__ = "0.8.0dev0" +__version__: str = BASE_VERSION # Use the github container registry images corresponding to the current package