1
1
# Copyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved.
2
- #
2
+ #
3
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
4
# you may not use this file except in compliance with the License.
5
5
# You may obtain a copy of the License at
6
- #
6
+ #
7
7
# http://www.apache.org/licenses/LICENSE-2.0
8
- #
8
+ #
9
9
# Unless required by applicable law or agreed to in writing,
10
10
# software distributed under the License is distributed on an "AS IS" BASIS,
11
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
15
import os
16
16
from setuptools import setup , find_packages
17
17
from typing import List , Dict , Tuple
18
- from utils .artifacts import get_release_and_version
18
+
19
+
20
+ def get_release_and_version (package_path : str ) -> Tuple [bool , bool , str , str , str , str ]:
21
+ """
22
+ Load version and release info from compressed-tensors package
23
+ """
24
+ # compressed-tensors/src/compressed_tensors/version.py always exists, default source of truth
25
+ version_path = os .path .join (package_path , "version.py" )
26
+
27
+ # exec() cannot set local variables so need to manually
28
+ locals_dict = {}
29
+ exec (open (version_path ).read (), globals (), locals_dict )
30
+ is_release = locals_dict .get ("is_release" , False )
31
+ version = locals_dict .get ("version" , "unknown" )
32
+ version_major = locals_dict .get ("version_major" , "unknown" )
33
+ version_minor = locals_dict .get ("version_minor" , "unknown" )
34
+ version_bug = locals_dict .get ("version_bug" , "unknown" )
35
+
36
+ print (f"Loaded version { version } from { version_path } " )
37
+
38
+ return (
39
+ is_release ,
40
+ version ,
41
+ version_major ,
42
+ version_minor ,
43
+ version_bug ,
44
+ )
19
45
20
46
21
47
package_path = os .path .join (
35
61
_PACKAGE_NAME = "compressed-tensors"
36
62
else :
37
63
_PACKAGE_NAME = "compressed-tensors-nightly"
38
-
64
+
39
65
40
66
def _setup_long_description () -> Tuple [str , str ]:
41
67
return open ("README.md" , "r" , encoding = "utf-8" ).read (), "text/markdown"
@@ -44,7 +70,7 @@ def _setup_packages() -> List:
44
70
return find_packages (
45
71
"src" , include = ["compressed_tensors" , "compressed_tensors.*" ], exclude = ["*.__pycache__.*" ]
46
72
)
47
-
73
+
48
74
def _setup_install_requires () -> List :
49
75
return ["torch>=1.7.0" , "transformers" , "pydantic>=2.0" ]
50
76
0 commit comments