Skip to content

Commit 423cd57

Browse files
committed
eli-225 adding back in poetry, updating make and readme
1 parent de26709 commit 423cd57

File tree

9 files changed

+3308
-16
lines changed

9 files changed

+3308
-16
lines changed

.tool-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
pre-commit 3.6.0
44
vale 3.6.0
5+
poetry 2.1.1
56

67
# ==============================================================================
78
# The section below is reserved for Docker image versions.
@@ -14,6 +15,7 @@ vale 3.6.0
1415
# docker/ghcr.io/make-ops-tools/gocloc latest@sha256:6888e62e9ae693c4ebcfed9f1d86c70fd083868acb8815fe44b561b9a73b5032 # SEE: https://github.com/make-ops-tools/gocloc/pkgs/container/gocloc
1516
# docker/ghcr.io/nhs-england-tools/github-runner-image 20230909-321fd1e-rt@sha256:ce4fd6035dc450a50d3cbafb4986d60e77cb49a71ab60a053bb1b9518139a646 # SEE: https://github.com/nhs-england-tools/github-runner-image/pkgs/container/github-runner-image
1617
# docker/hadolint/hadolint 2.12.0-alpine@sha256:7dba9a9f1a0350f6d021fb2f6f88900998a4fb0aaf8e4330aa8c38544f04db42 # SEE: https://hub.docker.com/r/hadolint/hadolint/tags
18+
# docker/hashicorp/terraform 1.5.6@sha256:180a7efa983386a27b43657ed610e9deed9e6c3848d54f9ea9b6cb8a5c8c25f5 # SEE: https://hub.docker.com/r/hashicorp/terraform/tags
1719
# docker/jdkato/vale v3.6.0@sha256:0ef22c8d537f079633cfff69fc46f69a2196072f69cab1ab232e8a79a388e425 # SEE: https://hub.docker.com/r/jdkato/vale/tags
1820
# docker/koalaman/shellcheck latest@sha256:e40388688bae0fcffdddb7e4dea49b900c18933b452add0930654b2dea3e7d5c # SEE: https://hub.docker.com/r/koalaman/shellcheck/tags
1921
# docker/mstruebing/editorconfig-checker 2.7.1@sha256:dd3ca9ea50ef4518efe9be018d669ef9cf937f6bb5cfe2ef84ff2a620b5ddc24 # SEE: https://hub.docker.com/r/mstruebing/editorconfig-checker/tags

Makefile

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,12 @@ MAKE_DIR := $(abspath $(shell pwd))
77

88
#Installs dependencies using poetry.
99
install-python:
10-
poetry install
10+
poetry install --no-root
1111

1212
#Installs dependencies using npm.
1313
install-node:
1414
npm install --legacy-peer-deps
1515

16-
#Configures Git Hooks, which are scripts that run given a specified event.
17-
.git/hooks/pre-commit:
18-
cp scripts/pre-commit .git/hooks/pre-commit
19-
2016
#Condensed Target to run all targets above.
2117
install: install-node install-python .git/hooks/pre-commit
2218

@@ -37,7 +33,7 @@ publish: clean
3733
mkdir -p build
3834
mkdir -p sandbox/specification
3935
npm run publish 2> /dev/null
40-
cp build/eligibility-signposting-api.json sandbox/specification/eligibility-signposting-api.json
36+
cp build/sandbox/eligibility-signposting-api.json sandbox/specification/eligibility-signposting-api.json
4137
#Files to loop over in release
4238
_dist_include="pytest.ini poetry.lock poetry.toml pyproject.toml Makefile build/. tests"
4339

@@ -66,6 +62,26 @@ get-spec: # Get the most recent specification live in proxygen
6662
$(MAKE) setup-proxygen-credentials
6763
proxygen spec get
6864

65+
get-spec-uat: # Get the most recent specification live in proxygen
66+
$(MAKE) setup-proxygen-credentials
67+
proxygen spec get --uat
68+
69+
publish-spec: # Publish the specification to proxygen
70+
$(MAKE) setup-proxygen-credentials
71+
proxygen spec publish --specification-file build/prod/eligibility-signposting-api.json
72+
73+
publish-spec-uat: # Publish the specification to proxygen
74+
$(MAKE) setup-proxygen-credentials
75+
proxygen spec publish --specification-file build/preprod/eligibility-signposting-api.json --uat
76+
77+
delete-spec: # Delete the specification from proxygen
78+
$(MAKE) setup-proxygen-credentials
79+
proxygen spec delete
80+
81+
delete-spec-uat: # Delete the specification from proxygen
82+
$(MAKE) setup-proxygen-credentials
83+
proxygen spec delete --uat
84+
6985
# Specification
7086

7187
guard-%:
@@ -109,7 +125,7 @@ construct-spec: guard-APIM_ENV
109125
@ $(MAKE) update-spec-template APIM_ENV=$$APIM_ENV
110126
mkdir -p build/specification && \
111127
npx redocly bundle specification/eligibility-signposting-api.yaml --remove-unused-components --keep-url-references --ext yaml \
112-
> build/specification/eligibility-signposting-api.yaml
128+
> build/specification/$(APIM_ENV)/eligibility-signposting-api.yaml
113129

114130
SPEC_DIR := $(CURDIR)/specification
115131
POSTMAN_DIR := $(SPEC_DIR)/postman

poetry.lock

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

poetry.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[virtualenvs]
2+
in-project = true

pyproject.toml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
[project]
2+
name = "eligibility-signposting-api-specification"
3+
version = "0.0.1-alpha"
4+
description = "TODO"
5+
authors = [
6+
#TODO add authors
7+
]
8+
readme = "README.md"
9+
requires-python = ">=3.13"
10+
repository = "https://github.com/NHSDigital/eligibility-signposting-api-specification"
11+
homepage = "https://digital.nhs.uk/developer/api-catalogue"
12+
keywords = ["healthcare", "uk", "nhs", "vaccination", "api"] #TODO add additional keywords
13+
package_mode = false
14+
15+
[build-system]
16+
requires = ["poetry-core>=2.0.0,<3.0.0"]
17+
build-backend = "poetry.core.masonry.api"
18+
19+
[tool.poetry.dependencies]
20+
python = "^3.13"
21+
flask = {extras = ["async"], version = "^3.1.0"}
22+
httpx = "^0.28.1"
23+
yarl = "^1.18.3"
24+
pydantic = "^2.10.6"
25+
asgiref = "^3.8.1"
26+
boto3 = "^1.37.3"
27+
botocore = "^1.37.3"
28+
eval-type-backport = "^0.2.2"
29+
mangum = "^0.19.0"
30+
wireup = "^1.0.1"
31+
python-json-logger = "^3.3.0"
32+
fhir-resources = "^8.0.0"
33+
python-dateutil = "^2.9.0"
34+
pyhamcrest = "^2.1.0"
35+
36+
[tool.poetry.group.dev.dependencies]
37+
ruff = "^0.11.0"
38+
docopt = "^0.6.2"
39+
jsonpath-rw = "^1.4.0"
40+
semver = "^3.0.4"
41+
gitpython = "^3.1.44"
42+
pytest = "^8.3.4"
43+
pytest-asyncio = "^0.26.0"
44+
pytest-cov = "^6.0.0"
45+
pytest-nhsd-apim = "^5.0.0"
46+
aiohttp = "^3.11.12"
47+
awscli = "^1.37.24"
48+
awscli-local = "^0.22.0"
49+
polyfactory = "^2.20.0"
50+
pyright = "^1.1.394"
51+
brunns-matchers = "^2.9.0"
52+
localstack = "^4.1.1"
53+
pytest-docker = "^3.2.0"
54+
stamina = "^25.1.0"
55+
pytest-freezer = "^0.4.9"
56+
57+
[tool.ruff]
58+
line-length = 120
59+
exclude = ["docs/", "scripts/"]
60+
61+
[tool.ruff.lint]
62+
select = ["ALL"]
63+
ignore = ["COM812", "D"]
64+
65+
[tool.ruff.lint.per-file-ignores]
66+
"src/eligibility_signposting_api/repos/*" = ["ANN401"]
67+
"tests/*" = ["ANN", "INP", "S101", "S106"]
68+
69+
[tool.pytest.ini_options]
70+
log_cli = true
71+
log_cli_level = "DEBUG"
72+
log_format = "%(asctime)s %(levelname)s %(message)s"
73+
log_date_format = "%Y-%m-%d %H:%M:%S"
74+
asyncio_mode = "auto"
75+
asyncio_default_fixture_loop_scope = "function"
76+
77+
[tool.coverage.run]
78+
relative_files = true
79+
branch = true
80+
source = ["sandbox"]
81+
82+
[tool.coverage.report]
83+
show_missing = true
84+
skip_covered = false
85+
exclude_lines = [
86+
"pragma: no cover",
87+
"if __name__ == .__main__.:",
88+
"if TYPE_CHECKING:",
89+
"raise NotImplementedError",
90+
]

specification/README.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,28 @@ Contains APIM extensions to the OpenAPI specification with deployment requiremen
2424

2525
To build a specification for a specific environment:
2626

27-
1. Set the target environment using the `APIM_ENV` parameter
28-
2. Run `make construct-spec` from the repository root, which:
27+
1. Make sure you've run the initial setup command `make install-node`.
28+
2. Set the target environment using the `APIM_ENV` parameter
29+
3. Run `make construct-spec` from the repository root, which:
2930
- Updates templates with environment-specific values
30-
- Uses Redocly to compile the complete specification to `build/specification/`
31-
3. For the `sandbox` environment, run `make publish` to convert the specification to JSON and save it to `sandbox/specification/` for immediate use
31+
- Uses Redocly to compile the complete specification to `build/specification/$(APIM_ENV)/`
32+
4. For the `sandbox` environment, run `make publish` to convert the specification to JSON and save it to `sandbox/specification/` for immediate use.
3233

33-
### Deploying Environment-Specific Specifications
34+
### Deploying of Environment-Specific Specifications to Apigee
3435

3536
See the [Proxygen CLI user guide](https://nhsd-confluence.digital.nhs.uk/spaces/APM/pages/804495095/Proxygen+CLI+user+guide#ProxygenCLIuserguide-Settingupsettingsandcredentials)
3637

3738
We deploy our specifications using the Proxygen CLI. In order to do this, the following steps need to be performed:
3839

39-
1. Construct the specification for the environment of your choice, following the instructions above.
40-
2. Run `make retrieve-proxygen-key` from the root directory to retrieve the private key needed to authenticate with Proxygen.
41-
3. Run `make setup-proxygen-credentials` from the root directory to set up credentials needed to interact with our API proxy.
42-
4. Run `proxygen instance deploy <environment> eligibility-signposting-api ./build/specification/eligibility-signposting-api.yaml` to deploy the specification to
40+
1. Construct the specification for the environment of your choice, following the instructions above. This will be stored in
41+
2. Activate a poetry environment `poetry env activate` - you may need to run `make install-python` to install poetry etc. first.
42+
3. Run `make retrieve-proxygen-key` from the root directory to retrieve the private key needed to authenticate with Proxygen.
43+
4. Run `make setup-proxygen-credentials` from the root directory to set up credentials needed to interact with our API proxy.
44+
5. Run `proxygen instance deploy <environment> eligibility-signposting-api ./build/specification/eligibility-signposting-api.yaml` to deploy the specification to
4345
a chosen environment.
46+
47+
### Publishing specifications
48+
49+
1. To get the currently published specification run `make get-spec` for production or `make get-spec-uat` for non-production. This will return an error if a specification is not deployed.
50+
2. To publish a specification, generate an appropriate specification (prod for production, preprod for uat) above then run `make publish-spec` for production or `make publish-spec-uat` for non-production.
51+
3. To delete a specification, run `make delete-spec` for production or `make delete-spec-uat` for non-production

specification/components/security/security-preprod.yaml

Whitespace-only changes.

specification/components/security/security-prod.yaml

Whitespace-only changes.

specification/components/security/security-test.yaml

Whitespace-only changes.

0 commit comments

Comments
 (0)