Skip to content

Commit 81594fd

Browse files
Fix versioning
Signed-off-by: Thara Palanivel <[email protected]>
1 parent b92168f commit 81594fd

File tree

3 files changed

+35
-13
lines changed

3 files changed

+35
-13
lines changed

fms_mo/__init__.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,7 @@
1313
# limitations under the License.
1414
"""FMS Model Optimizer init. Import most commonly used functions and classes here."""
1515

16-
# Standard
17-
from importlib.metadata import PackageNotFoundError, version
18-
import logging
19-
2016
# Local
2117
from fms_mo.prep import qmodel_prep
2218
from fms_mo.utils.qconfig_utils import qconfig_init
23-
24-
VERSION_FALLBACK = "0.0.0"
25-
26-
try:
27-
__version__ = version("fms_mo")
28-
except PackageNotFoundError:
29-
__version__ = VERSION_FALLBACK
19+
from fms_mo.version import __version__, __version_tuple__

fms_mo/version.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright The FMS Model Optimizer Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
"""FMS Model Optimizer version"""
15+
16+
try:
17+
from ._version import __version__, __version_tuple__
18+
except Exception as e:
19+
import warnings
20+
21+
warnings.warn(f"Failed to read commit hash:\n{e}",
22+
RuntimeWarning,
23+
stacklevel=2)
24+
25+
__version__ = "dev"
26+
__version_tuple__ = (0, 0, __version__)

pyproject.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
22
build-backend = "setuptools.build_meta"
3-
requires = ["setuptools>=60", "setuptools-scm>=8.0"]
3+
requires = ["setuptools>=64", "setuptools-scm>=8.0"]
44

55
[project]
66
name = "fms-model-optimizer"
@@ -56,9 +56,15 @@ source = "https://github.com/foundation-model-stack/fms-model-optimizer"
5656
issues = "https://github.com/foundation-model-stack/fms-model-optimizer/issues"
5757

5858
[tool.setuptools_scm]
59+
# Version files are optional, this just marginally speeds up version inspection
60+
# at runtime
5961
version_file = "fms_mo/_version.py"
60-
# do not include +gREV local version, required for Test PyPI upload
62+
# Do not include +gREV local version, required for Test PyPI upload
63+
# Version strings are formatted as `{version}+{local}`, e.g. "0.1.dev1+gb1a7032"
64+
# Local versioning is incompatible with pypi, so we disable it by default.
6165
local_scheme = "no-local-version"
66+
# For more version configuration, see
67+
# https://setuptools-scm.readthedocs.io/en/latest/config/
6268

6369
[tool.setuptools.packages.find]
6470
where = [""]

0 commit comments

Comments
 (0)