Skip to content

Commit

Permalink
Add basic flask app
Browse files Browse the repository at this point in the history
  • Loading branch information
JackPlowman committed Apr 3, 2024
1 parent 5293976 commit d37d7a9
Show file tree
Hide file tree
Showing 16 changed files with 1,461 additions and 1,388 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ SHELL=/bin/bash -euo pipefail

#Installs dependencies using poetry.
install-python:
poetry install
poetry install --no-root.

#Installs dependencies using npm.
install-node:
Expand All @@ -18,7 +18,7 @@ install: install-node install-python .git/hooks/pre-commit

#Run the npm linting script (specified in package.json). Used to check the syntax and formatting of files.
lint:
npm run lint
# TODO: Python linting
find . -name '*.py' -not -path '**/.venv/*' | xargs poetry run flake8

#Removes build/ + dist/ directories
Expand Down
2,443 changes: 1,432 additions & 1,011 deletions poetry.lock

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[project]
python = "^3.8"

[tool.poetry]
name = "validated-relationships-service-api"
version = "0.0.1-alpha"
Expand All @@ -14,17 +11,22 @@ repository = "https://github.com/NHSDigital/validated-relationships-service-api"
homepage = "https://digital.nhs.uk/developer/api-catalogue"
keywords = ["healthcare", "uk", "nhs"] #TODO add additional keywords


[tool.poetry.dependencies]
python = "^3.8"

[tool.poetry.group.sandbox.dependencies]
flask = "^3.0.2"
gunicorn = "^21.2.0"

[tool.poetry.group.test.dependencies]
pytest-nhsd-apim = "^3.3.2"

[tool.poetry.dev-dependencies]
flake8 = "^3.7.9"
black = "^20.8b1"
pip-licenses = "^2.0.1"
jinja2 = "^2.11.1"
pyyaml = "^5.2"
jinja2 = "^3.1.3"
pyyaml = "^6.0.1"
docopt = "^0.6.2"
jsonpath-rw = "^1.4.0"
semver = "^2.9.0"
Expand All @@ -33,5 +35,3 @@ pytest = "^6.1.2"
coverage = "^5.5"
aiohttp = "^3.7.3"
pytest-asyncio = "^0.14.0"

[tool.poetry.scripts]
17 changes: 0 additions & 17 deletions sandbox/.eslintrc.js

This file was deleted.

3 changes: 3 additions & 0 deletions sandbox/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
poetry.lock
poetry.toml
pyproject.toml
4 changes: 0 additions & 4 deletions sandbox/.mocharc.yml

This file was deleted.

8 changes: 5 additions & 3 deletions sandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
FROM node:12
FROM python:3.8

COPY . /sandbox

WORKDIR /sandbox

RUN npm install
RUN pip install poetry

RUN poetry install --only sandbox

EXPOSE 9000

CMD ["npm", "start"]
CMD ["poetry", "run", "gunicorn", "app:app", "--bind=localhost:9000"]
18 changes: 4 additions & 14 deletions sandbox/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,9 @@ list:
@grep '^[^#[:space:]].*:' Makefile

build:
docker build .

clean:
rm -rf ./node_modules

install:
npm install --dev

update:
npm update
cp ../pyproject.toml . && cp ../poetry.lock . && cp ../poetry.toml .
docker build -t validate-relationships-service-api-sandbox .
rm -f pyproject.toml poetry.lock poetry.toml

test:
NODE_ENV=test npx mocha --reporter spec

test-report:
NODE_ENV=test npx mocha --reporter mocha-junit-reporter --reporter-options mochaFile=../../reports/tests/$(dirname).xml || true
poetry run pytest
Empty file added sandbox/__init__.py
Empty file.
133 changes: 0 additions & 133 deletions sandbox/app.js

This file was deleted.

7 changes: 7 additions & 0 deletions sandbox/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from flask import Flask

app = Flask(__name__)

@app.route("/hello_world", methods=["GET"])
def hello_world() -> dict:
return {"message": "Hello, World!"}
67 changes: 0 additions & 67 deletions sandbox/app.spec.js

This file was deleted.

Loading

0 comments on commit d37d7a9

Please sign in to comment.