-
Notifications
You must be signed in to change notification settings - Fork 3
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
Refactor: organize application as a package #140
Conversation
this is to prepare for moving setup and teardown into the same module make sure tests have an app context so that the db object knows which app to work with
run it using `flask init-db`
run it using `flask drop-db`
f8f5f55
to
2d65a63
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small documentation change.
I ran and tested:
- Ran
cp .env.sample .env
- Ran
docker compose build --no-cache server
- Ran and passed all tests
- Opened
http://localhost:5000/healthcheck
,http://localhost:5000/publickey
- Tested
flask drop-db
I believe this PR also closes #139 |
👀 Started reading through this tonight, will finish a little later or tomorrow! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a good direction overall.
I'm not totally thrilled with the Database
class (nothing you did in this PR) - it feels weird, we called it that in the past because it literally was the hardcoded database. Now it's just that check_user
function... which is really doing the eligibility check? Oh well. Not too worried about this for now.
Left a few comments inline, a few areas we need some changes and a few potential cleanups/reorgs.
Thanks @machikoyasuda and @thekaveman for your thorough reviews! I agree with the things you pointed out and will work through these items. |
temporarily move Database class to separate module to avoid circular import
@thekaveman I made some changes based on your feedback. Also, I agree with this:
Should I try to move the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of my comments below are mostly stylistic and don't require any changes.
But one thing that should be addressed: We want the Docker app container to install this package!
Need a line in the Dockerfile
like:
RUN pip install -e .
Obviously the source and setup.py
need to the in the image layer for this to work, so may need to adjust how/where pip install
happens, or just do it a second time if that's preferable.
Didn't see this comment before leaving my review - but yeah that could be a better place for it! Maybe turn |
remove unnecessary Database class, and port test_database to use Verify.
c4841dc
to
39aaa7b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
- All tests passed locally
- The package is installed (in a python REPL session I could
import eligibility_server
) /healthcheck
,/publickey
,/verify
return expected results
Part of #131
Closes #139
This PR makes changes to the organization of our code so that
This should allow us to move towards using the app factory pattern, which in turn should move us towards using a separate database when testing.
Note that the
setup.py
andteardown.py
scripts for modifying the database were converted intoclick
commands to facilitate moving them into adb
sub-package and since that's the approach shown in Flask documentation.