Skip to content

Commit 78cee7e

Browse files
authored
Merge pull request #29 from nyu-devops/sp25-updates
Updates for Spring 2025 Semester
2 parents 1412095 + cd8fb66 commit 78cee7e

File tree

13 files changed

+925
-1262
lines changed

13 files changed

+925
-1262
lines changed

.devcontainer/Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Image for a Python 3 development environment
22
FROM python:3.11-slim
33

4-
# Add any tools that are needed beyond Python 3
4+
# Add any tools that are needed beyond Python 3.11
55
RUN apt-get update && \
66
apt-get install -y sudo vim make git zip tree curl wget jq procps net-tools && \
77
apt-get autoremove -y && \
@@ -22,15 +22,14 @@ RUN groupadd --gid $USER_GID $USERNAME \
2222

2323
# Set up the Python development environment
2424
WORKDIR /app
25-
COPY pyproject.toml poetry.lock ./
26-
RUN sudo python -m pip install --upgrade pip poetry && \
27-
sudo poetry config virtualenvs.create false && \
28-
sudo poetry install
25+
COPY Pipfile Pipfile.lock ./
26+
RUN python -m pip install -U pip pipenv && \
27+
pipenv install --system --dev
2928

3029
# Enable color terminal for docker exec bash
3130
ENV TERM=xterm-256color
3231

33-
EXPOSE 5000
32+
EXPOSE 8080
3433

3534
# Become a regular user for development
3635
USER $USERNAME

.devcontainer/devcontainer.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
"customizations": {
1919
"vscode": {
2020
"settings": {
21+
"cSpell.words": [
22+
"wsgi",
23+
"pytest",
24+
"pipenv",
25+
"Redis",
26+
"testdb"
27+
],
2128
"[python]": {
2229
"editor.defaultFormatter": "ms-python.black-formatter",
2330
"editor.formatOnSave": true
@@ -44,6 +51,8 @@
4451
"ms-python.pylint",
4552
"ms-python.flake8",
4653
"ms-python.black-formatter",
54+
"njpwerner.autodocstring",
55+
"wholroyd.jinja",
4756
"ms-vscode.makefile-tools",
4857
"yzhang.markdown-all-in-one",
4958
"DavidAnson.vscode-markdownlint",
@@ -56,11 +65,9 @@
5665
"github.vscode-github-actions",
5766
"hbenl.vscode-test-explorer",
5867
"LittleFoxTeam.vscode-python-test-adapter",
59-
"njpwerner.autodocstring",
60-
"wholroyd.jinja",
6168
"redhat.vscode-yaml",
69+
"unjinjang.rest-api-client",
6270
"ms-azuretools.vscode-docker",
63-
"rangav.vscode-thunder-client",
6471
"streetsidesoftware.code-spell-checker",
6572
"bbenoist.vagrant"
6673
]

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ venv/
1616
# Byte-compiled
1717
__pycache__/
1818
*.py[cod]
19+
.pytest_cache/

.github/workflows/ci.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ jobs:
3131

3232
- name: Install dependencies
3333
run: |
34-
python -m pip install poetry
35-
poetry config virtualenvs.create false
36-
poetry install
34+
python -m pip install pipenv
35+
pipenv install --system --dev
3736
3837
- name: Linting
3938
run: |
@@ -44,8 +43,8 @@ jobs:
4443
# Run pylint on the service
4544
pylint service tests --max-line-length=127
4645
47-
- name: Run unit tests with PyTest
48-
run: pytest
46+
- name: Run unit tests and generate a coverage report
47+
run: pytest --cov-report=xml
4948
env:
5049
DATABASE_URI: "redis://redis:6379/0"
5150

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ db/*
2424
__pycache__/
2525
*.py[cod]
2626
*$py.class
27+
.pytest_cache/
2728

2829
# C extensions
2930
*.so

Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ FROM python:3.11-slim
22

33
# Create working folder and install dependencies
44
WORKDIR /app
5-
COPY pyproject.toml poetry.lock ./
6-
RUN python -m pip install --upgrade pip poetry && \
7-
poetry config virtualenvs.create false && \
8-
poetry install --without dev
5+
6+
# Set up the Python development environment without dev tools
7+
COPY Pipfile Pipfile.lock ./
8+
RUN python -m pip install -U pip pipenv && \
9+
pipenv install --system
910

1011
# Copy the application contents
1112
COPY wsgi.py .

Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,18 @@ all: help
2222
.PHONY: clean
2323
clean: ## Removes all dangling docker images
2424
$(info Removing all dangling docker images..)
25-
docker image prune -f
25+
-docker image prune -f
26+
-rm .coverage coverage.xml unittests.xml
2627

2728
.PHONY: venv
2829
venv: ## Create a Python virtual environment
2930
$(info Creating Python 3 virtual environment...)
30-
poetry config virtualenvs.in-project true
31-
poetry shell
31+
pipenv shell
3232

3333
.PHONY: install
3434
install: ## Install dependencies
3535
$(info Installing dependencies...)
36-
sudo poetry config virtualenvs.create false
37-
sudo poetry install
36+
pipenv install --dev
3837

3938
.PHONY: lint
4039
lint: ## Run the linter

Pipfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
flask = "==3.1.0"
8+
redis = "==5.2.1"
9+
flask-redis = "==0.4.0"
10+
retry2 = "==0.9.5"
11+
python-dotenv = "==1.0.1"
12+
gunicorn = "==23.0.0"
13+
14+
[dev-packages]
15+
honcho = "~=2.0.0"
16+
pylint = "~=3.3.4"
17+
flake8 = "~=7.1.1"
18+
black = "~=25.1.0"
19+
pytest = "~=8.3.4"
20+
pytest-pspec = "~=0.0.4"
21+
pytest-cov = "~=6.0.0"
22+
factory-boy = "~=3.3.3"
23+
coverage = "~=7.6.12"
24+
httpie = "~=3.2.4"
25+
26+
[requires]
27+
python_version = "3.11"

0 commit comments

Comments
 (0)