Skip to content

Commit

Permalink
Split requirements.txt to a separate file
Browse files Browse the repository at this point in the history
Use gunicorn and plotly_express from requirements.txt
Add requirements.txt to docker first and install to optimize docker cache hits
Add MANIFEST.in for package packaging that include the README and the requirements.txt when packaging and also any non-python files that are part of covasim(html,. R, spreadsheets, etc)
  • Loading branch information
devclinton committed Mar 17, 2020
1 parent 22e0c01 commit 16c3544
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 14 deletions.
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ FROM continuumio/anaconda3:latest
ENV PATH="/opt/conda/bin:${PATH}"

RUN apt-get -y update && apt-get install -y nginx supervisor
RUN conda install twisted python-Levenshtein gunicorn
RUN python3 -m pip install plotly_express
RUN mkdir /app && \
conda install twisted python-Levenshtein

# Add requiremments.txt first and install to maximize chances of hitting docker cache
ADD requirements.txt /app
RUN python3 -m pip install -r /app/requirements.txt

ADD . /app
WORKDIR /app

Expand Down
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include requirements.txt
include README.md
recursive-include covasim/*
10 changes: 10 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
matplotlib>=2.2.2
numpy>=1.10.1
scipy>=1.2.0
sciris>=0.15.8
scirisweb>=0.15.0
pandas
numba
gunicorn
plotly_express
#parestlib>=0.3
22 changes: 10 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
import runpy
from setuptools import setup, find_packages

# Load requirements from txt file
with open('requirements.txt') as requirements_file:
# ensure EOLs are '\n' in case on windows and splits
requirements = []
for line in requirements_file.read().replace('\r\n', '\n').split('\n'):
if line and line[0] != '#':
requirements.append(line)


# Get version
cwd = os.path.abspath(os.path.dirname(__file__))
versionpath = os.path.join(cwd, 'covasim', 'cova_base', 'version.py')
Expand Down Expand Up @@ -29,16 +38,5 @@
classifiers=CLASSIFIERS,
packages=find_packages(),
include_package_data=True,
install_requires=[
"matplotlib>=2.2.2",
"numpy>=1.10.1",
"scipy>=1.2.0",
"sciris>=0.15.8",
"scirisweb>=0.15.0",
"pandas",
"numba",
"gunicorn",
"plotly_express",
# "parestlib>=0.3",
],
install_requires=requirements
)

0 comments on commit 16c3544

Please sign in to comment.