File tree Expand file tree Collapse file tree 3 files changed +11
-21
lines changed Expand file tree Collapse file tree 3 files changed +11
-21
lines changed Original file line number Diff line number Diff line change 3232set_mkl ()
3333
3434try :
35- from ._version import version as __version__
35+ from deepmd_cli ._version import version as __version__
3636except ImportError :
3737 from .__about__ import (
3838 __version__ ,
Original file line number Diff line number Diff line change 11# SPDX-License-Identifier: LGPL-3.0-or-later
22import argparse
3- import importlib .util
43import logging
5- import os
6- import sys
74import textwrap
85from typing import (
96 List ,
107 Optional ,
118)
129
13-
14- def load_child_module (name ):
15- """Load a child module without loading its parent module."""
16- names = name .split ("." )
17- parent_spec = importlib .util .find_spec (names [0 ])
18- paths = os .path .join (* names [1 :]) + ".py"
19- spec = importlib .util .spec_from_file_location (
20- name , os .path .join (parent_spec .submodule_search_locations [0 ], paths )
21- )
22- module = importlib .util .module_from_spec (spec )
23- sys .modules [name ] = module
24- spec .loader .exec_module (module )
25- return module
26-
27-
28- __version__ = load_child_module ("deepmd._version" ).__version__
10+ try :
11+ from deepmd_cli ._version import version as __version__
12+ except ImportError :
13+ __version__ = "unknown"
2914
3015
3116def get_ll (log_level : str ) -> int :
Original file line number Diff line number Diff line change @@ -59,7 +59,6 @@ documentation = "https://docs.deepmodeling.com/projects/deepmd"
5959repository = " https://github.com/deepmodeling/deepmd-kit"
6060
6161[tool .setuptools_scm ]
62- write_to = " deepmd/_version.py"
6362
6463[tool .scikit-build ]
6564experimental = true
@@ -97,6 +96,12 @@ provider-path = "backend"
9796provider = " backend.dynamic_metadata"
9897provider-path = " backend"
9998
99+ [[tool .scikit-build .generate ]]
100+ path = " deepmd_cli/_version.py"
101+ template = '''
102+ version = "${version}"
103+ '''
104+
100105[tool .cibuildwheel ]
101106test-command = [
102107 " python -m deepmd -h" ,
You can’t perform that action at this time.
0 commit comments