Skip to content

Commit 4b456ae

Browse files
authored
Update to use poetry package manager (#43)
1 parent 8a2cac6 commit 4b456ae

File tree

10 files changed

+1435
-1190
lines changed

10 files changed

+1435
-1190
lines changed

.github/workflows/pull_request.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,15 @@ jobs:
1515
- uses: actions/setup-python@v5
1616
with:
1717
python-version: ${{ env.PYTHON_VERSION }}
18-
- name: Install Pipenv
19-
run: pip install pipenv
20-
- name: Install virtual environment with dev dependencies
18+
- name: Install Poetry
19+
uses: snok/install-poetry@v1
20+
with:
21+
version: 1.8.3
22+
virtualenvs-create: true
23+
- uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ env.PYTHON_VERSION }}
26+
- name: Install virtual environment
2127
run: make install-dev
2228
- name: Running lint tests
2329
run: make lint

Makefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@ help:
1111
@echo " * make run-debug ... run locally using functions-framework"
1212

1313
install:
14-
pipenv install
15-
pipenv requirements > requirements.txt
14+
poetry install
15+
poetry export --without-hashes --format=requirements.txt > requirements.txt
1616

1717
install-dev:
18-
pipenv install --dev
18+
poetry install
1919

2020
deploy_function: install
2121
./scripts/deploy_function.sh
2222

2323
delete_function:
24-
pipenv run ./scripts/delete_function.sh
24+
poetry run ./scripts/delete_function.sh
2525

2626
format:
27-
pipenv run black . tests
28-
pipenv run isort . tests
27+
poetry run black . tests
28+
poetry run isort . tests
2929

3030
lint:
31-
pipenv run ./scripts/run_lint.sh
31+
poetry run ./scripts/run_lint.sh
3232

3333
test:
34-
pipenv run ./scripts/run_tests.sh
34+
poetry run ./scripts/run_tests.sh
3535

3636
run-debug:
37-
pipenv run functions-framework --target=send_email --debug
37+
poetry run functions-framework --target=send_email --debug

Pipfile

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

Pipfile.lock

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ On instantiation the function forwards the request on to Gov Notify, which is re
88

99
## Development
1010

11-
Local development uses Pipenv to manage the Python environment. Make sure you have Pipenv installed and are using Python version 3.11.
11+
Local development uses Poetry to manage the Python environment. Make sure you have Poetry installed and are using Python version 3.11.
1212

1313
There are two environment variables required to run the function:
1414

ci/deploy_function.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ run:
2424
gcloud config set project "${PROJECT_ID}"
2525
2626
cd eq-submission-confirmation-consumer
27-
pip3 install pipenv
28-
pipenv requirements > requirements.txt
27+
pip3 install poetry
28+
poetry export --without-hashes --format=requirements.txt > requirements.txt
2929
./scripts/deploy_function.sh

poetry.lock

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

pyproject.toml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[tool.poetry]
2+
name = "eq-submission-confirmation-consumer"
3+
version = "1.0.0"
4+
description = "ONS Digital eQ Submission Confirmation Consumer App"
5+
authors = ["ONSDigital"]
6+
package-mode = false
7+
8+
[tool.poetry.dependencies]
9+
python = "^3.11"
10+
flask = "*"
11+
google-cloud-secret-manager = "*"
12+
pyjwt = "*"
13+
requests = "*"
14+
functions-framework = "*"
15+
16+
[tool.poetry.group.dev.dependencies]
17+
pylint = "^2.17.7"
18+
black = "*"
19+
mypy = "*"
20+
pytest = "*"
21+
flake8 = "*"
22+
pylint-quotes = "*"
23+
responses = "*"
24+
pytest-cov = "*"
25+
python-dotenv = "*"
26+
types-requests = "*"
27+
28+
[build-system]
29+
requires = ["poetry-core"]
30+
build-backend = "poetry.core.masonry.api"

scripts/run_mypy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env bash
22

3-
pipenv run mypy --ignore-missing-imports *.py tests
3+
poetry run mypy --ignore-missing-imports *.py tests

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def notify_function_process():
1515

1616
# pylint: disable=consider-using-with
1717
process = subprocess.Popen(
18-
["pipenv run functions-framework --target=send_email --debug"],
18+
["poetry run functions-framework --target=send_email --debug"],
1919
cwd=cwd,
2020
stdout=subprocess.PIPE,
2121
shell=True,

0 commit comments

Comments
 (0)