Skip to content

Commit

Permalink
111 - Install from pip requirements and disable python 3.8 (#112)
Browse files Browse the repository at this point in the history
* pip requirements and disable python 3.8
* EDM 4.0.  
* setup-edm-action v4
  • Loading branch information
EdwinWiseOne authored Nov 20, 2024
1 parent b36bfe5 commit 3ce8641
Show file tree
Hide file tree
Showing 28 changed files with 116 additions and 85 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

env:
SHELL: /bin/bash
INSTALLED_EDM_VERSION: "3.7.0"
INSTALLED_EDM_VERSION: "4.0.0"
EDM_API_TOKEN: ${{ secrets.HATCHER_TOKEN }}

strategy:
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
fetch-depth: 0

- name: Set up EDM
uses: enthought/setup-edm-action@v2
uses: enthought/setup-edm-action@v4
with:
edm-version: ${{ env.INSTALLED_EDM_VERSION }}

Expand Down
4 changes: 2 additions & 2 deletions Kubernetes/devspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ hooks:
command: |-
$!(
if ! [ -f ./src/app_environment.zbundle ] || [ $(get_flag "rebuild-zbundle") == "true" ]; then
echo 'edm bundle generate -i --version 3.8 --platform rh7-x86_64 -m 2.0 -f ./src/app_environment.zbundle ${EDM_APP_DEPENDENCIES}'
echo 'edm bundle generate -i --version 3.11 --platform rh8-x86_64 -m 2.0 -f ./src/app_environment.zbundle ${EDM_APP_DEPENDENCIES}'
else
echo ''
fi
Expand Down Expand Up @@ -77,7 +77,7 @@ commands:
cd deploy/terraform/deployments/devspace
terraform init
create-edm-devenv: |-
edm env create ${DEVSPACE_NAME} --version 3.8
edm env create ${DEVSPACE_NAME} --version 3.11 --platform rh8-x86_64
edm install -e ${DEVSPACE_NAME} -y ${EDM_APP_DEPENDENCIES}
functions:
Expand Down
7 changes: 5 additions & 2 deletions Minimal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

ARG BASE_IMAGE=quay.io/enthought/edm-rockylinux-8:latest

FROM $BASE_IMAGE as stage_one
FROM $BASE_IMAGE AS stage_one

ARG EDGE_BUNDLE=app_environment.zbundle
COPY $EDGE_BUNDLE /tmp/app_environment.zbundle
Expand All @@ -32,10 +32,13 @@ WORKDIR /home/app
# Create a default EDM environment using the enthought_edge bundle
RUN edm env import -f /tmp/app_environment.zbundle edm && edm cache purge --yes

# Add any 'pip' packages to the application environment
COPY requirements.txt /tmp/requirements.txt
RUN edm run -- python -m pip install -r /tmp/requirements.txt --no-cache-dir

# Second stage

FROM $BASE_IMAGE as stage_two
FROM $BASE_IMAGE AS stage_two

LABEL source="https://github.com/enthought/edge-examples/blob/main/Minimal/Dockerfile"

Expand Down
11 changes: 7 additions & 4 deletions Minimal/app_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ env_deps:
pip:
- questionary
app_deps:
- flask
- setuptools
- gunicorn
- enthought_edge
edm:
- flask
- pip
- setuptools
- gunicorn
- enthought_edge
pip: []
cmd_deps:
- docker
exclude:
Expand Down
3 changes: 2 additions & 1 deletion Minimal/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def bootstrap(ci_mode):

if ENV_NAME not in _list_edm_envs():
print(f"Creating development environment '{ENV_NAME}'...")
cmd = ["edm", "envs", "create", ENV_NAME, "--version", "3.8", "--force"]
cmd = ["edm", "envs", "create", ENV_NAME, "--version", "3.11",
"--platform", "rh8-x86_64", "--force"]
subprocess.run(cmd, check=True)

cmd = ["edm", "install", "-e", ENV_NAME, "-y"] + EDM_DEPS
Expand Down
7 changes: 3 additions & 4 deletions Minimal/ci/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@ def build(config, bundle_image, rebuild_zbundle, verbose):
# Configuration details
bundle_image = bundle_image or _bundle_image(config)
version = config["app_version"]
app_deps = config["app_deps"]
app_deps = config["app_deps"]["edm"]
python_version = str(config["python_version"])
if python_version == "3.8":
platform = "rh7-x86_64"
else:
platform = "rh8-x86_64"
raise RuntimeError("Python 3.8 is not supported")
platform = "rh8-x86_64"

# First, we build a "zbundle" which contains all the eggs needed to
# build the environment within the Docker image.
Expand Down
1 change: 1 addition & 0 deletions Minimal/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# No pip requirements
3 changes: 3 additions & 0 deletions Panel/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ WORKDIR /home/app
# Create a default EDM environment using the enthought_edge bundle
RUN edm env import -f /tmp/app_environment.zbundle edm && edm cache purge --yes

# Add any 'pip' packages to the application environment
COPY requirements.txt /tmp/requirements.txt
RUN edm run -- python -m pip install -r /tmp/requirements.txt --no-cache-dir

# Second stage

Expand Down
24 changes: 13 additions & 11 deletions Panel/app_config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
app_id: edge-panel-example
framework: panel
app_version: 1.3.0
python_version: 3.8
python_version: 3.11
repository: quay.io
organisation: enthought
env_deps:
Expand All @@ -18,16 +18,18 @@ env_deps:
pip:
- questionary
app_deps:
- enthought_edge>=2.16.0
- packaging
- pip
- pyparsing
- setuptools
- six
- panel
- numpy
- pandas
- matplotlib
edm:
- enthought_edge>=2.16.0
- packaging
- pip
- pyparsing
- setuptools
- six
- numpy
- pandas
- matplotlib
pip:
- panel
cmd_deps:
- docker
exclude:
Expand Down
3 changes: 2 additions & 1 deletion Panel/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def bootstrap(ci_mode):

if ENV_NAME not in _list_edm_envs():
print(f"Creating development environment '{ENV_NAME}'...")
cmd = ["edm", "envs", "create", ENV_NAME, "--version", "3.8", "--force"]
cmd = ["edm", "envs", "create", ENV_NAME, "--version", "3.11",
"--platform", "rh8-x86_64", "--force"]
subprocess.run(cmd, check=True)

cmd = ["edm", "install", "-e", ENV_NAME, "-y"] + EDM_DEPS
Expand Down
7 changes: 3 additions & 4 deletions Panel/ci/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@ def build(config, bundle_image, rebuild_zbundle, verbose):
# Configuration details
bundle_image = bundle_image or _bundle_image(config)
version = config["app_version"]
app_deps = config["app_deps"]
app_deps = config["app_deps"]["edm"]
python_version = str(config["python_version"])
if python_version == "3.8":
platform = "rh7-x86_64"
else:
platform = "rh8-x86_64"
raise RuntimeError("Python 3.8 is not supported")
platform = "rh8-x86_64"

# First, we build a "zbundle" which contains all the eggs needed to
# build the environment within the Docker image.
Expand Down
1 change: 1 addition & 0 deletions Panel/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
panel
6 changes: 3 additions & 3 deletions Plotly Dash/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ WORKDIR /home/app
# Create a default EDM environment using the enthought_edge bundle
RUN edm env import -f /tmp/app_environment.zbundle edm && edm cache purge --yes

# Install any 'pip' dependencies
RUN edm run -- pip install --no-cache-dir Flask-Session

# Add any 'pip' packages to the application environment
COPY requirements.txt /tmp/requirements.txt
RUN edm run -- python -m pip install -r /tmp/requirements.txt --no-cache-dir

# Second stage

Expand Down
27 changes: 15 additions & 12 deletions Plotly Dash/app_config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
app_id: edge-plotly-dash-example
framework: plotly-dash
app_version: 1.3.0
python_version: 3.8
python_version: 3.11
repository: quay.io
organisation: enthought
env_deps:
Expand All @@ -18,17 +18,20 @@ env_deps:
pip:
- questionary
app_deps:
- enthought_edge>=2.16.0
- packaging
- pip
- pyparsing
- setuptools
- six
- requests
- gunicorn
- pandas
- flask>2
- dash
edm:
- enthought_edge>=2.16.0
- packaging
- pip
- pyparsing
- setuptools
- six
- requests
- gunicorn
- pandas
- flask>2
pip:
- dash
- Flask-Session
cmd_deps:
- docker
exclude:
Expand Down
3 changes: 2 additions & 1 deletion Plotly Dash/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def bootstrap(ci_mode):

if ENV_NAME not in _list_edm_envs():
print(f"Creating development environment '{ENV_NAME}'...")
cmd = ["edm", "envs", "create", ENV_NAME, "--version", "3.8", "--force"]
cmd = ["edm", "envs", "create", ENV_NAME, "--version", "3.11",
"--platform", "rh8-x86_64", "--force"]
subprocess.run(cmd, check=True)

cmd = ["edm", "install", "-e", ENV_NAME, "-y"] + EDM_DEPS
Expand Down
7 changes: 3 additions & 4 deletions Plotly Dash/ci/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@ def build(config, bundle_image, rebuild_zbundle, verbose):
# Configuration details
bundle_image = bundle_image or _bundle_image(config)
version = config["app_version"]
app_deps = config["app_deps"]
app_deps = config["app_deps"]["edm"]
python_version = str(config["python_version"])
if python_version == "3.8":
platform = "rh7-x86_64"
else:
platform = "rh8-x86_64"
raise RuntimeError("Python 3.8 is not supported")
platform = "rh8-x86_64"

# First, we build a "zbundle" which contains all the eggs needed to
# build the environment within the Docker image.
Expand Down
2 changes: 2 additions & 0 deletions Plotly Dash/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dash
Flask-Session
6 changes: 3 additions & 3 deletions React/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ WORKDIR /home/app
# Create a default EDM environment using the enthought_edge bundle
RUN edm env import -f /tmp/app_environment.zbundle edm && edm cache purge --yes

# Install any 'pip' dependencies
RUN edm run -- pip install --no-cache-dir Flask-Session

# Add any 'pip' packages to the application environment
COPY requirements.txt /tmp/requirements.txt
RUN edm run -- python -m pip install -r /tmp/requirements.txt --no-cache-dir

# Second stage

Expand Down
23 changes: 13 additions & 10 deletions React/app_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ env_deps:
pip:
- questionary
app_deps:
- enthought_edge>=2.16.0
- packaging
- pip
- pyparsing
- setuptools
- six
- click
- flask>2
- gunicorn
- opencv_python
edm:
- enthought_edge>=2.16.0
- packaging
- pip
- pyparsing
- setuptools
- six
- click
- flask>2
- gunicorn
- opencv_python
pip:
- Flask-Session
cmd_deps:
- docker
exclude:
Expand Down
3 changes: 2 additions & 1 deletion React/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def bootstrap(ci_mode):

if ENV_NAME not in _list_edm_envs():
print(f"Creating development environment '{ENV_NAME}'...")
cmd = ["edm", "envs", "create", ENV_NAME, "--version", "3.8", "--force"]
cmd = ["edm", "envs", "create", ENV_NAME, "--version", "3.11",
"--platform", "rh8-x86_64", "--force"]
subprocess.run(cmd, check=True)

cmd = ["edm", "install", "-e", ENV_NAME, "-y"] + EDM_DEPS
Expand Down
7 changes: 3 additions & 4 deletions React/ci/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@ def build(config, bundle_image, rebuild_zbundle, verbose):
# Configuration details
bundle_image = bundle_image or _bundle_image(config)
version = config["app_version"]
app_deps = config["app_deps"]
app_deps = config["app_deps"]["edm"]
python_version = str(config["python_version"])
if python_version == "3.8":
platform = "rh7-x86_64"
else:
platform = "rh8-x86_64"
raise RuntimeError("Python 3.8 is not supported")
platform = "rh8-x86_64"

# First, build the React application
jsdir = op.join(SRC_ROOT, "src", "application", "frontend")
Expand Down
1 change: 1 addition & 0 deletions React/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Flask-Session
6 changes: 3 additions & 3 deletions Streamlit/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ WORKDIR /home/app
# Create a default EDM environment using the enthought_edge bundle
RUN edm env import -f /tmp/app_environment.zbundle edm && edm cache purge --yes

# Add a few 'pip' packages to the application environment
RUN edm run -- python -m pip install --no-cache-dir \
streamlit streamlit-javascript streamlit-extras
# Add any 'pip' packages to the application environment
COPY requirements.txt /tmp/requirements.txt
RUN edm run -- python -m pip install -r /tmp/requirements.txt --no-cache-dir

# Second stage

Expand Down
19 changes: 12 additions & 7 deletions Streamlit/app_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@ env_deps:
pip:
- questionary
app_deps:
- enthought_edge>=2.16.0
- packaging
- pip
- pyparsing
- setuptools
- six
- requests
edm:
- enthought_edge>=2.16.0
- packaging
- pip
- pyparsing
- setuptools
- six
- requests
pip:
- streamlit
- streamlit-javascript
- streamlit-extras
cmd_deps:
- docker
exclude:
Expand Down
3 changes: 2 additions & 1 deletion Streamlit/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def bootstrap(ci_mode):

if ENV_NAME not in _list_edm_envs():
print(f"Creating development environment '{ENV_NAME}'...")
cmd = ["edm", "envs", "create", ENV_NAME, "--version", "3.8", "--force"]
cmd = ["edm", "envs", "create", ENV_NAME, "--version", "3.11",
"--platform", "rh8-x86_64", "--force"]
subprocess.run(cmd, check=True)

cmd = ["edm", "install", "-e", ENV_NAME, "-y"] + EDM_DEPS
Expand Down
Loading

0 comments on commit 3ce8641

Please sign in to comment.