-
Notifications
You must be signed in to change notification settings - Fork 11
/
setup.py
54 lines (50 loc) · 1.85 KB
/
setup.py
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
from setuptools import setup, find_packages
from typing import Optional
import subprocess
import sys
def get_git_commit_id(n_digits=8) -> Optional[str]:
try:
# Run the git command to get the current commit ID
commit_id = subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip()
# Decode bytes to string (Python 3.x)
commit_id = commit_id.decode('utf-8')
return commit_id[:n_digits]
except subprocess.CalledProcessError as e:
print("Failed to get Git commit ID:", e)
return None
def get_version():
# Read the version from the VERSION.txt file
with open("depyf/VERSION.txt", "r") as f:
version = f.read().strip()
# If the current commit ID is available, append it to the version
commit_id = get_git_commit_id()
# do not append commit_id if we are building sdist wheels for release
if commit_id and "sdist" not in sys.argv:
version += "+" + commit_id
return version
setup(
name='depyf',
version=get_version(),
description='Decompile python functions, from bytecode to source code!',
long_description=open("README.md", "r").read(),
long_description_content_type="text/markdown",
url='https://github.com/thuml/depyf',
author='Kaichao You',
author_email="[email protected]",
license="MIT",
include_package_data=True, # This line is important!
packages=find_packages(),
python_requires=">=3.7",
install_requires=[
"astor",
"dill", # used for serializing code object. PyTorch bytecode is not serializable by marshal. Check https://github.com/pytorch/pytorch/issues/116013 for details.
# "filelock", # filelock is required by torch. If you use torch, you should have filelock.
],
extras_require={
"dev": [
"pytest",
"flake8",
"autopep8",
]
}
)