diff --git a/Makefile b/Makefile index 796c941b0..11f02eef1 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,6 @@ project_name := astrodynamics project_version := $(shell git describe --tags --always) -project_major_version := $(shell git describe --tags --always | cut -c 1) docker_registry_path := openspacecollective docker_image_repository := $(docker_registry_path)/open-space-toolkit-$(project_name) @@ -16,8 +15,7 @@ docker_release_image_jupyter_repository := $(docker_image_repository)-jupyter jupyter_notebook_port := 9005 jupyter_notebook_image_repository := jupyter/scipy-notebook:x86_64-python-3.11.3 jupyter_python_version := 3.11 - -project_name_camel_case := $(shell echo $(project_name) | sed -r 's/(^|-)([a-z])/\U\2/g') +extract_python_package_version := $(shell echo $(project_version) | sed 's/-/./' | sed 's/-.*//') pull: ## Pull all images @@ -254,7 +252,7 @@ start-development-link: build-development-image ## Start linked development envi .PHONY: start-development-link -ifndef link +ifndef links start-development dev: start-development-no-link else start-development dev: start-development-link @@ -273,7 +271,7 @@ start-python: build-release-image-python ## Start Python runtime environment .PHONY: start-python -start-jupyter-notebook: build-release-image-jupyter ## Start Jupyter Notebook environment +start-jupyter: build-release-image-jupyter ## Start Jupyter Notebook environment @ echo "Starting Jupyter Notebook environment..." @@ -289,7 +287,27 @@ start-jupyter-notebook: build-release-image-jupyter ## Start Jupyter Notebook en .PHONY: start-jupyter-notebook -debug-jupyter-notebook: build-release-image-jupyter ## Debug jupyter notebook using the ostk-astro package built from current source code, must have run make start-development and ostk-build and ostk-install-python to use this +debug-jupyter: build-development-image ## Debug jupyter notebook using the ostk-astro package built from current source code + + @ echo "Building Python$(jupyter_python_version) packages..." + + docker run \ + -it \ + --rm \ + --volume="$(CURDIR):/app:delegated" \ + --workdir=/app/build \ + $(docker_development_image_repository):$(docker_image_version) \ + /bin/bash -c "cmake -DBUILD_UNIT_TESTS=OFF -DBUILD_BENCHMARK=OFF -DBUILD_PYTHON_BINDINGS=ON -DPYTHON_SEARCH_VERSIONS="$(jupyter_python_version)" .. \ + && $(MAKE) -j $(shell nproc) \ + && mkdir -p /app/packages/python \ + && rm -rf /app/packages/python/* \ + && cp /app/build/bindings/python/dist/*$(extract_python_package_version)*.whl /app/packages/python" + + @ $(MAKE) debug-jupyter-standalone + +.PHONY: debug-jupyter + +debug-jupyter-rebuild: build-release-image-jupyter ## Debug jupyter notebook using the ostk-astro package built from current source code @ echo "Debugging Jupyter Notebook environment..." @@ -298,17 +316,16 @@ debug-jupyter-notebook: build-release-image-jupyter ## Debug jupyter notebook us --rm \ --user=root \ --publish="$(jupyter_notebook_port):8888" \ - --volume="$(CURDIR)/bindings/python/docs:/home/jovyan/docs" \ - --volume="$(CURDIR)/tutorials/python/notebooks:/home/jovyan/tutorials" \ - --volume="$(CURDIR)/build/bindings/python/OpenSpaceToolkit${project_name_camel_case}Py-python-package-$(jupyter_python_version):/opt/conda/lib/python$(jupyter_python_version)/site-packages/ostk/$(project_name)" \ + --volume="$(CURDIR)/bindings/python/docs:/home/jovyan/docs:delegated" \ + --volume="$(CURDIR)/tutorials/python/notebooks:/home/jovyan/tutorials:delegated" \ + --volume="$(CURDIR)/packages/python:/home/jovyan/.packages:delegated" \ --workdir="/home/jovyan" \ $(docker_release_image_jupyter_repository):$(docker_image_version) \ - bash -c "chown -R jovyan:users /home/jovyan ; python$(jupyter_python_version) -m pip install /opt/conda/lib/python$(jupyter_python_version)/site-packages/ostk/$(project_name)/ --force-reinstall ; start-notebook.sh --ServerApp.token=''" + bash -c "chown -R jovyan:users /home/jovyan ; python$(jupyter_python_version) -m pip install /home/jovyan/.packages/*.whl --force-reinstall ; start-notebook.sh --ServerApp.token=''" - bash -c "sudo chown -R $(shell id -u):$(shell id -g) $(CURDIR)/bindings/python/docs" - bash -c "sudo chown -R $(shell id -u):$(shell id -g) $(CURDIR)/tutorials/python/notebooks" + @ sudo chown -R $(shell id -u):$(shell id -g) $(CURDIR) -.PHONY: debug-jupyter-notebook +.PHONY: debug-jupyter-rebuild debug-development: build-development-image ## Debug development environment @@ -556,12 +573,11 @@ clean: ## Clean @ echo "Cleaning up..." rm -rf "$(CURDIR)/build" - rm -rf "$(CURDIR)/bin/"*.test* + rm -rf "$(CURDIR)/bin" rm -rf "$(CURDIR)/docs/html" rm -rf "$(CURDIR)/docs/latex" - rm -rf "$(CURDIR)/lib/"*.so* + rm -rf "$(CURDIR)/lib" rm -rf "$(CURDIR)/coverage" - rm -rf "$(CURDIR)/benchmark" rm -rf "$(CURDIR)/packages" rm -rf "$(CURDIR)/.open-space-toolkit"