Skip to content

Commit

Permalink
Add virtual environment option for pipx installation
Browse files Browse the repository at this point in the history
This is relevant in remote compute cluster
environments.
  • Loading branch information
f-PLT committed May 22, 2024
1 parent 2ed9ba2 commit 97e9e9b
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions .make/base.make
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ poetry-install: ## Install standalone Poetry using pipx and create Poetry env. W
pipx --version; \
if [ $$? != "0" ]; then \
echo "pipx not found; installing pipx"; \
pip install --user pipx; \
pip install --user pipx || pip install pipx; \
pipx ensurepath; \
fi; \
echo "Installing Poetry"; \
Expand All @@ -213,6 +213,13 @@ poetry-install: ## Install standalone Poetry using pipx and create Poetry env. W
esac; \
fi;

.PHONY: poetry-install-venv
poetry-install-venv: ## Install standalone Poetry and Poetry environment. Will install pipx in $HOME/.pipx_venv
python3 -m venv $$HOME/.pipx_venv
@source $$HOME/.pipx_venv/bin/activate
@pip3 install pipx
make -s poetry-install

.PHONY: poetry-env-info
poetry-env-info: ## Information about the currently active environment used by Poetry
@poetry env info
Expand Down Expand Up @@ -286,7 +293,7 @@ poetry-uninstall: poetry-remove-env ## Uninstall pipx-installed Poetry and the c
esac; \

.PHONY: poetry-uninstall-pipx
poetry-uninstall-pipx: poetry-remove-env ## Uninstall pipx-installed Poetry, the created environment and pipx
poetry-uninstall-pipx: poetry-remove-env ## Uninstall pipx-installed Poetry, the created Poetry environment and pipx
@if [ "$(AUTO_INSTALL)" = "true" ]; then \
ans="y";\
else \
Expand All @@ -305,6 +312,28 @@ poetry-uninstall-pipx: poetry-remove-env ## Uninstall pipx-installed Poetry, the
;; \
esac; \

.PHONY: poetry-uninstall-venv
poetry-uninstall-venv: ## Uninstall pipx-installed Poetry, the created Poetry environment, pipx and $HOME/.pipx_venv
python3 -m venv $$HOME/.pipx_venv
@source $$HOME/.pipx_venv/bin/activate
make -s poetry-uninstall-pipx
@if [ "$(AUTO_INSTALL)" = "true" ]; then \
ans="y";\
else \
echo""; \
echo -n "Would you like to remove the virtual environment located here : [$$HOME/.pipx_venv] ? [y/N]: "; \
read ans; \
fi; \
case $$ans in \
[Yy]*) \
rm -r $$HOME/.pipx_venv; \
;; \
*) \
echo "Skipping [$$HOME/.pipx_venv] virtual environment removal."; \
echo ""; \
;; \
esac; \

## -- Install targets (All install targets will install Poetry if not found using `make poetry-install-auto`)-------- ##

.PHONY: install
Expand Down

0 comments on commit 97e9e9b

Please sign in to comment.