Skip to content

Commit 7dc59e8

Browse files
authored
Upgrade Dependencies, Status Endpoint, and GitHub Actions (#17)
1 parent 457bf55 commit 7dc59e8

12 files changed

Lines changed: 191 additions & 28 deletions

File tree

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,34 @@ about: Create a report to help us improve
44
title: ''
55
labels: ''
66
assignees: ''
7-
87
---
98

109
**Describe the bug**
10+
1111
A clear and concise description of what the bug is.
1212

1313
**To Reproduce**
14+
1415
Steps to reproduce the behavior:
16+
1517
1. Go to '...'
1618
2. Click on '....'
1719
3. Scroll down to '....'
1820
4. See error
1921

2022
**Expected behavior**
23+
2124
A clear and concise description of what you expected to happen.
2225

2326
**Screenshots**
27+
2428
If applicable, add screenshots to help explain your problem.
2529

2630
**Desktop (please complete the following information):**
2731
- OS: [e.g. iOS]
2832
- Browser [e.g. chrome, safari]
2933
- Version [e.g. 22]
3034

31-
**Smartphone (please complete the following information):**
32-
- Device: [e.g. iPhone6]
33-
- OS: [e.g. iOS8.1]
34-
- Browser [e.g. stock browser, safari]
35-
- Version [e.g. 22]
36-
3735
**Additional context**
36+
3837
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@ assignees: ''
88
---
99

1010
**Is your feature request related to a problem? Please describe.**
11+
1112
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
1213

1314
**Describe the solution you'd like**
15+
1416
A clear and concise description of what you want to happen.
1517

1618
**Describe alternatives you've considered**
19+
1720
A clear and concise description of any alternative solutions or features you've considered.
1821

1922
**Additional context**
23+
2024
Add any other context or screenshots about the feature request here.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!--- Provide a general summary of your changes in the Title above -->
2+
3+
This PR fixes #issue_number _(If you are fixing a bug)_ which reported a bug that caused a problem to occur when users...
4+
5+
_(or if you are introducing a new feature)_ which requested a feature to allow the user to...
6+
7+
## Description
8+
9+
<!--- Describe your changes in detail -->
10+
11+
## How has this been tested?
12+
13+
<!--- Please describe in detail how you tested your changes. -->
14+
<!--- Include details of your testing environment, tests ran to see how -->
15+
<!--- your change affects other areas of the code, etc. -->
16+
17+
## Screenshots (if appropriate):
18+
19+
## Still to do:
20+
21+
<!--
22+
If this is a work-in-progress (WIP), list the changes you still need to make and/or questions or the reviewer(s). You can also mention extensions to your work that might be added as an issue to work on after the PR.
23+
-->
24+
25+
- [ ]
26+
- [ ]
27+
- [ ]
28+
29+
## Questions for the reviewer(s):
30+
31+
- [ ]
32+
- [ ]

.github/SECURITY.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Open Source Security Policies and Procedures
2+
3+
This document outlines security procedures and general policies for the
4+
Georgetown-Analytics Open Source projects as found on
5+
https://github.com/georgetown-analytics.
6+
7+
## Reporting a Vulnerability
8+
9+
The Georgetown Data Science faculty and community take all security
10+
vulnerabilities seriously. Thank you for improving the security of our
11+
open source software. We appreciate your efforts and responsible
12+
disclosure and will make every effort to acknowledge your contributions.
13+
14+
Report security vulnerabilities by emailing the Georgetown faculty at:
15+
16+
pdcprograms@georgetown.edu
17+
18+
After the initial reply to your report, the facutly team will endeavor to
19+
keep you informed of the progress towards a fix and full announcement, and
20+
may ask for additional information or guidance.
21+
22+
Report security vulnerabilities in third-party modules to the person or
23+
team maintaining the module.

.github/workflows/containers.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Containers
2+
on:
3+
push:
4+
branches:
5+
- main
6+
tags:
7+
- 'v*'
8+
pull_request:
9+
branches:
10+
- main
11+
12+
jobs:
13+
data-space:
14+
name: Data Space
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout Code
18+
uses: actions/checkout@v3
19+
20+
- name: Setup Environment
21+
id: vars
22+
run: |
23+
echo "::set-output name=tag::${GITHUB_REF#refs/*/}"
24+
echo "::set-output name=revision::$(git rev-parse --short HEAD)"
25+
26+
- name: Docker Metadata
27+
id: meta
28+
uses: docker/metadata-action@v3
29+
with:
30+
# list of Docker images to use as basenames for tags
31+
# this should be configured for each container built
32+
images: |
33+
bbengfort/data-space
34+
tags: |
35+
type=semver,pattern={{raw}}
36+
type=semver,pattern={{version}}
37+
type=semver,pattern={{major}}.{{minor}}
38+
type=sha,prefix=,suffix=,format=short
39+
40+
- name: Setup QEMU
41+
uses: docker/setup-qemu-action@v1
42+
43+
- name: Setup Docker Buildx
44+
id: buildx
45+
uses: docker/setup-buildx-action@v1
46+
47+
- name: Login to DockerHub
48+
if: github.event_name != 'pull_request'
49+
uses: docker/login-action@v1
50+
with:
51+
username: ${{ secrets.DOCKERHUB_USERNAME }}
52+
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
53+
54+
- name: Build and Push
55+
id: docker_build
56+
uses: docker/build-push-action@v2
57+
with:
58+
context: .
59+
file: ./Dockerfile
60+
push: ${{ github.event_name != 'pull_request' }}
61+
tags: ${{ steps.meta.outputs.tags }}
62+
labels: ${{ steps.meta.outputs.labels }}
63+
build-args: |
64+
GIT_REVISION=${{ steps.vars.outputs.revision }}

.github/workflows/tests.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Tests
2+
on:
3+
push:
4+
branches:
5+
- main
6+
tags:
7+
- 'v*'
8+
pull_request:
9+
10+
jobs:
11+
lint:
12+
name: Flake8
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Setup Python
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: '3.11'
19+
20+
- name: Install Flake8
21+
run: |
22+
python3 -m pip install --upgrade pip
23+
python3 -m pip install flake8
24+
25+
- name: Checkout Code
26+
uses: actions/checkout@v3
27+
28+
- name: Lint Python Code
29+
run: flake8 --ignore=E501,F401,E266 .

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,5 @@ venv.bak/
102102

103103
# mypy
104104
.mypy_cache/
105+
106+
.vscode

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Dynamic Builds
2-
ARG BUILDER_IMAGE=python:3.8-slim-buster
3-
ARG FINAL_IMAGE=python:3.8-slim-buster
2+
ARG BUILDER_IMAGE=python:3.11-slim-buster
3+
ARG FINAL_IMAGE=python:3.11-slim-buster
4+
ARG GIT_REVISION=""
45

56
# Build Stage
67
FROM ${BUILDER_IMAGE} AS builder
@@ -22,7 +23,7 @@ RUN flake8 --ignore=E501,F401,E266 .
2223

2324
# Build dependencies into wheels
2425
COPY ./requirements.txt .
25-
RUN python3 -m pip install numpy==1.16.4 cython
26+
RUN python3 -m pip install numpy==1.23.4 cython
2627
RUN python3 -m pip wheel --no-cache-dir --wheel-dir /usr/src/app/wheels -r requirements.txt
2728

2829
# Final Stage

Procfile

Lines changed: 0 additions & 1 deletion
This file was deleted.

app.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
from numpy import asarray
2828
from functools import partial
29+
from datetime import datetime
2930

3031
from sklearn.svm import SVC
3132
from sklearn.preprocessing import MinMaxScaler
@@ -52,6 +53,9 @@
5253

5354
app = Flask(__name__)
5455

56+
version = "v1.1.0"
57+
started = datetime.now()
58+
5559

5660
##########################################################################
5761
## Routes
@@ -153,6 +157,15 @@ def fit():
153157
})
154158

155159

160+
@app.route("/status", methods=["GET"])
161+
def status():
162+
return jsonify({
163+
"status": "ok",
164+
"version": version,
165+
"uptime": (datetime.now() - started).total_seconds(),
166+
})
167+
168+
156169
##########################################################################
157170
## Run the Web App
158171
##########################################################################

0 commit comments

Comments
 (0)