This repository has been archived by the owner on Nov 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsetup.py
78 lines (62 loc) · 2.07 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# -------------------------------------------------------------------------
# Copyright (c) Trainy, Inc. All rights reserved.
# --------------------------------------------------------------------------
import setuptools
import os
import pathlib
import subprocess
def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, rel_path)) as fp:
return fp.read()
def get_version(rel_path):
for line in read(rel_path).splitlines():
if line.startswith("__version__"):
delim = '"' if '"' in line else "'"
version = line.split(delim)[1]
if os.getenv("TORCH_TB_PROFILER_BUILD_VERSION"):
version = os.getenv("TORCH_TB_PROFILER_BUILD_VERSION")
return version
class build_frontend(setuptools.Command):
"""Build the frontend"""
description = "run `npm run build` on frontend directory"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
cwd = pathlib.Path().absolute()
root = pathlib.Path(__file__).parent.absolute()
os.chdir(root / "frontend")
subprocess.run(["npm", "run", "build"], check=True)
# restore the working directory
os.chdir(cwd)
INSTALL_REQUIRED = [
"HolisticTraceAnalysis",
"posthog",
"tensorboard"
]
setuptools.setup(
name="nodify_plugin",
version=get_version(os.path.join("nodify_plugin", "__init__.py")),
description="Nodify Tensorboard Plugin.",
long_description=read("./README.md"),
long_description_content_type='text/markdown',
author="Trainy Team",
author_email="[email protected]",
readme="README.md",
cmdclass={"build_frontend": build_frontend},
packages=setuptools.find_packages(),
package_data={
"nodify_plugin": ["static/**"],
},
entry_points={
"tensorboard_plugins": [
"example_basic = nodify_plugin.plugin:NodifyPlugin",
],
},
install_requires=INSTALL_REQUIRED,
license="BSD-3",
keywords="pytorch tensorboard profile plugin",
)