You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/contributing/app-dev.md
+51-10Lines changed: 51 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,19 +12,27 @@
12
12
13
13
The application is built with [Streamlit](https://www.streamlit.io/), Streamlit requires:
14
14
15
-
- Python 2.7.0 or later / Python 3.6.x or later
15
+
- Python 3.6.x or later
16
16
- PIP
17
17
18
18
See [Streamlit's Getting Started guide](https://docs.streamlit.io/getting_started.html) for detailed information on prerequisites and setup
19
19
20
20
## Running CHIME Locally
21
21
22
+
23
+
### With `venv`
24
+
25
+
```bash
26
+
python3 -m venv ~.venv
27
+
.~.venv/bin/activate
28
+
pip install -e .
29
+
```
30
+
22
31
### With `pipenv`
23
32
24
33
```bash
25
34
pipenv shell
26
35
pipenv sync --dev
27
-
PARAMETERS=defaults/webapp.cfg streamlit run src/app.py
28
36
```
29
37
30
38
### With `conda`
@@ -33,32 +41,60 @@ PARAMETERS=defaults/webapp.cfg streamlit run src/app.py
33
41
conda env create -f environment.yml
34
42
source activate chime
35
43
pip install streamlit
36
-
PARAMETERS=defaults/webapp.cfg streamlit run src/app.py
37
44
```
38
45
46
+
## Run the Streamlit Web App
47
+
48
+
```bash
49
+
PARAMETERS=-./defaults/webapp.cfg streamlit run st_app.py
50
+
```
51
+
52
+
## Run the Command Line Interface
53
+
54
+
```bash
55
+
PARAMETERS=./defaults/cli.cfg penn_chime
56
+
```
57
+
58
+
## Help with the Command Line Interface
59
+
60
+
```bash
61
+
penn_chime --help
62
+
```
63
+
64
+
### Choosing a Different Set of Parameters
65
+
66
+
If you want a different set of default parameters, you may use your own configuration file.
67
+
68
+
```bash
69
+
PARAMETERS=./defaults/yours.cfg streamlit run st_app.py
70
+
```
71
+
72
+
Be sure to include `--current-date` in the file, if your `--current-hospitalized` is not today's value.
73
+
Be sure to include `--mitigation-date` in the file if social distancing was implemented before today.
74
+
39
75
### Choosing a Different Port
40
76
41
-
If you need to run the application on a different port than the default (8000), you can export a variable in your shell session to override it with any port number of your choice before running:
77
+
If you need to run the application on a different port than the default (8000), you can set an environment variable.
42
78
43
79
```bash
44
-
STREAMLIT_SERVER_PORT=1234 PARAMETERS=defaults/webapp.cfg streamlit run src/app.py
80
+
STREAMLIT_SERVER_PORT=1234 PARAMETERS=./defaults/webapp.cfg streamlit run st_app.py
45
81
```
46
82
47
83
## Project Layout
48
84
49
85
### Application files
50
86
51
-
-`src/app.py`: Main source for the application
52
-
-`src/test_app.py`: [pytest](https://docs.pytest.org/en/latest/) tests for `app.py`
87
+
-`st_app.py`: Startup script for the streamlit web application.
88
+
-`src`: Source code for the `penn_chime` module.
89
+
-`tests/`: [pytest](https://docs.pytest.org/en/latest/) tests for the `penn_chime` module.
53
90
-`script/`: Developer workflow scripts following [GitHub's Scripts To Rule Them All](https://github.com/github/scripts-to-rule-them-all) pattern.
-`.env`: Local environment variables to use when running application, this file is copied from `.env.example` to start you out and then ignored by git
56
-
-`pytest.ini`: Configuration for [pytest](https://docs.pytest.org/en/latest/)
93
+
-`environment.yml`
57
94
-`Pipfile`
58
95
-`Pipfile.lock`
59
-
-`environment.yml`
60
-
-`requirements.txt`
61
96
-`setup.py`
97
+
-`setup.cfg`: Configuration for flake8, mypy, [pytest](https://docs.pytest.org/en/latest/)
62
98
63
99
### Documentation
64
100
@@ -85,6 +121,11 @@ pip install pytest
85
121
pytest
86
122
```
87
123
124
+
The test code runs from the local `tests` directory. Updating code in `tests` modifies the tests.
125
+
Use `pip install -e .` so that your local changes to `src` are also the module under test.
126
+
For CI, use `pip install .` to test the module installed in site-packages to ensure that the installed module is packaged correctly with all of its dependencies.
127
+
Do not import from src in your tests or your python code as this will appear to work locally, but break the python module.
128
+
88
129
## Validating CHIME
89
130
90
131
*No validation routine is available yet. If you have thoughts on how to add one, please contribute!*
0 commit comments