Skip to content

Commit 0f06ecd

Browse files
Merge pull request #309 from MITLibraries/maintenance-updates
Maintenance updates
2 parents 47f230a + b98e476 commit 0f06ecd

18 files changed

+658
-595
lines changed

.github/pull-request-template.md

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,29 @@
1-
### What does this PR do?
2-
3-
Describe the overall purpose of the PR changes. Doesn't need to be as specific as the
4-
individual commits.
5-
6-
### Helpful background context
7-
8-
Describe any additional context beyond what the PR accomplishes if it is likely to be
9-
useful to a reviewer.
10-
11-
Delete this section if it isn't applicable to the PR.
1+
### Purpose and background context
2+
Describe the overall purpose of the PR changes and any useful background context.
123

134
### How can a reviewer manually see the effects of these changes?
14-
155
Explain how to see the proposed changes in the application if possible.
166

177
Delete this section if it isn't applicable to the PR.
188

199
### Includes new or updated dependencies?
10+
YES | NO
2011

12+
### Changes expectations for external applications?
2113
YES | NO
2214

2315
### What are the relevant tickets?
24-
25-
Include links to Jira Software and/or Jira Service Management tickets here.
16+
- Include links to Jira Software and/or Jira Service Management tickets here.
2617

2718
### Developer
28-
29-
- [ ] All new ENV is documented in README (or there is none)
19+
- [ ] All new ENV is documented in README
20+
- [ ] All new ENV has been added to staging and production environments
21+
- [ ] All related Jira tickets are linked in commit message(s)
3022
- [ ] Stakeholder approval has been confirmed (or is not needed)
3123

32-
### Code Reviewer
33-
34-
- [ ] The commit message is clear and follows our guidelines (not just this pull request message)
24+
### Code Reviewer(s)
25+
- [ ] The commit message is clear and follows our guidelines (not just this PR message)
3526
- [ ] There are appropriate tests covering any new functionality
36-
- [ ] The documentation has been updated or is unnecessary
37-
- [ ] The changes have been verified
27+
- [ ] The provided documentation is sufficient for understanding any new functionality introduced
28+
- [ ] Any manual tests have been performed **or** provided examples have been verified
3829
- [ ] New dependencies are appropriate or there were no changes

.pre-commit-config.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
default_language_version:
2+
python: python3.11 # set for project python version
3+
repos:
4+
- repo: local
5+
hooks:
6+
- id: black-apply
7+
name: black-apply
8+
entry: pipenv run black
9+
language: system
10+
pass_filenames: true
11+
types: ["python"]
12+
- id: mypy
13+
name: mypy
14+
entry: pipenv run mypy
15+
language: system
16+
pass_filenames: true
17+
types: ["python"]
18+
exclude: "tests/"
19+
- id: ruff-apply
20+
name: ruff-apply
21+
entry: pipenv run ruff check --fix
22+
language: system
23+
pass_filenames: true
24+
types: ["python"]
25+
- id: safety
26+
name: safety
27+
entry: pipenv check
28+
language: system
29+
pass_filenames: false

Makefile

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,67 +6,82 @@ ECR_URL_DEV:=222053980223.dkr.ecr.us-east-1.amazonaws.com/timdex-index-manager-d
66
SHELL=/bin/bash
77
DATETIME:=$(shell date -u +%Y%m%dT%H%M%SZ)
88

9-
### Dependency commands ###
9+
help: # preview Makefile commands
10+
@awk 'BEGIN { FS = ":.*#"; print "Usage: make <target>\n\nTargets:" } \
11+
/^[-_[:alpha:]]+:.?*#/ { printf " %-15s%s\n", $$1, $$2 }' $(MAKEFILE_LIST)
1012

11-
install: ## Install dependencies and CLI app
13+
## Dependency commands
14+
15+
install: # install Python dependencies and pre-commit hook
1216
pipenv install --dev
17+
pipenv run pre-commit install
1318

14-
update: install ## Update all Python dependencies
19+
update: install # update Python dependencies
1520
pipenv clean
1621
pipenv update --dev
1722

18-
### Test commands ###
23+
## Unit Test commands
1924

20-
test: ## Run tests and print a coverage report
25+
test: # run tests and print a coverage report
2126
pipenv run coverage run --source=tim -m pytest -vv
2227
pipenv run coverage report -m
2328

24-
coveralls: test
29+
coveralls: test # write coverage data to an LCOV report
2530
pipenv run coverage lcov -o ./coverage/lcov.info
2631

27-
### Code quality and safety commands ###
28-
29-
lint: bandit black mypy pylama safety ## Run linting, code quality, and safety checks
32+
## Code quality and safety commands
3033

31-
bandit:
32-
pipenv run bandit -r tim
34+
lint: black mypy ruff safety # run linters
3335

34-
black:
36+
black: # run 'black' linter and print a preview of suggested changes
3537
pipenv run black --check --diff .
3638

37-
mypy:
39+
mypy: # run 'mypy' linter
3840
pipenv run mypy tim
3941

40-
pylama:
41-
pipenv run pylama --options setup.cfg
42+
ruff: # run 'ruff' linter and print a preview of errors
43+
pipenv run ruff check .
4244

43-
safety:
45+
safety: # check for security vulnerabilities and verify Pipfile.lock is up-to-date
4446
pipenv check
4547
pipenv verify
4648

47-
### Terraform-generated Developer Deploy Commands for Dev environment ###
48-
dist-dev: ## Build docker container (intended for developer-based manual build)
49+
lint-apply: # apply changes with 'black' and resolve fixable errors with 'ruff'
50+
black-apply ruff-apply
51+
52+
black-apply: # apply changes with 'black'
53+
pipenv run black .
54+
55+
ruff-apply: # resolve fixable errors with 'ruff'
56+
pipenv run ruff check --fix .
57+
58+
## Terraform-generated commands for container build and deployment in dev
59+
dist-dev: # build docker container (intended for developer-based manual build)
4960
docker build --platform linux/amd64 \
5061
-t $(ECR_URL_DEV):latest \
5162
-t $(ECR_URL_DEV):`git describe --always` \
5263
-t $(ECR_NAME_DEV):latest .
5364

54-
publish-dev: dist-dev ## Build, tag and push (intended for developer-based manual publish)
65+
publish-dev: dist-dev # build, tag and push (intended for developer-based manual publish)
5566
docker login -u AWS -p $$(aws ecr get-login-password --region us-east-1) $(ECR_URL_DEV)
5667
docker push $(ECR_URL_DEV):latest
5768
docker push $(ECR_URL_DEV):`git describe --always`
5869

59-
### Terraform-generated manual shortcuts for deploying to Stage ###
60-
### This requires that ECR_NAME_STAGE & ECR_URL_STAGE environment variables are set locally
61-
### by the developer and that the developer has authenticated to the correct AWS Account.
62-
### The values for the environment variables can be found in the stage_build.yml caller workflow.
63-
dist-stage: ## Only use in an emergency
70+
## Terraform-generated commands for container build and deployment in stage \
71+
This requires that ECR_NAME_STAGE and ECR_URL_STAGE environment variables \
72+
are set locally by the developer and that the developer has \
73+
authenticated to the correct AWS Account. The values for the environment \
74+
variables can be found in the stage_build.yml caller workflow. \
75+
While Stage should generally only be used in an emergency for most repos, \
76+
it is necessary for any testing requiring access to the Data Warehouse \
77+
because Cloud Connector is not enabled on Dev1.
78+
dist-stage:
6479
docker build --platform linux/amd64 \
6580
-t $(ECR_URL_STAGE):latest \
6681
-t $(ECR_URL_STAGE):`git describe --always` \
6782
-t $(ECR_NAME_STAGE):latest .
6883

69-
publish-stage: ## Only use in an emergency
84+
publish-stage:
7085
docker login -u AWS -p $$(aws ecr get-login-password --region us-east-1) $(ECR_URL_STAGE)
7186
docker push $(ECR_URL_STAGE):latest
7287
docker push $(ECR_URL_STAGE):`git describe --always`

Pipfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,16 @@ sentry-sdk = "*"
1313
smart-open = {extras = ["s3"], version = "*"}
1414

1515
[dev-packages]
16-
bandit = "*"
1716
black = "*"
1817
boto3-stubs = "*"
19-
coverage = "*"
2018
coveralls = "*"
2119
freezegun = "*"
2220
mypy = "*"
21+
pre-commit = "*"
2322
pydocstyle = "*"
24-
pylama = {extras = ["all"], version = "*"}
2523
pytest = "*"
2624
vcrpy = "*"
25+
ruff = "*"
2726

2827
[requires]
2928
python_version = "3.11"

0 commit comments

Comments
 (0)