Skip to content

Commit cc31533

Browse files
authored
Merge pull request #24 from IITH-Compilers/pip-package
Pip package
2 parents 51b10a2 + 6199526 commit cc31533

File tree

15 files changed

+159
-20
lines changed

15 files changed

+159
-20
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
run: |
4646
conda init
4747
conda activate mlbridge
48+
pip install compilerinterface
4849
cd $GITHUB_WORKSPACE/test
4950
bash mlbridge-test.sh
5051
- uses: actions/upload-artifact@v2

.github/workflows/upload_pypi.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Upload to PyPI
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
workflow_dispatch:
8+
inputs:
9+
pypi_repo:
10+
description: 'Repo to upload to pypi'
11+
default: 'pypi'
12+
required: true
13+
type: choice
14+
options:
15+
- testpypi
16+
- pypi
17+
18+
jobs:
19+
build_wheels:
20+
uses: ./.github/workflows/wheel.yml
21+
22+
upload_pypi:
23+
permissions:
24+
id-token: write
25+
needs: [build_wheels]
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/download-artifact@v3
29+
with:
30+
name: artifact
31+
path: ./CompilerInterface/dist
32+
33+
# - name: Publish package to TestPyPI
34+
# uses: pypa/[email protected]
35+
# with:
36+
# repository-url: https://test.pypi.org/legacy/
37+
# packages-dir: ./CompilerInterface/dist
38+
# if: ${{ github.event.inputs.pypi_repo != 'pypi' }}
39+
40+
- name: Publish package to PyPI
41+
uses: pypa/[email protected]
42+
with:
43+
repository-url: https://upload.pypi.org/legacy/
44+
packages-dir: ./CompilerInterface/dist
45+
# if: ${{ github.event.inputs.pypi_repo == 'pypi' }}

.github/workflows/wheel.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Build wheels
2+
3+
on: [push, workflow_dispatch, workflow_call]
4+
5+
jobs:
6+
build_wheels:
7+
name: Build wheels on ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os: [ubuntu-20.04]
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Build wheels
17+
run: |
18+
cd $GITHUB_WORKSPACE/CompilerInterface
19+
python fetch_version.py
20+
cp ../README.md ./
21+
pip wheel . -w ./dist
22+
pip install dist/compilerinterface*.whl
23+
24+
- uses: actions/upload-artifact@v3
25+
with:
26+
name: artifact
27+
path: ./CompilerInterface/dist

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.10)
22

3-
project(MLCompilerBridge VERSION 0.0.1)
3+
project(MLCompilerBridge VERSION 0.0.2)
44
add_compile_options("$<$<CONFIG:${CMAKE_BUILD_TYPE}>:-UNDEBUG>")
55
set(protobuf_MODULE_COMPATIBLE TRUE)
66
find_package(Protobuf CONFIG REQUIRED)

CompilerInterface/BaseCompilerInterface.py renamed to CompilerInterface/compilerinterface/BaseCompilerInterface.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515

1616

1717
from abc import ABC, abstractmethod
18-
from SerDes import SerDes
19-
import os
20-
import io
18+
from .SerDes import SerDes
2119

2220
## This base class specifies methods for communication with compiler.
2321
class BaseCompilerInterface(ABC):

CompilerInterface/GrpcCompilerInterface.py renamed to CompilerInterface/compilerinterface/GrpcCompilerInterface.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,9 @@
1313
# ------------------------------------------------------------------------------
1414

1515

16-
from abc import ABC, abstractmethod
17-
from BaseCompilerInterface import BaseCompilerInterface
18-
import os
19-
import io
16+
from .BaseCompilerInterface import BaseCompilerInterface
2017
import time
2118

22-
import sys
2319
import grpc
2420
from concurrent import futures
2521

@@ -91,7 +87,7 @@ def start_server(self):
9187
"{}:{}".format(self.host, self.server_port)
9288
)
9389

94-
if added_port == self.server_port:
90+
if str(added_port) == str(self.server_port):
9591
server.start()
9692
print("Server Running")
9793
server.wait_for_termination()

CompilerInterface/PipeCompilerInterface.py renamed to CompilerInterface/compilerinterface/PipeCompilerInterface.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
##
1313
# ------------------------------------------------------------------------------
1414

15-
from abc import ABC, abstractmethod
16-
from BaseCompilerInterface import BaseCompilerInterface
15+
from .BaseCompilerInterface import BaseCompilerInterface
1716
import os
1817
import io
1918

CompilerInterface/SerDes.py renamed to CompilerInterface/compilerinterface/SerDes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
##
1212
# ------------------------------------------------------------------------------
1313

14-
import os, io
1514
import json
16-
import log_reader
15+
from . import log_reader
1716
import ctypes
1817
import struct
1918

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# ------------------------------------------------------------------------------
2+
#
3+
# Part of the MLCompilerBridge Project, under the Apache License v2.0 with LLVM
4+
# Exceptions. See the LICENSE file for license information.
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
#
7+
# ------------------------------------------------------------------------------
8+
9+
from .BaseCompilerInterface import BaseCompilerInterface
10+
from .PipeCompilerInterface import PipeCompilerInterface
11+
from .GrpcCompilerInterface import GrpcCompilerInterface
12+
from .SerDes import SerDes

CompilerInterface/log_reader.py renamed to CompilerInterface/compilerinterface/log_reader.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@
1515
import dataclasses
1616
import io
1717
import json
18-
import math
1918
import sys
2019
from typing import List, Optional
2120
from functools import reduce
2221
import operator
23-
import numpy
2422

2523
_element_types = {
2624
"float": ctypes.c_float,

0 commit comments

Comments
 (0)