Skip to content

Commit ed0434a

Browse files
authored
Merge branch 'develop' into fix_current_date
2 parents 83acfd1 + 56dd36a commit ed0434a

File tree

12 files changed

+298
-217
lines changed

12 files changed

+298
-217
lines changed

.github/workflows/pythonapp.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ on:
1515
jobs:
1616
build:
1717
runs-on: ubuntu-latest
18-
1918
steps:
2019
- uses: actions/checkout@v2
2120
- name: Set up Python 3.8
@@ -33,6 +32,11 @@ jobs:
3332
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
3433
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
3534
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
35+
- name: Check formatting with black
36+
run: |
37+
# exit if any files still need formatting
38+
bash script/format --check
39+
continue-on-error: true
3640
- name: Test with pytest
3741
run: |
3842
pip install pytest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Editors
22
.idea/
3+
.vscode/settings.json
34

45
# Environments
56
.env

Pipfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ url = "https://pypi.org/simple"
44
verify_ssl = true
55

66
[dev-packages]
7+
black = "==19.10b0"
8+
pytest = "*"
79

810
[packages]
911
streamlit = "*"
1012
pandas = "*"
1113
numpy = "*"
12-
pytest = "*"
1314
altair = "*"
1415
dash = "*"
1516
dash-bootstrap-components = "*"
@@ -18,3 +19,6 @@ PyYAML = "*"
1819

1920
[requires]
2021
python_version = "3.7"
22+
23+
[pipenv]
24+
allow_prereleases = true

Pipfile.lock

Lines changed: 247 additions & 171 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/contributing/app-dev.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ See [Streamlit's Getting Started guide](https://docs.streamlit.io/getting_starte
2323

2424
```bash
2525
pipenv shell
26-
pipenv install
26+
pipenv sync --dev
2727
streamlit run src/app.py
2828
```
2929

k8s.preprod/app-ingress.yaml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,13 @@ metadata:
1313
# allow requests larger than 1MiB
1414
nginx.ingress.kubernetes.io/proxy-body-size: "0"
1515
nginx.ingress.kubernetes.io/configuration-snippet: |
16-
location / {
17-
sub_filter </head>
18-
'<!-- Google Tag Manager -->
19-
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
20-
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
21-
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
22-
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
23-
})(window,document,'script','dataLayer','GTM-KBZ6ZKX');</script>
24-
<!-- End Google Tag Manager -->';
25-
sub_filter </body>
26-
'<!-- Google Tag Manager (noscript) -->
27-
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KBZ6ZKX"
28-
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
29-
<!-- End Google Tag Manager (noscript) -->'
30-
sub_filter_once on;
31-
}
16+
# Inject Google Tag Manager:
17+
18+
proxy_set_header Accept-Encoding ""; # upstream compression must be disabled
19+
20+
sub_filter '</head>' '<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({"gtm.start": new Date().getTime(),event:"gtm.js"});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!="dataLayer"?"&l="+l:"";j.async=true;j.src="https://www.googletagmanager.com/gtm.js?id="+i+dl;f.parentNode.insertBefore(j,f); })(window,document,"script","dataLayer","GTM-KBZ6ZKX");</script></head>';
21+
22+
sub_filter '</body>' '<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KBZ6ZKX" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript></body>';
3223
spec:
3324
tls:
3425
- hosts:
@@ -62,7 +53,6 @@ metadata:
6253
proxy_cache_bypass $http_x_purge;
6354
proxy_cache_key $proxy_upstream_name$request_uri;
6455
proxy_cache_lock on;
65-
proxy_cache_use_stale updating;
6656
add_header X-Cache-Status $upstream_cache_status;
6757
spec:
6858
rules:

k8s.prod/app-ingress.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ metadata:
1212
certmanager.k8s.io/cluster-issuer: letsencrypt-prod
1313
# allow requests larger than 1MiB
1414
nginx.ingress.kubernetes.io/proxy-body-size: "0"
15+
nginx.ingress.kubernetes.io/configuration-snippet: |
16+
# Inject Google Tag Manager:
17+
18+
proxy_set_header Accept-Encoding ""; # upstream compression must be disabled
19+
20+
sub_filter '</head>' '<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({"gtm.start": new Date().getTime(),event:"gtm.js"});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!="dataLayer"?"&l="+l:"";j.async=true;j.src="https://www.googletagmanager.com/gtm.js?id="+i+dl;f.parentNode.insertBefore(j,f); })(window,document,"script","dataLayer","GTM-KBZ6ZKX");</script></head>';
21+
22+
sub_filter '</body>' '<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KBZ6ZKX" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript></body>';
1523
spec:
1624
tls:
1725
- hosts:
@@ -71,7 +79,6 @@ metadata:
7179
proxy_cache_bypass $http_x_purge;
7280
proxy_cache_key $proxy_upstream_name$request_uri;
7381
proxy_cache_lock on;
74-
proxy_cache_use_stale updating;
7582
add_header X-Cache-Status $upstream_cache_status;
7683
spec:
7784
rules:

script/format

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
3+
# script/format: Format python code
4+
5+
set -e
6+
cd "$(dirname "$0")/.."
7+
8+
FILES_TO_FORMAT="src/ tests/ setup.py"
9+
10+
if [ "$1" = "--check" ]; then
11+
python -m black --check ${FILES_TO_FORMAT}
12+
else
13+
python -m black ${FILES_TO_FORMAT}
14+
fi

setup.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,17 @@
2222
package_dir={'': 'src'},
2323
packages=find_namespace_packages(where='src', exclude=('tests')),
2424
install_requires=[
25-
"streamlit",
26-
"pandas",
27-
"numpy",
2825
"altair",
29-
"pytest",
26+
"black",
27+
"gunicorn",
3028
"dash",
3129
"dash_bootstrap_components",
30+
"numpy",
31+
"pandas",
32+
"pytest",
3233
"pyyaml",
33-
"gunicorn",
34-
"selenium"
34+
"selenium",
35+
"streamlit",
3536
],
3637
classifiers=[
3738
"Programming Language :: Python :: 3",

src/app.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55

66
from penn_chime.presentation import (
77
display_download_link,
8+
display_footer,
89
display_header,
910
display_sidebar,
1011
hide_menu_style,
11-
write_definitions,
12-
write_footer,
1312
)
1413
from penn_chime.settings import get_defaults
1514
from penn_chime.models import SimSirModel
@@ -93,5 +92,4 @@
9392
labels=p.labels)
9493
st.table(table_df)
9594

96-
write_definitions(st)
97-
write_footer(st)
95+
display_footer(st)

0 commit comments

Comments
 (0)