Skip to content

Commit 89a9bfc

Browse files
authored
Release 2023.08.1 (#300)
2 parents 9d52639 + 68df688 commit 89a9bfc

File tree

15 files changed

+93
-97
lines changed

15 files changed

+93
-97
lines changed

.devcontainer/Dockerfile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
FROM eligibility_server:latest
22

3-
# install python tooling
4-
COPY .devcontainer/requirements.txt .devcontainer/requirements.txt
5-
RUN pip install --no-cache-dir -r .devcontainer/requirements.txt
3+
# install devcontainer requirements
4+
RUN pip install -e .[dev,test]
65

7-
# install docs tooling
6+
# docs requirements are in a separate file for the GitHub Action
87
COPY docs/requirements.txt docs/requirements.txt
98
RUN pip install --no-cache-dir -r docs/requirements.txt
109

11-
# install test tooling
12-
COPY tests/requirements.txt tests/requirements.txt
13-
RUN pip install -r tests/requirements.txt
10+
# install pre-commit environments in throwaway Git repository
11+
# https://stackoverflow.com/a/68758943
12+
COPY .pre-commit-config.yaml .
13+
RUN git init . && \
14+
pre-commit install-hooks && \
15+
rm -rf .git

.devcontainer/devcontainer.json

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,27 @@
88
"postStartCommand": ["/bin/bash", "bin/init.sh"],
99
"postAttachCommand": ["/bin/bash", ".devcontainer/postAttach.sh"],
1010

11-
// Set *default* container specific settings.json values on container create.
12-
"settings": {
13-
"terminal.integrated.defaultProfile.linux": "bash",
14-
"terminal.integrated.profiles.linux": {
15-
"bash": {
16-
"path": "/bin/bash"
17-
}
11+
"customizations": {
12+
// Set *default* container specific settings.json values on container create.
13+
"vscode": {
14+
"settings": {
15+
"terminal.integrated.defaultProfile.linux": "bash",
16+
"terminal.integrated.profiles.linux": {
17+
"bash": {
18+
"path": "/bin/bash"
19+
}
20+
}
21+
},
22+
// Add the IDs of extensions you want installed when the container is created.
23+
"extensions": [
24+
"bpruitt-goddard.mermaid-markdown-syntax-highlighting",
25+
"eamodio.gitlens",
26+
"esbenp.prettier-vscode",
27+
"hashicorp.terraform",
28+
"mhutchie.git-graph",
29+
"ms-python.python",
30+
"ms-python.vscode-pylance"
31+
]
1832
}
19-
},
20-
21-
// Add the IDs of extensions you want installed when the container is created.
22-
"extensions": [
23-
"bpruitt-goddard.mermaid-markdown-syntax-highlighting",
24-
"eamodio.gitlens",
25-
"esbenp.prettier-vscode",
26-
"hashicorp.terraform",
27-
"mhutchie.git-graph",
28-
"ms-python.python",
29-
"ms-python.vscode-pylance"
30-
]
33+
}
3134
}

.devcontainer/requirements.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
version: 2
77
updates:
88
- package-ecosystem: "pip"
9-
directory: "/" # requirements.txt
9+
directory: "/" # pyproject.toml
1010
schedule:
1111
interval: "daily"
1212
commit-message:

.github/workflows/run-tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ jobs:
1717
- name: Install package and dependencies
1818
run: |
1919
python -m pip install --upgrade pip
20-
pip install -r tests/requirements.txt
21-
pip install -r requirements.txt
20+
pip install -e .[test]
2221
2322
- name: Load environment variables
2423
uses: cardinalby/export-env-action@v2

.vscode/settings.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,20 @@
99
"[python]": {
1010
"editor.defaultFormatter": "ms-python.python"
1111
},
12-
"python.defaultInterpreterPath": "/usr/local/bin/python",
1312
"python.formatting.provider": "black",
1413
"python.languageServer": "Pylance",
15-
"python.linting.flake8Enabled": true,
1614
"python.linting.enabled": true,
15+
"python.linting.flake8Enabled": true,
1716
"python.testing.pytestArgs": ["tests"],
18-
"python.testing.unittestEnabled": false,
1917
"python.testing.pytestEnabled": true,
18+
"python.testing.unittestEnabled": false,
2019
"[terraform]": {
2120
"editor.defaultFormatter": "hashicorp.terraform"
2221
},
2322
"[terraform-vars]": {
2423
"editor.defaultFormatter": "hashicorp.terraform"
24+
},
25+
"workbench.editorAssociations": {
26+
"*.db": "sqlite-viewer.option"
2527
}
2628
}

Dockerfile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@ FROM ghcr.io/cal-itp/docker-python-web:main
22

33
ENV FLASK_APP=eligibility_server/app.py
44

5-
# install python app dependencies
6-
COPY requirements.txt requirements.txt
7-
RUN pip install --no-cache-dir -r requirements.txt
5+
# upgrade pip
6+
RUN python -m pip install --upgrade pip
87

98
# copy source files
10-
COPY bin/ bin/
9+
COPY bin bin
1110
COPY eligibility_server/ eligibility_server/
12-
COPY *.py .
13-
COPY README.md .
11+
COPY pyproject.toml pyproject.toml
1412

1513
# install source as a package
1614
RUN pip install -e .

data/server.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
sub,name,type
12
71162,Box,courtesy_card
23
32587,Gonzales,courtesy_card
34
03552,McCulley,courtesy_card

eligibility_server/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
__version__ = "2023.08.1"
2+
3+
VERSION = __version__

eligibility_server/db/setup.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,18 @@ def import_csv_users(csv_path, remote):
9494
# open in read mode explicitly since the file may still be open if we downloaded from remote
9595
# newline="" is important here, see https://docs.python.org/3/library/csv.html#id3
9696
with open(csv_path, mode="r", encoding="utf-8", newline="") as file:
97-
data = csv.reader(
97+
data = csv.DictReader(
9898
file,
9999
delimiter=config.csv_delimiter,
100100
quoting=config.csv_quoting,
101101
quotechar=config.csv_quotechar,
102102
)
103-
# unpack each record in data to the 3 columns
104-
for sub, name, types in data:
103+
104+
for row in data:
105105
# type lists are expected to be a comma-separated value and quoted if the CSV delimiter is a comma
106-
types = [type.replace(config.csv_quotechar, "") for type in types.split(",") if type]
107-
save_user(sub, name, types)
106+
types = row["type"]
107+
types = [types.replace(config.csv_quotechar, "") for type in types.split(",") if type]
108+
save_user(row["sub"], row["name"], types)
108109

109110
# close and remove the temp file if needed
110111
if temp_csv:

0 commit comments

Comments
 (0)