Skip to content

Commit 048566b

Browse files
authored
Merge pull request #214 from datakind/develop
Merge develop into staging
2 parents 9b1c763 + 1d7824d commit 048566b

51 files changed

Lines changed: 10269 additions & 542 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
"vscode": {
1616
"extensions": [
1717
"hashicorp.terraform",
18-
"ms-python.black-formatter"
18+
"charliermarsh.ruff"
1919
],
2020
"settings": {
2121
"[python]": {
22-
"editor.defaultFormatter": "ms-python.black-formatter",
22+
"editor.defaultFormatter": "charliermarsh.ruff",
2323
"editor.formatOnSave": true
2424
}
2525
}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,6 @@ dmypy.json
114114
# terraform
115115
**/.terraform/*
116116
**/terraform.tfvars
117+
118+
# Cursor rule files
119+
.cursor/

.vscode/launch.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,21 @@
2929
"env": {
3030
"ENV_FILE_PATH": "${workspaceFolder}/src/worker/.env"
3131
}
32+
},
33+
{
34+
"name": "pytest (current file)",
35+
"type": "debugpy",
36+
"request": "launch",
37+
"module": "pytest",
38+
"args": [
39+
"${file}",
40+
"-v",
41+
"-s"
42+
],
43+
"cwd": "${workspaceFolder}",
44+
"env": {
45+
"ENV_FILE_PATH": "${workspaceFolder}/src/webapp/.env"
46+
}
3247
}
3348
],
3449
}

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ To get an overview of the project, please read the [README](README.md) and our [
1010
## Getting started
1111
### Creating Issues
1212

13-
If you spot a problem, [search if an issue already exists](https://github.com/datakind/sst-app-api/issues). If a related issue doesn't exist,
14-
you can open a new issue using a relevant [issue form](https://github.com/datakind/sst-app-api/issues/new).
13+
If you spot a problem, [search if an issue already exists](https://github.com/datakind/edvise-api/issues). If a related issue doesn't exist,
14+
you can open a new issue using a relevant [issue form](https://github.com/datakind/edvise-api/issues/new).
1515

1616
As a general rule, we don’t assign issues to anyone. If you find an issue to work on, you are welcome to open a PR with a fix.
1717

@@ -28,7 +28,7 @@ poetry install --no-interaction
2828
As many other open source projects, we use the famous [gitflow](https://nvie.com/posts/a-successful-git-branching-model/) to manage our branches.
2929

3030
Summary of our git branching model:
31-
- Get all the latest work from the upstream `datakind/sst-app-api` repository
31+
- Get all the latest work from the upstream `datakind/edvise-api` repository
3232
(`git checkout main`)
3333
- Create a new branch off with a descriptive name (for example:
3434
`feature/new-test-macro`, `bugfix/bug-when-uploading-results`). You can
@@ -107,7 +107,7 @@ You can type `pytest` to run your tests, no matter which type of test it is.
107107

108108
## Continuous Integration
109109

110-
We use [GitHub Actions](https://github.com/datakind/sst-app-api/actions)
110+
We use [GitHub Actions](https://github.com/datakind/edvise-api/actions)
111111
for continuous integration.
112112
See [here](https://docs.github.com/en/actions) for GitHub's documentation.
113113

README.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,25 @@
22

33
This repo contains:
44

5-
* [src/webapp/](https://github.com/datakind/sst-app-api/tree/develop/src/webapp): The source code for the SST API (which is called by the SST frontend and by any direct API callers)
6-
* [src/worker/](https://github.com/datakind/sst-app-api/tree/develop/src/worker): The source code for the SFTP Worker (which calls the SST API)
5+
* [src/webapp/](https://github.com/datakind/edvise-api/tree/develop/src/webapp): The source code for the SST API (which is called by the SST frontend and by any direct API callers)
6+
* [src/worker/](https://github.com/datakind/edvise-api/tree/develop/src/worker): The source code for the SFTP Worker (which calls the SST API)
77
* [terraform/]
8-
(https://github.com/datakind/sst-app-api/tree/develop/terraform): The Terraform configuration for the SST API/Frontend and other GCP resources including Cloud SQL setup, networking setup, secrets setup
8+
(https://github.com/datakind/edvise-api/tree/develop/terraform): The Terraform configuration for the SST API/Frontend and other GCP resources including Cloud SQL setup, networking setup, secrets setup
99
* .devcontainer/ and .vscode/: which allow easy setup if you are using VSCode as your IDE.
10-
* [devtools/](https://github.com/datakind/sst-app-api/tree/develop/devtools): is a place to put utility scripts
11-
* .github/: contains mostly copied over files when this directory was forked from the student-success-tool repo, so likely much of it is outdated. The only Github action we've added is the [webapp-and-worker-precommit](https://github.com/datakind/sst-app-api/blob/develop/.github/workflows/webapp-and-worker-precommit.yml) which is run on every push to develop. This action contains a python linter (we use [black](https://black.readthedocs.io/en/stable/)), and automated runs of the unit tests in the src/webapp/ and src/worker/ directories.
12-
* Additionally, [pyproject.toml](https://github.com/datakind/sst-app-api/blob/develop/pyproject.toml) and [uv.lock](https://github.com/datakind/sst-app-api/blob/develop/uv.lock) are important for dependency management. At time of writing, the worker is just skeleton code so there's no separate dependency management. In the long-term consider separating out the dependency management for the two programs.
10+
* [devtools/](https://github.com/datakind/edvise-api/tree/develop/devtools): is a place to put utility scripts
11+
* .github/: contains mostly copied over files when this directory was forked from the student-success-tool repo, so likely much of it is outdated. The only Github action we've added is the [webapp-and-worker-precommit](https://github.com/datakind/edvise-api/blob/develop/.github/workflows/webapp-and-worker-precommit.yml) which is run on every push to develop. This action contains a python linter (we use [black](https://black.readthedocs.io/en/stable/)), and automated runs of the unit tests in the src/webapp/ and src/worker/ directories.
12+
* Additionally, [pyproject.toml](https://github.com/datakind/edvise-api/blob/develop/pyproject.toml) and [uv.lock](https://github.com/datakind/edvise-api/blob/develop/uv.lock) are important for dependency management. At time of writing, the worker is just skeleton code so there's no separate dependency management. In the long-term consider separating out the dependency management for the two programs.
1313

1414

1515
NOTE: this repo was forked from the https://github.com/datakind/student-success-tool repo, which means some of the static files (e.g. CONTRIBUTING.md) may be outdated or may include irrelevant information from that repo. Please update those as you see fit. For information about the specific items listed above, defer to the specific readmes in the relevant directory.
16+
17+
## Local edvise development override
18+
19+
Production uses a pinned Git reference for `edvise`. For local development, use an
20+
editable install after syncing the environment.
21+
22+
1. Clone `edvise` alongside `edvise-api` (so `../edvise` exists).
23+
2. Run `uv sync`.
24+
3. Override locally: `uv pip install -e ../edvise`
25+
26+
To revert back to the pinned Git dependency, run `uv sync --reinstall-package edvise`.

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ If we verify a reported security vulnerability, our policy is:
88

99
## Reporting a Security Issue
1010

11-
To report any security issues, please [raise an issue](https://github.com/datakind/sst-app-api/issues/new/choose) and select **Security issue*
11+
To report any security issues, please [raise an issue](https://github.com/datakind/edvise-api/issues/new/choose) and select **Security issue*

cloudbuild-webapp.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Cloud Build config for webapp (dev-webapp trigger).
2+
# _REGION and _ENVIRONMENT are set by the trigger (Terraform).
3+
steps:
4+
- name: ghcr.io/astral-sh/uv:debian
5+
entrypoint: bash
6+
args:
7+
- -c
8+
- |
9+
set -e
10+
apt-get update && apt-get install -y --no-install-recommends git
11+
uv lock --upgrade-package edvise
12+
- name: gcr.io/cloud-builders/docker
13+
args:
14+
- build
15+
- '-f'
16+
- src/webapp/Dockerfile
17+
- '-t'
18+
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/edvise-api/webapp:$COMMIT_SHA'
19+
- '-t'
20+
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/edvise-api/webapp:latest'
21+
- .
22+
- name: gcr.io/cloud-builders/docker
23+
args:
24+
- push
25+
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/edvise-api/webapp:$COMMIT_SHA'
26+
- name: gcr.io/cloud-builders/docker
27+
args:
28+
- push
29+
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/edvise-api/webapp:latest'
30+
- name: gcr.io/cloud-builders/gcloud
31+
args:
32+
- run
33+
- deploy
34+
- '${_ENVIRONMENT}-webapp'
35+
- '--image'
36+
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/edvise-api/webapp:$COMMIT_SHA'
37+
- '--region'
38+
- '${_REGION}'
39+
- name: curlimages/curl
40+
args:
41+
- '-X'
42+
- POST
43+
- '-H'
44+
- 'Content-Type: application/json'
45+
- '-f'
46+
- '-d'
47+
- >-
48+
{"text":"🚀 *$REPO_NAME* deployed · `$BRANCH_NAME` · $TRIGGER_NAME · $BUILD_ID"}
49+
- >-
50+
https://hooks.slack.com/triggers/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
51+
id: notify-slack
52+
timeout: 600s
53+
options:
54+
logging: CLOUD_LOGGING_ONLY
55+
dynamicSubstitutions: true

cloudbuild-worker.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Cloud Build config for worker (dev-worker trigger).
2+
# _REGION and _ENVIRONMENT are set by the trigger (Terraform).
3+
steps:
4+
- name: gcr.io/cloud-builders/docker
5+
args:
6+
- build
7+
- '-f'
8+
- src/worker/Dockerfile
9+
- '-t'
10+
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/edvise-api/worker:$COMMIT_SHA'
11+
- '-t'
12+
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/edvise-api/worker:latest'
13+
- .
14+
- name: gcr.io/cloud-builders/docker
15+
args:
16+
- push
17+
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/edvise-api/worker:$COMMIT_SHA'
18+
- name: gcr.io/cloud-builders/docker
19+
args:
20+
- push
21+
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/edvise-api/worker:latest'
22+
- name: gcr.io/cloud-builders/gcloud
23+
args:
24+
- run
25+
- deploy
26+
- '${_ENVIRONMENT}-worker'
27+
- '--image'
28+
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/edvise-api/worker:$COMMIT_SHA'
29+
- '--region'
30+
- '${_REGION}'
31+
timeout: 600s
32+
options:
33+
logging: CLOUD_LOGGING_ONLY
34+
dynamicSubstitutions: true

pyproject.toml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dependencies = [
88
"databricks-sdk~=0.38.0",
99
"pydantic~=2.10",
1010
"fastapi[standard]~=0.115.4",
11-
"google-cloud-storage~=2.18.2",
11+
"google-cloud-storage==2.19.0",
1212
"paramiko~=3.5.0",
1313
"cloud-sql-python-connector[pymysql]~=1.14.0",
1414
"sqlalchemy~=2.0.36",
@@ -28,13 +28,14 @@ dependencies = [
2828
"thefuzz[speedup]~=0.22.1",
2929
"databricks-sql-connector~=3.5.0",
3030
"pandera~=0.13",
31-
"mlflow~=2.15.0",
31+
"mlflow~=2.22",
3232
"cachetools",
3333
"types-cachetools",
34+
"edvise~=0.1.12",
3435
]
3536

3637
[project.urls]
37-
Repository = "https://github.com/datakind/sst-app-api"
38+
Repository = "https://github.com/datakind/edvise-api"
3839

3940
[dependency-groups]
4041
dev = [
@@ -52,9 +53,15 @@ dev = [
5253
requires = ["hatchling"]
5354
build-backend = "hatchling.build"
5455

56+
[tool.hatch.metadata]
57+
allow-direct-references = true
58+
5559
[tool.uv]
5660
default-groups = ["dev"]
5761

62+
[tool.uv.sources]
63+
edvise = { git = "https://github.com/datakind/edvise.git", rev = "develop" }
64+
5865
[tool.ruff]
5966
line-length = 88
6067
indent-width = 4
@@ -86,8 +93,11 @@ lines-after-imports = 1
8693
[tool.pytest.ini_options]
8794
minversion = "8.0"
8895
addopts = ["--verbose", "--import-mode=importlib"]
89-
filterwarnings = ["ignore::DeprecationWarning"]
90-
testpaths = ["tests"]
96+
filterwarnings = [
97+
"ignore::DeprecationWarning",
98+
"ignore::FutureWarning:pandera",
99+
]
100+
testpaths = ["src"]
91101

92102
[tool.mypy]
93103
files = ["src"]

src/webapp/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ WORKDIR /app
1313
# Add project files
1414
ADD uv.lock pyproject.toml /app/
1515

16+
# Install git and ca-certificates
17+
RUN apt-get update \
18+
&& apt-get install -y --no-install-recommends git ca-certificates \
19+
&& rm -rf /var/lib/apt/lists/*
20+
1621
# Install dependencies
1722
RUN uv sync --frozen --no-install-project
1823

0 commit comments

Comments
 (0)