Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from conda to venv for development env #1297

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,6 @@ _site/
# jetbrains ide stuff
*.iml
.idea/

# virtual environment
.venv/
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
push-kernel-images push-enterprise-gateway push-kernel-py push-kernel-spark-py push-kernel-r push-kernel-spark-r \
push-kernel-scala push-kernel-tf-py push-kernel-tf-gpu-py push-kernel-image-puller publish helm-chart

SA?=source activate
ENV:=enterprise-gateway-dev
ENV:=.venv
SHELL:=/bin/bash
MULTIARCH_BUILD?=
TARGET_ARCH?=undefined
Expand Down Expand Up @@ -42,11 +41,11 @@ help:
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

env: ## Make a dev environment
-conda env create --file requirements.yml --name $(ENV)
-conda env config vars set PYTHONPATH=$(PWD) --name $(ENV)
-python3 -m venv $(ENV)
-$(ENV)/bin/pip install -e .

activate: ## Print instructions to activate the virtualenv (default: enterprise-gateway-dev)
@echo "Run \`$(SA) $(ENV)\` to activate the environment."
@echo "Run \`source $(ENV)/bin/activate\` to activate the environment."

clean: ## Make a clean source tree
-rm -rf dist
Expand All @@ -61,8 +60,8 @@ clean: ## Make a clean source tree
-make -C docs clean
-make -C etc clean

clean-env: ## Remove conda env
-conda env remove -n $(ENV) -y
clean-env: ## Remove virtual environment
-rm -rf $(ENV)

lint: ## Check code style
@pip install -q -e ".[lint]"
Expand Down
15 changes: 8 additions & 7 deletions docs/source/contributors/devinstall.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Enterprise Gateway's build environment is centered around `make` and the corresp
Entering `make` with no parameters yields the following:

```
activate Print instructions to activate the virtualenv (default: enterprise-gateway-dev)
clean-env Remove conda env
activate Print instructions to activate the virtualenv (default: .venv)
clean-env Remove virtual env
clean-images Remove docker images (includes kernel-based images)
clean-kernel-images Remove kernel-based images
clean Make a clean source tree
Expand All @@ -53,19 +53,20 @@ test Run unit tests

Some of the more useful commands are listed below.

## Build the conda environment
## Build the virtual environment

Build a Python 3 conda environment that can be used to run
Build a Python 3 virtual environment that can be used to run
the Enterprise Gateway server within an IDE. May be necessary prior
to [debugging Enterprise Gateway](./debug.md) based on your local Python environment.
See [Conda's Managing environments](https://docs.conda.io/projects/conda/en/stable/user-guide/tasks/manage-environments.html#managing-environments)
for background on environments and why you may find them useful as you develop on Enterprise Gateway.
See Python's [Virtual Environments](https://docs.python.org/3/tutorial/venv.html#virtual-environments-and-packages),
and [Installing Packages](https://packaging.python.org/en/latest/tutorials/installing-packages/#installing-from-a-local-src-tree)
documentation pages for background on environments and why you may find them useful as you develop on Enterprise Gateway.

```bash
make env
```

By default, the env built will be named `enterprise-gateway-dev`. To produce a different conda env,
By default, the env built will be named `.venv`. To produce a different conda env,
you can specify the name via the `ENV=` parameter.

```bash
Expand Down