Skip to content

Commit

Permalink
Improve build process
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Giannuzzi <jonathan@giannuzzi.me>
  • Loading branch information
jgiannuzzi committed Oct 1, 2024
1 parent 4f98214 commit 66bd06b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pip install -e .mlflow.repo

# Build the Go binary and run the tests
libpath=$(mktemp -d)
python -m mlflow_go.lib pkg/lib $libpath
python -m mlflow_go.lib . $libpath
MLFLOW_GO_LIBRARY_PATH=$libpath pytest --confcutdir=. .mlflow.repo/tests/tracking/test_rest_tracking.py .mlflow.repo/tests/tracking/test_model_registry.py
rm -rf $libpath
```
Expand Down
10 changes: 5 additions & 5 deletions mlflow_go/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def build_lib(src_dir: pathlib.Path, out_dir: pathlib.Path) -> pathlib.Path:
out_path.resolve().as_posix(),
"-buildmode",
"c-shared",
src_dir.resolve().as_posix(),
src_dir.joinpath("pkg", "lib").resolve().as_posix(),
],
cwd=src_dir.resolve().as_posix(),
env=env,
Expand Down Expand Up @@ -94,7 +94,7 @@ def _get_lib():

# build the library and load it
path = build_lib(
pathlib.Path(__file__).parent.parent.joinpath("pkg", "lib"), pathlib.Path(tmpdir.name)
pathlib.Path(__file__).parent.parent, pathlib.Path(tmpdir.name)
)
return ffi.dlopen(path.as_posix())

Expand All @@ -112,9 +112,9 @@ def get_lib():
if __name__ == "__main__":
import argparse

parser = argparse.ArgumentParser()
parser.add_argument("src")
parser.add_argument("out")
parser = argparse.ArgumentParser("build_lib", description='Build Go library')
parser.add_argument("src", help="the Go source directory")
parser.add_argument("out", help="the output directory")
args = parser.parse_args()

build_lib(pathlib.Path(args.src), pathlib.Path(args.out))
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def run(self) -> None:
if not self.editable_mode:
_prune_go_files(self.build_lib)
build_lib(
pathlib.Path("pkg", "lib"),
pathlib.Path("."),
pathlib.Path(self.build_lib).joinpath("mlflow_go"),
)

Expand Down

0 comments on commit 66bd06b

Please sign in to comment.