Skip to content

Commit 981ffbc

Browse files
committed
Replaced poetry with pipenv in project files
1 parent 3d6f105 commit 981ffbc

File tree

8 files changed

+1241
-1764
lines changed

8 files changed

+1241
-1764
lines changed

Dockerfile

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
##################################################
22
# Create production image
33
##################################################
4-
FROM python:3.11-slim
4+
# cSpell: disable
5+
FROM quay.io/rofrano/python:3.11-slim
56

6-
# Establish a working folder
7+
# Set up the Python production environment
78
WORKDIR /app
9+
COPY Pipfile Pipfile.lock ./
10+
RUN python -m pip install --upgrade pip pipenv && \
11+
pipenv install --system --deploy
812

9-
# Establish dependencies
10-
COPY pyproject.toml poetry.lock ./
11-
RUN python -m pip install poetry && \
12-
poetry config virtualenvs.create false && \
13-
poetry install --without dev
14-
15-
# Copy source files last because they change the most
13+
# Copy the application contents
1614
COPY wsgi.py .
1715
COPY service ./service
1816

@@ -23,7 +21,7 @@ USER flask
2321

2422
# Expose any ports the app is expecting in the environment
2523
ENV FLASK_APP=wsgi:app
26-
ENV PORT 8080
24+
ENV PORT=8080
2725
EXPOSE $PORT
2826

2927
ENV GUNICORN_BIND 0.0.0.0:$PORT

Makefile

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,18 @@ clean: ## Removes all dangling build cache
2727

2828
venv: ## Create a Python virtual environment
2929
$(info Creating Python 3 virtual environment...)
30-
poetry shell
30+
pipenv shell
3131

3232
install: ## Install Python dependencies
3333
$(info Installing dependencies...)
34-
poetry config virtualenvs.create false
35-
poetry install
34+
sudo pipenv install --system --dev
3635

3736
.PHONY: lint
3837
lint: ## Run the linter
3938
$(info Running linting...)
40-
flake8 service tests --count --select=E9,F63,F7,F82 --show-source --statistics
41-
flake8 service tests --count --max-complexity=10 --max-line-length=127 --statistics
42-
pylint service tests --max-line-length=127
39+
-flake8 service tests --count --select=E9,F63,F7,F82 --show-source --statistics
40+
-flake8 service tests --count --max-complexity=10 --max-line-length=127 --statistics
41+
-pylint service tests --max-line-length=127
4342

4443
.PHONY: test
4544
test: ## Run the unit tests
@@ -61,12 +60,12 @@ secret: ## Generate a secret hex key
6160
.PHONY: cluster
6261
cluster: ## Create a K3D Kubernetes cluster with load balancer and registry
6362
$(info Creating Kubernetes cluster with a registry and 1 node...)
64-
k3d cluster create nyu-devops --agents 1 --registry-create cluster-registry:0.0.0.0:5000 --port '8080:80@loadbalancer'
63+
k3d cluster create $(CLUSTER) --agents 1 --registry-create cluster-registry:0.0.0.0:5000 --port '8080:80@loadbalancer'
6564

6665
.PHONY: cluster-rm
6766
cluster-rm: ## Remove a K3D Kubernetes cluster
6867
$(info Removing Kubernetes cluster...)
69-
k3d cluster delete nyu-devops
68+
k3d cluster delete $(CLUSTER)
7069

7170
##@ Deploy
7271

Pipfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
flask = "~=3.1.0"
8+
flask-sqlalchemy = "~=3.1.1"
9+
psycopg = {extras = ["binary"], version = "~=3.2.4"}
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+
httpie = "~=3.2.4"
17+
18+
# Code Quality
19+
pylint = "~=3.3.4"
20+
flake8 = "~=7.1.1"
21+
black = "~=25.1.0"
22+
23+
# Test-Driven Development
24+
pytest = "~=8.3.4"
25+
pytest-pspec = "~=0.0.4"
26+
pytest-cov = "~=6.0.0"
27+
factory-boy = "~=3.3.3"
28+
coverage = "~=7.6.12"
29+
30+
# Behavior-Driven Development
31+
behave = "~=1.2.6"
32+
selenium = "==4.16.0" # newer versions do not work
33+
requests = "~=2.31.0"
34+
compare3 = "~=1.0.4"
35+
36+
[requires]
37+
python_version = "3.11"

Pipfile.lock

Lines changed: 1140 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dot-env-example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
PORT=8080
2-
FLASK_APP=service:app
2+
FLASK_APP=wsgi:app
33
WAIT_SECONDS=5

poetry.lock

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

pyproject.toml

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

setup.cfg

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,52 @@
1-
# setup configuration for tools
1+
########################################
2+
# Tool configurations
3+
########################################
4+
# cspell: disable
5+
6+
# Setup Pytest configuration
7+
[tool:pytest]
8+
minversion = 6.0
9+
addopts = --pspec --cov=service --cov-fail-under=95
10+
testpaths =
11+
tests
12+
integration
13+
14+
# Setup PyLint configuration
15+
[pylint.FORMAT]
16+
max-line-length = 127
17+
18+
[pylint.'MESSAGES CONTROL']
19+
disable = no-member,protected-access,global-statement
20+
21+
# setup Flake8 configuration
222
[flake8]
323
max-line-length = 127
424
per-file-ignores =
525
*/__init__.py: F401 E402
26+
count = true
27+
28+
# Setup Black configurtion
29+
[black]
30+
line-length = 127
31+
32+
# Setup Coverage configuration
33+
[coverage:run]
34+
source = service
35+
omit =
36+
venv/*
37+
.venv/*
38+
39+
[coverage:report]
40+
show_missing = true
41+
exclude_lines =
42+
pragma: no cover
43+
pragma: no branch
44+
pass
45+
subprocess.CalledProcessError
46+
sys.exit
47+
if __name__ == .__main__.:
48+
ignore_errors = true
49+
50+
[coverage:html]
51+
title = 'Test Coverage Report'
52+
directory = 'coverage_report'

0 commit comments

Comments
 (0)