Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In 896 app stabilization #145

Merged
merged 3 commits into from
Aug 18, 2023
Merged

In 896 app stabilization #145

merged 3 commits into from
Aug 18, 2023

Conversation

jonavellecuerdo
Copy link
Contributor

@jonavellecuerdo jonavellecuerdo commented Aug 16, 2023

What does this PR do?

Update the alma-webhook-lambdas repository to use new Python version and dependencies, as well as the new linting and code formatting configurations for our Python projects.

Helpful background context

The main updates introduced in this PR are to:

How can a reviewer manually see the effects of these changes?

  1. Clone the repo.
  2. Check into this branch IN-896-app-stabilization-linters.
  3. Create a new virtual environment.
  4. Install dependencies: make install (Pipfile.lock has been updated with fresh install of dependencies and therefore are updated)
  5. Run linters: make lint
  6. Run test: make test
  7. Create docker image: make dist-dev (The command to build the Docker image with Python 3.11 runs successfully, but the application itself still needs to be tested.)

Includes new or updated dependencies?

YES

What are the relevant tickets?

https://mitlibraries.atlassian.net/browse/IN-896

Developer

  • All new ENV is documented in README
  • Stakeholder approval has been confirmed (or is not needed)

Code Reviewer

  • The commit message is clear and follows our guidelines (not just this pull request message)
  • There are appropriate tests covering any new functionality
  • The documentation has been updated or is unnecessary
  • The changes have been verified
  • New dependencies are appropriate or there were no changes

@jonavellecuerdo jonavellecuerdo requested review from ghukill and ehanson8 and removed request for ghukill August 16, 2023 16:39
@jonavellecuerdo jonavellecuerdo self-assigned this Aug 16, 2023
@coveralls
Copy link

coveralls commented Aug 16, 2023

Pull Request Test Coverage Report for Build 5895633125

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 5893821044: 0.0%
Covered Lines: 140
Relevant Lines: 140

💛 - Coveralls

@jonavellecuerdo jonavellecuerdo marked this pull request as draft August 16, 2023 16:52
jonavellecuerdo and others added 3 commits August 17, 2023 15:22
Why these changes are being introduced:
* Keeping our Python version and dependencies updated
is good practice and allows us to take advantage
of the latest security updates and bug fixes for Python.

How this addresses that need:
* Update Dockerfile
* Update Pipfile
* Update .python-version

Side effects of this change:
* None

Relevant ticket(s):
* https://mitlibraries.atlassian.net/browse/IN-896
Why these changes are being introduced:
* We updated our method for managing linters and code
formatting for our Python projects to simplify
configuration and use.

How this addresses that need:
* Apply standard pyproject.toml file
* Deprecate setup.cfg
* Apply linting with Ruff
* Set black, mypy, ruff, and safety as linters
* Add pre-commit hooks
* Update Makefile
* Update Pipfile

Side effects of this change:
* None

Relevant ticket(s):
* https://mitlibraries.atlassian.net/browse/IN-896
* Update imports, type hinting, and datetime calls in webhook modules
* Update mypy command in Makefile
* Update dependencies
* Update _test_env fixture and datetime calls in conftest module
* Update test_validate_missing_signature_returns_false with more explicit error check
@jonavellecuerdo jonavellecuerdo marked this pull request as ready for review August 18, 2023 13:59
Copy link
Contributor

@ehanson8 ehanson8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to go

Copy link
Contributor

@ghukill ghukill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, too! Left a comment, but fine to merge.

Comment on lines +15 to +35
os.environ["AWS_ACCESS_KEY_ID"] = "testing"
os.environ["AWS_DEFAULT_REGION"] = "us-east-1"
os.environ["AWS_SECRET_ACCESS_KEY"] = "testing"
os.environ["AWS_SECURITY_TOKEN"] = "testing"
os.environ["AWS_SESSION_TOKEN"] = "testing"
os.environ["ALMA_CHALLENGE_SECRET"] = "itsasecret"
os.environ["ALMA_POD_EXPORT_JOB_NAME"] = "PPOD Export"
os.environ["ALMA_TIMDEX_EXPORT_JOB_NAME_PREFIX"] = "TIMDEX Export"
os.environ["ALMA_BURSAR_EXPORT_JOB_NAME_PREFIX"] = "Export to bursar"
os.environ["LAMBDA_FUNCTION_URL"] = "http://example.com/lambda"
os.environ[
"PPOD_STATE_MACHINE_ARN"
] = "arn:aws:states:us-east-1:account:stateMachine:ppod-test"
os.environ[
"TIMDEX_STATE_MACHINE_ARN"
] = "arn:aws:states:us-east-1:account:stateMachine:timdex-test"
os.environ[
"BURSAR_STATE_MACHINE_ARN"
] = "arn:aws:states:us-east-1:account:stateMachine:bursar-test"
os.environ["VALID_POD_EXPORT_DATE"] = "2022-05-23"
os.environ["WORKSPACE"] = "test"
Copy link
Contributor

@ghukill ghukill Aug 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming this change was from ruff and I think it's okay as-is, but we might want to keep our eyes open for ways in which the testing environment is set across projects.

For one, the repeating os.environ[KEY] = VALUE could be performed in a loop from a list of key/value pairs. And that begs the question whether or not those key/value pairs should be defined in the fixture itself, or somewhere else (example you can define a pytest.ini file, or even the pyproject.toml)

@jonavellecuerdo jonavellecuerdo merged commit f8f7d96 into main Aug 18, 2023
3 checks passed
@jonavellecuerdo jonavellecuerdo deleted the IN-896-app-stabilization branch August 18, 2023 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants