Skip to content

Commit

Permalink
Fix Makefile
Browse files Browse the repository at this point in the history
- remove cleaning build files, `pip install -e` should be used
- `pip install -e` doesn't work with multiple files, use a for loop to
  install the submodules
  • Loading branch information
thodkatz committed Sep 10, 2024
1 parent 5e75d22 commit a0d5695
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 32 deletions.
30 changes: 13 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
checkout_code:
docker:
- image: condaforge/mambaforge
- image: condaforge/miniforge3
working_directory: ~/repo
steps:
- checkout
Expand All @@ -18,41 +18,37 @@ jobs:
TIKTORCH_ENV_NAME: tiktorch-server-env
TIKTORCH_ENV_PREFIX: /opt/conda/envs/tiktorch-server-env
docker:
- image: condaforge/mambaforge
- image: condaforge/miniforge3
working_directory: ~/repo
steps:
- restore_cache:
keys:
- v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- v11-dependencies-{{ checksum "environment.yml" }}

- v11-dependencies-{{ .Environment.CIRCLE_SHA1 }}
- run: conda config --set channel_priority strict
- run: mamba update -n base -c conda-forge --update-all
- run: mamba install -c conda-forge conda-build make boa
- run: conda update -n base -c conda-forge --update-all
- run: conda install -c conda-forge conda-build make boa
- run: |
if [ ! -d ${TIKTORCH_ENV_PREFIX} ]; then
echo "Creating new environment ${TIKTORCH_ENV_NAME}"
make devenv
fi
- save_cache:
paths:
- /opt/conda/envs
key: v11-dependencies-{{ checksum "environment.yml" }}
key: v11-dependencies-{{ .Environment.CIRCLE_SHA1 }}

pre_commit_check:
docker:
- image: condaforge/mambaforge
- image: condaforge/miniforge3
working_directory: ~/repo
steps:
- restore_cache:
keys:
- v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- v11-dependencies-{{ checksum "environment.yml" }}
- v11-dependencies-{{ .Environment.CIRCLE_SHA1 }}

- run:
name: run pre-commit
Expand All @@ -63,15 +59,15 @@ jobs:
tests:
docker:
- image: condaforge/mambaforge
- image: condaforge/miniforge3
working_directory: ~/repo
steps:
- restore_cache:
keys:
- v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- v11-dependencies-{{ checksum "environment.yml" }}
- v11-dependencies-{{ .Environment.CIRCLE_SHA1 }}

- run:
name: run tests
Expand All @@ -83,15 +79,15 @@ jobs:
build_conda_packages:
docker:
- image: condaforge/mambaforge
- image: condaforge/miniforge3
working_directory: ~/repo
steps:
- restore_cache:
keys:
- v1-repo-{{ .Environment.CIRCLE_SHA1 }}

- run: mamba config --set channel_priority strict
- run: mamba install -c conda-forge conda-build anaconda-client boa
- run: conda config --set channel_priority strict
- run: conda install -c conda-forge conda-build anaconda-client boa
- run:
name: build packages
command: |
Expand Down
24 changes: 9 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
SHELL=/bin/bash
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
TIKTORCH_ENV_NAME ?= tiktorch-server-env

sample_model:
cd tests/data/dummy && zip -r $(ROOT_DIR)/dummy.tmodel ./*

unet2d:
cd tests/data/unet2d && zip -r $(ROOT_DIR)/unet2d.tmodel ./*

unet2d_onnx:
cd tests/data/unet2d_onnx && zip -r $(ROOT_DIR)/onnx.tmodel ./*

dummy_tf:
cd tests/data/dummy_tensorflow && zip -r $(ROOT_DIR)/dummy_tf.tmodel ./*
SUBMODULES = ./vendor/core-bioimage-io-python ./vendor/spec-bioimage-io

protos:
python -m grpc_tools.protoc -I./proto --python_out=tiktorch/proto/ --grpc_python_out=tiktorch/proto/ ./proto/*.proto
Expand All @@ -21,18 +10,23 @@ protos:
version:
python -c "import sys; print(sys.version)"


devenv:
. $$(conda info --base)/etc/profile.d/conda.sh
mamba env create --file environment.yml --name $(TIKTORCH_ENV_NAME)
conda run -n $(TIKTORCH_ENV_NAME) pip install . ./vendor/core-bioimage-io-python ./vendor/spec-bioimage-io
make install_submodules

run_server:
. $$(conda info --base)/etc/profile.d/conda.sh; conda activate $(TIKTORCH_ENV_NAME); python -m tiktorch.server

install_submodules:
@echo "Installing submodules $(SUBMODULES)"
@for package in $(SUBMODULES) ; do \
echo $$package ; \
conda run -n $(TIKTORCH_ENV_NAME) pip install -e $$package ; \
done

remove_devenv:
conda env remove --yes --name $(TIKTORCH_ENV_NAME)


.PHONY: protos version sample_model devenv remove_devenv dummy_tf
.PHONY: *

0 comments on commit a0d5695

Please sign in to comment.