mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-22 00:11:16 -05:00
poetry
This commit is contained in:
2
.github/actions/setup-project/action.yml
vendored
2
.github/actions/setup-project/action.yml
vendored
@@ -15,4 +15,4 @@ runs:
|
||||
python-version: "3.9"
|
||||
- name: Install pipenv
|
||||
shell: bash
|
||||
run: pip install --upgrade pipenv
|
||||
run: pip install --upgrade poetry
|
||||
|
||||
16
.github/workflows/checks.yml
vendored
16
.github/workflows/checks.yml
vendored
@@ -43,17 +43,17 @@ jobs:
|
||||
env:
|
||||
SQLALCHEMY_DATABASE_TEST_URI: postgresql://user:password@localhost:5432/test_notification_api
|
||||
- name: Run style checks
|
||||
run: pipenv run flake8 .
|
||||
run: poetry run flake8 .
|
||||
- name: Check imports alphabetized
|
||||
run: pipenv run isort --check-only ./app ./tests
|
||||
run: poetry run isort --check-only ./app ./tests
|
||||
- name: Check for dead code
|
||||
run: make dead-code
|
||||
- name: Run tests with coverage
|
||||
run: pipenv run coverage run --omit=*/notifications_utils/* -m pytest --maxfail=10
|
||||
run: poetry run coverage run --omit=*/notifications_utils/* -m pytest --maxfail=10
|
||||
env:
|
||||
SQLALCHEMY_DATABASE_TEST_URI: postgresql://user:password@localhost:5432/test_notification_api
|
||||
- name: Check coverage threshold
|
||||
run: pipenv run coverage report --fail-under=50
|
||||
run: poetry run coverage report --fail-under=50
|
||||
|
||||
validate-new-relic-config:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -61,14 +61,14 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/setup-project
|
||||
- name: Install pipenv packages
|
||||
run: pipenv install --dev
|
||||
- name: Install poetry packages
|
||||
run: poetry install --dev
|
||||
- name: Validate NewRelic config
|
||||
env:
|
||||
NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY }}
|
||||
# Need to set a NEW_RELIC_ENVIRONMENT with monitor_mode: true
|
||||
NEW_RELIC_ENVIRONMENT: staging
|
||||
run: pipenv run newrelic-admin validate-config $NEW_RELIC_CONFIG_FILE
|
||||
run: poetry run newrelic-admin validate-config $NEW_RELIC_CONFIG_FILE
|
||||
|
||||
pip-audit:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -76,7 +76,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/setup-project
|
||||
- name: Create requirements.txt
|
||||
run: pipenv requirements > requirements.txt
|
||||
run: poetry export --format=requirements.txt > requirements.txt
|
||||
- uses: pypa/gh-action-pip-audit@v1.0.6
|
||||
with:
|
||||
inputs: requirements.txt
|
||||
|
||||
2
.github/workflows/daily_checks.yml
vendored
2
.github/workflows/daily_checks.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/setup-project
|
||||
- name: Create requirements.txt
|
||||
run: pipenv requirements > requirements.txt
|
||||
run: poetry export --format=requirements.txt > requirements.txt
|
||||
- uses: pypa/gh-action-pip-audit@v1.0.6
|
||||
with:
|
||||
inputs: requirements.txt
|
||||
|
||||
4
.github/workflows/deploy-demo.yml
vendored
4
.github/workflows/deploy-demo.yml
vendored
@@ -45,8 +45,8 @@ jobs:
|
||||
- name: Install application dependencies
|
||||
run: make bootstrap
|
||||
|
||||
- name: Create requirements.txt because Cloud Foundry does a weird pipenv thing
|
||||
run: pipenv requirements > requirements.txt
|
||||
- name: Create requirements.txt
|
||||
run: poetry export --format=requirements.txt > requirements.txt
|
||||
|
||||
- name: Deploy to cloud.gov
|
||||
uses: 18f/cg-deploy-action@main
|
||||
|
||||
4
.github/workflows/deploy-prod.yml
vendored
4
.github/workflows/deploy-prod.yml
vendored
@@ -49,8 +49,8 @@ jobs:
|
||||
- name: Install application dependencies
|
||||
run: make bootstrap
|
||||
|
||||
- name: Create requirements.txt because Cloud Foundry does a weird pipenv thing
|
||||
run: pipenv requirements > requirements.txt
|
||||
- name: Create requirements.txt
|
||||
run: poetry export --format=requirements.txt > requirements.txt
|
||||
|
||||
- name: Deploy to cloud.gov
|
||||
uses: 18f/cg-deploy-action@main
|
||||
|
||||
4
.github/workflows/deploy.yml
vendored
4
.github/workflows/deploy.yml
vendored
@@ -50,8 +50,8 @@ jobs:
|
||||
- name: Install application dependencies
|
||||
run: make bootstrap
|
||||
|
||||
- name: Create requirements.txt because Cloud Foundry does a weird pipenv thing
|
||||
run: pipenv requirements > requirements.txt
|
||||
- name: Create requirements.txt
|
||||
run: poetry export --format=requirements.txt > requirements.txt
|
||||
|
||||
- name: Deploy to cloud.gov
|
||||
uses: 18f/cg-deploy-action@main
|
||||
|
||||
49
Makefile
49
Makefile
@@ -12,9 +12,9 @@ GIT_COMMIT ?= $(shell git rev-parse HEAD)
|
||||
.PHONY: bootstrap
|
||||
bootstrap: ## Set up everything to run the app
|
||||
make generate-version-file
|
||||
pipenv install --dev
|
||||
poetry install --dev
|
||||
createdb notification_api || true
|
||||
(pipenv run flask db upgrade) || true
|
||||
(poetry run flask db upgrade) || true
|
||||
|
||||
.PHONY: bootstrap-with-docker
|
||||
bootstrap-with-docker: ## Build the image to run the app in Docker
|
||||
@@ -22,26 +22,26 @@ bootstrap-with-docker: ## Build the image to run the app in Docker
|
||||
|
||||
.PHONY: run-procfile
|
||||
run-procfile:
|
||||
pipenv run honcho start -f Procfile.dev
|
||||
poetry run honcho start -f Procfile.dev
|
||||
|
||||
.PHONY: avg-complexity
|
||||
avg-complexity:
|
||||
echo "*** Shows average complexity in radon of all code ***"
|
||||
pipenv run radon cc ./app -a -na
|
||||
poetry run radon cc ./app -a -na
|
||||
|
||||
.PHONY: too-complex
|
||||
too-complex:
|
||||
echo "*** Shows code that got a rating of C, D or F in radon ***"
|
||||
pipenv run radon cc ./app -a -nc
|
||||
poetry run radon cc ./app -a -nc
|
||||
|
||||
.PHONY: run-flask
|
||||
run-flask: ## Run flask
|
||||
pipenv run newrelic-admin run-program flask run -p 6011 --host=0.0.0.0
|
||||
poetry run newrelic-admin run-program flask run -p 6011 --host=0.0.0.0
|
||||
|
||||
.PHONY: run-celery
|
||||
run-celery: ## Run celery, TODO remove purge for staging/prod
|
||||
pipenv run celery -A run_celery.notify_celery purge -f
|
||||
pipenv run newrelic-admin run-program celery \
|
||||
poetry run celery -A run_celery.notify_celery purge -f
|
||||
poetry run newrelic-admin run-program celery \
|
||||
-A run_celery.notify_celery worker \
|
||||
--pidfile="/tmp/celery.pid" \
|
||||
--loglevel=INFO \
|
||||
@@ -50,17 +50,17 @@ run-celery: ## Run celery, TODO remove purge for staging/prod
|
||||
|
||||
.PHONY: dead-code
|
||||
dead-code:
|
||||
pipenv run vulture ./app --min-confidence=100
|
||||
poetry run vulture ./app --min-confidence=100
|
||||
|
||||
.PHONY: run-celery-beat
|
||||
run-celery-beat: ## Run celery beat
|
||||
pipenv run celery \
|
||||
poetry run celery \
|
||||
-A run_celery.notify_celery beat \
|
||||
--loglevel=INFO
|
||||
|
||||
.PHONY: cloudgov-user-report
|
||||
cloudgov-user-report:
|
||||
@pipenv run python -m terraform.ops.cloudgov_user_report
|
||||
@poetry run python -m terraform.ops.cloudgov_user_report
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
@@ -73,28 +73,29 @@ generate-version-file: ## Generates the app version file
|
||||
.PHONY: test
|
||||
test: export NEW_RELIC_ENVIRONMENT=test
|
||||
test: ## Run tests and create coverage report
|
||||
pipenv run black .
|
||||
pipenv run flake8 .
|
||||
pipenv run isort --check-only ./app ./tests
|
||||
pipenv run coverage run -m pytest -vv --maxfail=10
|
||||
pipenv run coverage report -m --fail-under=95
|
||||
pipenv run coverage html -d .coverage_cache
|
||||
poetry self add poetry-dotenv-plugin
|
||||
poetry run black .
|
||||
poetry run flake8 .
|
||||
poetry run isort --check-only ./app ./tests
|
||||
poetry run coverage run -m pytest -vv --maxfail=10
|
||||
poetry run coverage report -m --fail-under=95
|
||||
poetry run coverage html -d .coverage_cache
|
||||
|
||||
.PHONY: freeze-requirements
|
||||
freeze-requirements: ## Pin all requirements including sub dependencies into requirements.txt
|
||||
pipenv lock
|
||||
pipenv requirements
|
||||
poetry lock
|
||||
poetry requirements
|
||||
|
||||
.PHONY: audit
|
||||
audit:
|
||||
pipenv requirements > requirements.txt
|
||||
pipenv requirements --dev > requirements_for_test.txt
|
||||
pipenv run pip-audit -r requirements.txt
|
||||
-pipenv run pip-audit -r requirements_for_test.txt
|
||||
poetry requirements > requirements.txt
|
||||
poetry requirements --dev > requirements_for_test.txt
|
||||
poetry run pip-audit -r requirements.txt
|
||||
-poetry run pip-audit -r requirements_for_test.txt
|
||||
|
||||
.PHONY: static-scan
|
||||
static-scan:
|
||||
pipenv run bandit -r app/
|
||||
poetry run bandit -r app/
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
|
||||
2825
Pipfile.lock
generated
2825
Pipfile.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -30,13 +30,13 @@ cd /workspace
|
||||
git status
|
||||
|
||||
make generate-version-file
|
||||
pipenv install --dev
|
||||
poetry install --dev
|
||||
|
||||
# Install virtualenv to support running the isolated make freeze-requirements from within the devcontainer
|
||||
pip3 install virtualenv
|
||||
|
||||
# Upgrade schema of the notification_api database
|
||||
pipenv run flask db upgrade
|
||||
poetry run flask db upgrade
|
||||
|
||||
# Run flask server
|
||||
# make run-flask
|
||||
|
||||
@@ -30,7 +30,7 @@ cd /workspace
|
||||
git status
|
||||
|
||||
make generate-version-file
|
||||
pipenv install --dev
|
||||
poetry install --dev
|
||||
|
||||
# Install virtualenv to support running the isolated make freeze-requirements from within the devcontainer
|
||||
pip3 install virtualenv
|
||||
|
||||
@@ -247,7 +247,7 @@ Within GitHub Actions, several scans take place every day to ensure security and
|
||||
|
||||
If you're checking out the system locally, you may want to create a user quickly.
|
||||
|
||||
`pipenv run flask command create-test-user`
|
||||
`poetry run flask command create-test-user`
|
||||
|
||||
This will run an interactive prompt to create a user, and then mark that user as active. *Use a real mobile number* if you want to log in, as the SMS auth code will be sent here.
|
||||
|
||||
@@ -797,7 +797,7 @@ US_Notify Administrators are responsible for ensuring that remediations for vuln
|
||||
|
||||
U.S. Notify DNS records are maintained within [the 18f/dns repository](https://github.com/18F/dns/blob/main/terraform/notify.gov.tf). To create new DNS records for notify.gov or any subdomains:
|
||||
|
||||
1. Update the `notify.gov.tf` terraform to update or create the new records within Route53 and push the branch to the 18f/dns repository.
|
||||
1. Update the `notify.gov.tf` terraform to update oƒr create the new records within Route53 and push the branch to the 18f/dns repository.
|
||||
1. Open a PR.
|
||||
1. Verify that the plan output within circleci creates the records that you expect.
|
||||
1. Request a PR review from the 18F/tts-tech-portfolio team
|
||||
|
||||
4254
poetry.lock
generated
Normal file
4254
poetry.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,13 @@
|
||||
[[source]]
|
||||
url = "https://pypi.org/simple"
|
||||
verify_ssl = true
|
||||
name = "pypi"
|
||||
[tool.poetry]
|
||||
name = "notifications-api"
|
||||
version = "0.1.0"
|
||||
description = "Notify.gov backend"
|
||||
authors = ["Your Name <you@example.com>"]
|
||||
readme = "README.md"
|
||||
packages = [{include = "notifications_api"}]
|
||||
|
||||
[packages]
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.9"
|
||||
alembic = "==1.11.2"
|
||||
amqp = "==5.1.1"
|
||||
arrow = "==1.2.3"
|
||||
@@ -45,12 +49,14 @@ flask-sqlalchemy = "==3.0.5"
|
||||
gunicorn = {version = "==21.2.0", extras = ["eventlet"]}
|
||||
iso8601 = "==2.0.0"
|
||||
itsdangerous = "==2.1.2"
|
||||
jsonschema = {version = "==4.19.0", extras = ["format"]}
|
||||
jsonschema = {version = "==4.17.0", extras = ["format"]}
|
||||
lxml = "==4.9.3"
|
||||
marshmallow = "==3.20.1"
|
||||
marshmallow-sqlalchemy = "==0.29.0"
|
||||
notifications-python-client = "==6.3.0"
|
||||
oscrypto = "==1.3.0"
|
||||
poetry = "==1.6.1"
|
||||
poetry-dotenv-plugin = "==0.2.0"
|
||||
psycopg2-binary = "==2.9.3"
|
||||
pyjwt = "==2.8.0"
|
||||
python-dotenv = "==1.0.0"
|
||||
@@ -58,12 +64,12 @@ radon = "==6.0.1"
|
||||
sqlalchemy = "==1.4.40"
|
||||
werkzeug = "~=2.3"
|
||||
vulture = "==2.8"
|
||||
|
||||
packaging = "==23.1"
|
||||
notifications-utils = {editable = true, ref = "main", git = "https://github.com/GSA/notifications-utils.git"}
|
||||
notifications-utils = {git = "https://github.com/GSA/notifications-utils.git", develop = true, rev = "main"}
|
||||
newrelic = "*"
|
||||
|
||||
[dev-packages]
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
exceptiongroup = "==1.1.2"
|
||||
flake8 = "==4.0.1"
|
||||
flake8-bugbear = "==23.3.12"
|
||||
@@ -82,5 +88,6 @@ bandit = "*"
|
||||
honcho = "*"
|
||||
cloudfoundry-client = "*"
|
||||
|
||||
[requires]
|
||||
python_version = "3.9"
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
Reference in New Issue
Block a user