Skip to content

Commit d10f05a

Browse files
Adds, pipenv support (#14)
* Adds, pipenv support * Removes dead import * Removes safety check * Updates Dockerfile * Renames dto.py to serializer.py * Adds, .pytest_cache to gitignore
1 parent 63d29c2 commit d10f05a

20 files changed

+746
-159
lines changed

.devcontainer/devcontainer.json

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or the definition README at
2+
// https://github.com/microsoft/vscode-dev-containers/tree/master/containers/docker-existing-dockerfile
3+
{
4+
"name": "Existing Dockerfile",
5+
6+
// Sets the run context to one level up instead of the .devcontainer folder.
7+
"context": "..",
8+
9+
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
10+
"dockerFile": "../Dockerfile",
11+
12+
// The optional 'runArgs' property can be used to specify additional runtime arguments.
13+
"runArgs": [
14+
// Uncomment the next line to use Docker from inside the container. See https://aka.ms/vscode-remote/samples/docker-in-docker for details.
15+
// "-v","/var/run/docker.sock:/var/run/docker.sock",
16+
17+
// Uncomment the next line if you will be using a ptrace-based debugger like C++, Go, and Rust.
18+
// "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"
19+
20+
// You may want to add a non-root user to your Dockerfile. On Linux, this will prevent
21+
// new files getting created as root. See https://aka.ms/vscode-remote/containers/non-root-user
22+
// for the needed Dockerfile updates and then uncomment the next line.
23+
// "-u", "vscode"
24+
],
25+
26+
// Use 'settings' to set *default* container specific settings.json values on container create.
27+
// You can edit these settings after create using File > Preferences > Settings > Remote.
28+
"settings": {
29+
// This will ignore your local shell user setting for Linux since shells like zsh are typically
30+
// not in base container images. You can also update this to an specific shell to ensure VS Code
31+
// uses the right one for terminals and tasks. For example, /bin/bash (or /bin/ash for Alpine).
32+
"terminal.integrated.shell.linux": null
33+
},
34+
35+
// Uncomment the next line if you want to publish any ports.
36+
// "appPort": [],
37+
38+
// Uncomment the next line to run commands after the container is created - for example installing git.
39+
// "postCreateCommand": "apt-get update && apt-get install -y git",
40+
41+
// Add the IDs of extensions you want installed when the container is created in the array below.
42+
"extensions": []
43+
}

.dockerignore

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
__pycache__/
22
.git/
3-
.pip.cache/
43
.vscode/
5-
env/
64

75
.env.example
86
.gitignore

.gitignore

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
__pycache__/
2-
.pip.cache/
3-
.pytest.cache/
2+
.pytest_cache/
43
.vscode/
5-
env/
64
htmlcov/
75

86
.DS_Store

.pylintrc

+4-7
Original file line numberDiff line numberDiff line change
@@ -417,12 +417,9 @@ function-naming-style=snake_case
417417
#function-rgx=
418418

419419
# Good variable names which should always be accepted, separated by a comma.
420-
good-names=i,
421-
j,
422-
k,
423-
ex,
424-
Run,
425-
_
420+
good-names=app,
421+
api,
422+
blueprint,
426423

427424
# Include a hint for the correct naming format with invalid-name.
428425
include-naming-hint=no
@@ -570,7 +567,7 @@ max-returns=6
570567
max-statements=50
571568

572569
# Minimum number of public methods for a class (see R0903).
573-
min-public-methods=2
570+
min-public-methods=0
574571

575572

576573
[EXCEPTIONS]

.travis.yml

+7-13
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,22 @@ dist: xenial
33
language: python
44

55
python:
6-
- "3.6"
76
- "3.7"
8-
- "3.7-dev"
9-
- "3.8-dev"
10-
11-
cache: pip
127

138
env:
149
global:
1510
- FLASK_ENV=testing
1611
- FLASK_DEBUG=False
1712

1813
install:
19-
- pip install --cache-dir .pip.cache/ --progress-bar emoji --upgrade pip setuptools
20-
- pip install --cache-dir .pip.cache/ --progress-bar emoji --requirement requirements/test.txt
14+
- pip install --upgrade pip setuptools pipenv
15+
- pipenv install
16+
- pipenv install --dev
2117

2218
script:
23-
- safety check --full-report --file requirements/prod.txt
24-
- safety check --full-report --file requirements/dev.txt
25-
- safety check --full-report --file requirements/test.txt
26-
- pylint --rcfile .pylintrc manage.py app
27-
- pytest --cov-config=.coveragerc --cov-report xml --cov app app/test
19+
- pipenv run vulture --min-confidence 61 .
20+
- pipenv run pylint --rcfile .pylintrc manage.py app
21+
- pipenv run pytest --cov-config=.coveragerc --cov-report xml --cov app app/test
2822

2923
after_success:
30-
- codecov
24+
- pipenv run codecov

Dockerfile

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
FROM ubuntu:18.04
1+
FROM ubuntu:latest
22

3-
RUN apt-get update -y
4-
RUN apt-get install -y python3.7 python3.7-dev python3.7-venv python3-venv
3+
RUN apt update -y && \
4+
apt install -y software-properties-common && \
5+
add-apt-repository ppa:deadsnakes/ppa && \
6+
apt install -y python3.7 python3-pip
57

68
RUN mkdir -p /var/www/backend
79
WORKDIR /var/www/backend
810

911
COPY . .
1012

11-
RUN python3.7 -m venv env && \
12-
./env/bin/pip install --no-cache-dir --upgrade pip setuptools && \
13-
./env/bin/pip install --no-cache-dir --progress-bar emoji --requirement requirements/prod.txt
13+
RUN python3.7 -m pip install --no-cache-dir --upgrade pip setuptools pipenv && \
14+
pipenv install && \
15+
pipenv install --dev
1416

15-
CMD [ "env/bin/gunicorn", "--bind", "0.0.0.0:8000", "--workers", "4", "manage:app" ]
17+
CMD ["pipenv run gunicorn", "--bind", "0.0.0.0:8000", "--workers", "4", "manage:app"]

Pipfile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[[source]]
2+
name = "pypi"
3+
url = "https://pypi.org/simple"
4+
verify_ssl = true
5+
6+
[dev-packages]
7+
watchdog = "==0.9.0"
8+
pylint = "==2.4.3"
9+
pytest = "==5.2.2"
10+
pytest-cov = "==2.8.1"
11+
codecov = "==2.0.15"
12+
flask-testing = "==0.7.1"
13+
vulture = "==1.1"
14+
15+
[packages]
16+
flask = "==1.1.1"
17+
flask-restplus = "==0.13.0"
18+
flask-cors = "==3.0.8"
19+
gunicorn = "==19.9.0"
20+
python-dotenv = "==0.10.3"
21+
flask-sqlalchemy = "==2.4.1"
22+
flask-migrate = "==2.5.2"
23+
pymysql = "==0.9.3"
24+
25+
[requires]
26+
python_version = "3.7"

0 commit comments

Comments
 (0)