forked from vipshop/cache-dit
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·55 lines (44 loc) · 1.41 KB
/
setup.py
File metadata and controls
executable file
·55 lines (44 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import importlib.util
if importlib.util.find_spec("setuptools_scm") is None:
raise ImportError(
"setuptools-scm is not installed. Install it by `pip3 install setuptools-scm`"
)
import os
import subprocess
from os import path
from setuptools import find_packages, setup
from setuptools_scm.version import get_local_dirty_tag
PACKAGE_NAME = "cache-dit"
def is_git_directory(path="."):
return (
subprocess.call(
["git", "-C", path, "status"],
stderr=subprocess.STDOUT,
stdout=open(os.devnull, "w"),
)
== 0
)
def my_local_scheme(version):
# The following is used to build release packages.
# Users should never use it.
local_version = os.getenv("CACHE_DIT_BUILD_LOCAL_VERSION")
if local_version is None:
return get_local_dirty_tag(version)
return f"+{local_version}"
setup(
name=PACKAGE_NAME,
description="A PyTorch-native and Flexible Inference Engine with Hybrid Cache Acceleration and Parallelism for 🤗DiTs.",
author="DefTruth, vipshop.com",
use_scm_version={
"write_to": path.join("src", "cache_dit", "_version.py"),
"local_scheme": my_local_scheme,
},
package_dir={"": "src"},
packages=find_packages(where="src"),
python_requires=">=3.10",
entry_points={
"console_scripts": [
"cache-dit-metrics-cli = cache_dit.metrics:main",
],
},
)