File tree Expand file tree Collapse file tree 13 files changed +925
-1262
lines changed Expand file tree Collapse file tree 13 files changed +925
-1262
lines changed Original file line number Diff line number Diff line change 1
1
# Image for a Python 3 development environment
2
2
FROM python:3.11-slim
3
3
4
- # Add any tools that are needed beyond Python 3
4
+ # Add any tools that are needed beyond Python 3.11
5
5
RUN apt-get update && \
6
6
apt-get install -y sudo vim make git zip tree curl wget jq procps net-tools && \
7
7
apt-get autoremove -y && \
@@ -22,15 +22,14 @@ RUN groupadd --gid $USER_GID $USERNAME \
22
22
23
23
# Set up the Python development environment
24
24
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
29
28
30
29
# Enable color terminal for docker exec bash
31
30
ENV TERM=xterm-256color
32
31
33
- EXPOSE 5000
32
+ EXPOSE 8080
34
33
35
34
# Become a regular user for development
36
35
USER $USERNAME
Original file line number Diff line number Diff line change 18
18
"customizations" : {
19
19
"vscode" : {
20
20
"settings" : {
21
+ "cSpell.words" : [
22
+ " wsgi" ,
23
+ " pytest" ,
24
+ " pipenv" ,
25
+ " Redis" ,
26
+ " testdb"
27
+ ],
21
28
"[python]" : {
22
29
"editor.defaultFormatter" : " ms-python.black-formatter" ,
23
30
"editor.formatOnSave" : true
44
51
" ms-python.pylint" ,
45
52
" ms-python.flake8" ,
46
53
" ms-python.black-formatter" ,
54
+ " njpwerner.autodocstring" ,
55
+ " wholroyd.jinja" ,
47
56
" ms-vscode.makefile-tools" ,
48
57
" yzhang.markdown-all-in-one" ,
49
58
" DavidAnson.vscode-markdownlint" ,
56
65
" github.vscode-github-actions" ,
57
66
" hbenl.vscode-test-explorer" ,
58
67
" LittleFoxTeam.vscode-python-test-adapter" ,
59
- " njpwerner.autodocstring" ,
60
- " wholroyd.jinja" ,
61
68
" redhat.vscode-yaml" ,
69
+ " unjinjang.rest-api-client" ,
62
70
" ms-azuretools.vscode-docker" ,
63
- " rangav.vscode-thunder-client" ,
64
71
" streetsidesoftware.code-spell-checker" ,
65
72
" bbenoist.vagrant"
66
73
]
Original file line number Diff line number Diff line change 16
16
# Byte-compiled
17
17
__pycache__ /
18
18
* .py [cod ]
19
+ .pytest_cache /
Original file line number Diff line number Diff line change 31
31
32
32
- name : Install dependencies
33
33
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
37
36
38
37
- name : Linting
39
38
run : |
44
43
# Run pylint on the service
45
44
pylint service tests --max-line-length=127
46
45
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
49
48
env :
50
49
DATABASE_URI : " redis://redis:6379/0"
51
50
Original file line number Diff line number Diff line change 24
24
__pycache__ /
25
25
* .py [cod ]
26
26
* $py.class
27
+ .pytest_cache /
27
28
28
29
# C extensions
29
30
* .so
Original file line number Diff line number Diff line change @@ -2,10 +2,11 @@ FROM python:3.11-slim
2
2
3
3
# Create working folder and install dependencies
4
4
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
9
10
10
11
# Copy the application contents
11
12
COPY wsgi.py .
Original file line number Diff line number Diff line change @@ -22,19 +22,18 @@ all: help
22
22
.PHONY : clean
23
23
clean : # # Removes all dangling docker images
24
24
$(info Removing all dangling docker images..)
25
- docker image prune -f
25
+ -docker image prune -f
26
+ -rm .coverage coverage.xml unittests.xml
26
27
27
28
.PHONY : venv
28
29
venv : # # Create a Python virtual environment
29
30
$(info Creating Python 3 virtual environment...)
30
- poetry config virtualenvs.in-project true
31
- poetry shell
31
+ pipenv shell
32
32
33
33
.PHONY : install
34
34
install : # # Install dependencies
35
35
$(info Installing dependencies...)
36
- sudo poetry config virtualenvs.create false
37
- sudo poetry install
36
+ pipenv install --dev
38
37
39
38
.PHONY : lint
40
39
lint : # # Run the linter
Original file line number Diff line number Diff line change
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"
You can’t perform that action at this time.
0 commit comments