-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from IITH-Compilers/pip-package
Pip package
- Loading branch information
Showing
15 changed files
with
159 additions
and
20 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,45 @@ | ||
name: Upload to PyPI | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
workflow_dispatch: | ||
inputs: | ||
pypi_repo: | ||
description: 'Repo to upload to pypi' | ||
default: 'pypi' | ||
required: true | ||
type: choice | ||
options: | ||
- testpypi | ||
- pypi | ||
|
||
jobs: | ||
build_wheels: | ||
uses: ./.github/workflows/wheel.yml | ||
|
||
upload_pypi: | ||
permissions: | ||
id-token: write | ||
needs: [build_wheels] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: artifact | ||
path: ./CompilerInterface/dist | ||
|
||
# - name: Publish package to TestPyPI | ||
# uses: pypa/[email protected] | ||
# with: | ||
# repository-url: https://test.pypi.org/legacy/ | ||
# packages-dir: ./CompilerInterface/dist | ||
# if: ${{ github.event.inputs.pypi_repo != 'pypi' }} | ||
|
||
- name: Publish package to PyPI | ||
uses: pypa/[email protected] | ||
with: | ||
repository-url: https://upload.pypi.org/legacy/ | ||
packages-dir: ./CompilerInterface/dist | ||
# if: ${{ github.event.inputs.pypi_repo == 'pypi' }} |
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,27 @@ | ||
name: Build wheels | ||
|
||
on: [push, workflow_dispatch, workflow_call] | ||
|
||
jobs: | ||
build_wheels: | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-20.04] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Build wheels | ||
run: | | ||
cd $GITHUB_WORKSPACE/CompilerInterface | ||
python fetch_version.py | ||
cp ../README.md ./ | ||
pip wheel . -w ./dist | ||
pip install dist/compilerinterface*.whl | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: artifact | ||
path: ./CompilerInterface/dist |
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
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
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,12 @@ | ||
# ------------------------------------------------------------------------------ | ||
# | ||
# Part of the MLCompilerBridge Project, under the Apache License v2.0 with LLVM | ||
# Exceptions. See the LICENSE file for license information. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
# ------------------------------------------------------------------------------ | ||
|
||
from .BaseCompilerInterface import BaseCompilerInterface | ||
from .PipeCompilerInterface import PipeCompilerInterface | ||
from .GrpcCompilerInterface import GrpcCompilerInterface | ||
from .SerDes import SerDes |
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,33 @@ | ||
# ------------------------------------------------------------------------------ | ||
# | ||
# Part of the MLCompilerBridge Project, under the Apache License v2.0 with LLVM | ||
# Exceptions. See the LICENSE file for license information. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
# ------------------------------------------------------------------------------ | ||
|
||
import re | ||
|
||
version_regex = re.compile(r"^project\(MLCompilerBridge VERSION (?P<version>[^)]+)\)$") | ||
toml_field_regex = r'version[ ]*=[ ]*"(.*)"' | ||
|
||
VERSION = "" | ||
with open("../CMakeLists.txt", "r") as f: | ||
for line in f: | ||
vmatch = version_regex.match(line) # Not using walrus because Python3.6 | ||
if vmatch: | ||
VERSION = vmatch.group("version") | ||
break | ||
|
||
print("Version detected =", VERSION) | ||
lines = [] | ||
with open("./pyproject.toml", "r") as f: | ||
lines = f.readlines() | ||
|
||
with open("./pyproject.toml", "w") as f: | ||
for line in lines: | ||
if re.search(toml_field_regex, line): | ||
new_text = f'version = "{VERSION}"\n' | ||
f.write(new_text) | ||
else: | ||
f.write(line) |
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,29 @@ | ||
[project] | ||
name = "compilerinterface" | ||
version = "0.0.1" | ||
authors = [ {name = "The authors of \"The Next 700 ML-Enabled Compiler Optimizations\"" }] | ||
description = "Communication framework for ML-Enabled Compiler Optimizations." | ||
license = { text= "Apache License v2.0 with LLVM Exceptions"} | ||
readme = "README.md" | ||
requires-python = ">=3.7" | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: Science/Research", | ||
"Topic :: Scientific/Engineering :: Artificial Intelligence", | ||
"Topic :: Software Development :: Compilers", | ||
"Development Status :: 4 - Beta", | ||
"Operating System :: POSIX :: Linux", | ||
] | ||
|
||
[build-system] | ||
requires = [ | ||
"setuptools>=42", | ||
"wheel" | ||
] | ||
build-backend = "setuptools.build_meta" |
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,2 @@ | ||
[metadata] | ||
url = https://github.com/IITH-Compilers/ML-Compiler-Bridge/ |
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