Skip to content

Commit b76a0a6

Browse files
authored
Merge pull request #43 from nyu-devops/su25-updates
Updates for Summer 2025
2 parents 3ab703c + 595f031 commit b76a0a6

File tree

6 files changed

+28
-41
lines changed

6 files changed

+28
-41
lines changed

.devcontainer/Dockerfile

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,14 @@
11
# Image for a Python 3 development environment
2-
FROM python:3.11-slim
3-
4-
# Add any tools that are needed beyond Python 3.11
5-
RUN apt-get update && \
6-
apt-get install -y sudo vim make git zip tree curl wget jq procps net-tools && \
7-
apt-get autoremove -y && \
8-
apt-get clean -y
9-
10-
# Create a user for development
11-
ARG USERNAME=vscode
12-
ARG USER_UID=1000
13-
ARG USER_GID=$USER_UID
14-
15-
# Create the user with passwordless sudo privileges
16-
RUN groupadd --gid $USER_GID $USERNAME \
17-
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -s /bin/bash \
18-
&& usermod -aG sudo $USERNAME \
19-
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
20-
&& chmod 0440 /etc/sudoers.d/$USERNAME \
21-
&& chown -R $USERNAME:$USERNAME /home/$USERNAME
2+
FROM quay.io/rofrano/nyu-devops-base:su25
223

234
# Set up the Python development environment
245
WORKDIR /app
256
COPY Pipfile Pipfile.lock ./
26-
RUN python -m pip install -U pip pipenv && \
27-
pipenv install --system --dev
7+
RUN sudo python -m pip install -U pip pipenv && \
8+
sudo pipenv install --system --dev
289

2910
ENV PORT=8000
3011
EXPOSE $PORT
3112

3213
# Enable color terminal for docker exec bash
3314
ENV TERM=xterm-256color
34-
35-
# Become a regular user
36-
USER $USERNAME

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"psycopg",
1414
"pytest",
1515
"onupdate",
16-
"testdb"
16+
"testdb",
17+
"petstore"
1718
],
1819
"[python]": {
1920
"editor.defaultFormatter": "ms-python.black-formatter",

.github/workflows/ci.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,21 @@ jobs:
5353
flake8 service tests --count --select=E9,F63,F7,F82 --show-source --statistics
5454
# check for complexity. The GitHub editor is 127 chars wide
5555
flake8 service tests --count --max-complexity=10 --max-line-length=127 --statistics
56-
# Run pylint on the service
56+
# Run pylint on the service package
5757
pylint service tests --max-line-length=127
5858
5959
- name: Run unit tests with pytest
6060
run: |
61-
pytest --pspec --cov=service --cov-fail-under=95 --disable-warnings
61+
pytest --pspec --cov=service --cov-fail-under=95 --disable-warnings --cov-report=xml
6262
env:
6363
FLASK_APP: "wsgi:app"
6464
DATABASE_URI: "postgresql+psycopg://postgres:pgs3cr3t@postgres:5432/testdb"
6565

66-
- name: Upload code coverage
67-
uses: codecov/codecov-action@v3.1.4
66+
- name: Install packages for Codecov to work
67+
run: apt update && apt install -y git curl gpg
68+
69+
- name: Upload coverage reports to Codecov
70+
uses: codecov/codecov-action@v5
71+
with:
72+
token: ${{ secrets.CODECOV_TOKEN }}
73+
slug: nyu-devops/lab-flask-tdd

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@ all: help
1313
.PHONY: venv
1414
venv: ## Create a Python virtual environment
1515
$(info Creating Python 3 virtual environment...)
16-
poetry shell
16+
pipenv shell
1717

1818
.PHONY: install
1919
install: ## Install Python dependencies
2020
$(info Installing dependencies...)
21-
poetry config virtualenvs.create false
22-
poetry install
21+
sudo pipenv install --system --dev
2322

2423
.PHONY: lint
2524
lint: ## Run the linter

Pipfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ flask = "==3.1.1"
88
flask-sqlalchemy = "==3.1.1"
99
psycopg = {extras = ["binary"], version = "==3.2.4"}
1010
retry2 = "==0.9.5"
11-
python-dotenv = "==1.0.1"
12-
gunicorn = "==23.0.0"
11+
python-dotenv = "~=1.1.0"
12+
gunicorn = "~=23.0.0"
1313

1414
[dev-packages]
15-
honcho = "~=2.0.0"
16-
pylint = "~=3.3.4"
17-
flake8 = "~=7.1.1"
1815
black = "~=25.1.0"
19-
pytest = "~=8.3.4"
16+
coverage = "~=7.8.2"
17+
flake8 = "~=7.2.0"
18+
pylint = "~=3.3.7"
19+
pytest = "~=8.3.5"
2020
pytest-pspec = "~=0.0.4"
21-
pytest-cov = "~=6.0.0"
21+
pytest-cov = "~=6.1.1"
2222
factory-boy = "~=3.3.3"
23-
coverage = "~=7.6.12"
23+
honcho = "~=2.0.0"
2424
httpie = "~=3.2.4"
2525

2626
[requires]

setup.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ exclude_lines =
4747
if __name__ == .__main__.:
4848
ignore_errors = true
4949

50+
[coverage:xml]
51+
output=./coverage.xml
52+
5053
[coverage:html]
5154
title = 'Test Coverage Report'
5255

0 commit comments

Comments
 (0)