forked from mlcommons/chakra
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- build and install with pip install from local source or directly from github - use pyproject.toml to describe the project attibutes and dependecies in a declarative way - install dependencies when installing the package - upgrade to protobuf 4.x - build proto file with setuptools-grpc instead of protoc; this removes the need of installing protobuf-compiler
- Loading branch information
1 parent
ae7c671
commit a10d918
Showing
7 changed files
with
60 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.egg-info/ | ||
build/ | ||
*_pb2*.py* | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
[build-system] | ||
requires = ["setuptools", "setuptools-grpc"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "chakra" | ||
requires-python = ">=3.8" | ||
version = "0.0.3" | ||
readme = "README.md" | ||
license = {file = "LICENSE.md"} | ||
authors = [ | ||
{name = "MLCommons", email = "[email protected]"}, | ||
] | ||
dependencies = ["protobuf==4.*", "graphviz", "networkx", "pydot"] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/mlcommons/chakra" | ||
Documentation = "https://github.com/mlcommons/chakra/README.md" | ||
Repository = "https://github.com/mlcommons/chakra.git" | ||
|
||
[tool.setuptools.package-dir] | ||
"chakra.et_def" = "et_def" | ||
"chakra.et_converter" = "et_converter" | ||
"chakra.et_visualizer" = "et_visualizer" | ||
"chakra.timeline_visualizer" = "timeline_visualizer" | ||
"chakra.et_generator" = "utils/et_generator" | ||
"chakra.et_jsonizer" = "utils/et_jsonizer" | ||
"chakra.third_party.utils" = "third_party/utils" | ||
|
||
[tool.setuptools.package-data] | ||
"chakra.et_def" = ["et_def_pb2.pyi", "et_def.proto"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[build_grpc] | ||
proto_files = et_def.proto | ||
grpc_files = et_def.proto | ||
proto_path = et_def | ||
output_path = et_def |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,9 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
|
||
from distutils.command.build import build | ||
from setuptools import setup | ||
|
||
def main(): | ||
package_base = "chakra" | ||
|
||
# List the packages and their dir mapping: | ||
# "install_destination_package_path": "source_dir_path" | ||
package_dir_map = { | ||
f"{package_base}": ".", | ||
f"{package_base}.third_party.utils": "third_party/utils", | ||
f"{package_base}.et_def": "et_def", | ||
f"{package_base}.et_converter": "et_converter", | ||
f"{package_base}.et_generator": "utils/et_generator", | ||
f"{package_base}.et_jsonizer": "utils/et_jsonizer", | ||
f"{package_base}.et_visualizer": "et_visualizer", | ||
f"{package_base}.timeline_visualizer": "timeline_visualizer" | ||
} | ||
|
||
packages = list(package_dir_map) | ||
|
||
os.system("protoc et_def.proto --proto_path et_def --python_out et_def") | ||
class build_grpc(build): | ||
sub_commands = [('build_grpc', None)] + build.sub_commands | ||
|
||
setup( | ||
name="chakra", | ||
python_requires=">=3.8", | ||
author="MLCommons", | ||
author_email="[email protected]", | ||
url="https://github.com/mlcommons/chakra", | ||
packages=packages, | ||
package_dir=package_dir_map | ||
) | ||
|
||
if __name__ == "__main__": | ||
main() | ||
setup(cmdclass={'build': build_grpc}) |