Skip to content

Commit

Permalink
Migrate Elastic Beanstalk to Python 3.8 running on Amazon Linux 2 (#287)
Browse files Browse the repository at this point in the history
* Update requirements

* Remove references to Python 3.6

* Bump numpy patch version

* Install mysql in EB options config

* Switch mysql to mysql-server

* Switch mysql-client to mariadb-devel

* Source python before each container command

* Fix watershed import

* Replace deprecated skimage.draw.circle with disk

* Add app local variable

* Remove .py extension from WSGIPath

* Fix WSGIPath

* Revert to sqlalchemy 1.3 for compatibility with pytest-flask-sqlalchemy

* Add newline
  • Loading branch information
tddough98 committed Dec 7, 2021
1 parent 9d8cb2c commit 98d095f
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 31 deletions.
7 changes: 4 additions & 3 deletions .ebextensions/options.config
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ option_settings:
FLASK_ENV: production

aws:elasticbeanstalk:container:python:
WSGIPath: application.py
WSGIPath: application:application

aws:elasticbeanstalk:container:python:staticfiles:
/static/: deepcell_label/static/
packages:
yum:
mariadb-devel: []
6 changes: 3 additions & 3 deletions .ebextensions/pip.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
container_commands:
01_upgrade_pip:
command: "python -m pip install --upgrade pip"
command: "source /var/app/venv/*/bin/activate && python -m pip install --upgrade pip"
leader_only: true
02_upgradde_setuptools:
command: "python -m pip install --upgrade setuptools"
02_upgrade_setuptools:
command: "source /var/app/venv/*/bin/activate && python -m pip install --upgrade setuptools"
leader_only: true

files:
Expand Down
9 changes: 5 additions & 4 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Run '...'
2. Enter '....'
3. See error
Expand All @@ -23,9 +23,10 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. macOS, Ubuntu]
- Version [e.g. 22]
- Python Version [e.g. 3.6.7]

- OS: [e.g. macOS, Ubuntu]
- Version [e.g. 0.2]
- Python Version [e.g. 3.8.10]

**Additional context**
Add any other context about the problem here.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:

strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.7, 3.8]

steps:
- uses: actions/checkout@v2
Expand Down
14 changes: 7 additions & 7 deletions deepcell_label/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

import numpy as np
from matplotlib.colors import Normalize
import skimage
from skimage import filters
from skimage.morphology import flood_fill, flood
from skimage.morphology import watershed, dilation, disk, square, erosion
from skimage.draw import circle
from skimage.morphology import dilation, disk, square, erosion
from skimage.exposure import rescale_intensity
from skimage.measure import regionprops
from skimage.segmentation import morphological_chan_vese
from skimage.segmentation import watershed, morphological_chan_vese

from deepcell_label.labelmaker import LabelInfoMaker

Expand Down Expand Up @@ -182,10 +182,10 @@ def action_handle_draw(self, trace, foreground, background, brush_size):
img_replaced = np.where(img == background, foreground, img)

for loc in trace:
x_loc = loc[0]
y_loc = loc[1]
brush_area = circle(y_loc, x_loc, brush_size,
(self.project.height, self.project.width))
x = loc[0]
y = loc[1]
brush_area = skimage.draw.disk((y, x), brush_size,
shape=(self.project.height, self.project.width))
img[brush_area] = img_replaced[brush_area]

foreground_in_after = np.any(np.isin(img, foreground))
Expand Down
25 changes: 12 additions & 13 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
boto3==1.9.182
flask~=1.1.4
boto3~=1.20.20
flask~=2.0.2
flask-compress~=1.10.1
flask-cors~=3.0.10
flask-dropzone~=1.6.0
flask-monitoringdashboard~=3.1.0
flask-sqlalchemy~=2.5.0
matplotlib==3.0.3
mysqlclient~=1.4.6
numpy>=1.16.4
pillow>=7.1.0,<8.3.2
flask-monitoringdashboard~=3.1.1
flask-sqlalchemy~=2.5.1
matplotlib~=3.5.0
mysqlclient~=2.1.0
numpy~=1.21.4
pillow~=8.4.0
python-decouple~=3.1
python-dotenv~=0.19.1
python-dotenv~=0.19.2
requests~=2.26.0
scikit-image>=0.15.0,<0.17.0
sqlalchemy<1.4
# TODO: drop python 3.6 and bump this requirement
tifffile==2020.9.3
scikit-image~=0.19.0
sqlalchemy~=1.3.24
tifffile~=2021.11.2

0 comments on commit 98d095f

Please sign in to comment.