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

Fix: wheel did not contain a 'eligibility_server' directory #390

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

angela-tran
Copy link
Member

Follow-up to #389

Our Azure app service is still failing to start up the container, now with a slightly different message:

023-12-19T20:39:48.730935526Z + bin/init.sh
2023-12-19T20:39:48.790546218Z + flask init-db
2023-12-19T20:39:52.559070985Z Error: Could not import 'eligibility_server.app'.
2023-12-19T20:39:52.559129386Z
2023-12-19T20:39:52.561129326Z Usage: flask [OPTIONS] COMMAND [ARGS]...
2023-12-19T20:39:52.561150627Z Try 'flask --help' for help.
2023-12-19T20:39:52.561155527Z
2023-12-19T20:39:52.568523774Z Error: No such command 'init-db'.

It seems that it can't find our app at eligibility_server.app . Locally, I cannot reproduce this.

However, inspecting the wheel locally, I see that the structure is:

$ unzip -l /build/dist/eligibility_server-2023.11.1rc2.dev27+g056f5f5-py3-none-any.whl 
Archive:  /build/dist/eligibility_server-2023.11.1rc2.dev27+g056f5f5-py3-none-any.whl
  Length      Date    Time    Name
---------  ---------- -----   ----
      184  2023-12-08 19:32   __init__.py
     2747  2023-12-18 17:40   app.py
      834  2023-12-08 19:32   hash.py
     1049  2023-12-08 19:32   keypair.py
     2031  2023-12-08 19:32   sentry.py
     3512  2023-12-08 19:32   settings.py
     5675  2023-12-08 19:32   verify.py
      296  2023-12-08 19:32   db/__init__.py
      866  2023-12-08 19:32   db/models.py
     4455  2023-12-18 17:40   db/setup.py
    34539  2023-12-19 20:47   eligibility_server-2023.11.1rc2.dev27+g056f5f5.dist-info/LICENSE
    41279  2023-12-19 20:47   eligibility_server-2023.11.1rc2.dev27+g056f5f5.dist-info/METADATA
       92  2023-12-19 20:47   eligibility_server-2023.11.1rc2.dev27+g056f5f5.dist-info/WHEEL
       52  2023-12-19 20:47   eligibility_server-2023.11.1rc2.dev27+g056f5f5.dist-info/top_level.txt
     1219  2023-12-19 20:47   eligibility_server-2023.11.1rc2.dev27+g056f5f5.dist-info/RECORD
---------                     -------
    98830                     15 files

And running ls /home/calitp/.local/lib/python3.11/site-packages/, I see that the files are installed directly into that directory (hash.py, app.py, etc.).

This PR tweaks the setuptools configuration so that the wheel still contains the eligibility_server.db module (what #389 was trying to address) and is built with an eligibility_server directory.

$ unzip -l /build/dist/eligibility_server-2023.11.1rc2.dev27+g056f5f5.d20231219-py3-none-any.whl 
Archive:  /build/dist/eligibility_server-2023.11.1rc2.dev27+g056f5f5.d20231219-py3-none-any.whl
  Length      Date    Time    Name
---------  ---------- -----   ----
      184  2023-12-08 19:32   eligibility_server/__init__.py
     2747  2023-12-18 17:40   eligibility_server/app.py
      834  2023-12-08 19:32   eligibility_server/hash.py
     1049  2023-12-08 19:32   eligibility_server/keypair.py
     2031  2023-12-08 19:32   eligibility_server/sentry.py
     3512  2023-12-08 19:32   eligibility_server/settings.py
     5675  2023-12-08 19:32   eligibility_server/verify.py
      296  2023-12-08 19:32   eligibility_server/db/__init__.py
      866  2023-12-08 19:32   eligibility_server/db/models.py
     4455  2023-12-18 17:40   eligibility_server/db/setup.py
    34539  2023-12-19 21:13   eligibility_server-2023.11.1rc2.dev27+g056f5f5.d20231219.dist-info/LICENSE
    41289  2023-12-19 21:13   eligibility_server-2023.11.1rc2.dev27+g056f5f5.d20231219.dist-info/METADATA
       92  2023-12-19 21:13   eligibility_server-2023.11.1rc2.dev27+g056f5f5.d20231219.dist-info/WHEEL
       19  2023-12-19 21:13   eligibility_server-2023.11.1rc2.dev27+g056f5f5.d20231219.dist-info/top_level.txt
     1459  2023-12-19 21:13   eligibility_server-2023.11.1rc2.dev27+g056f5f5.d20231219.dist-info/RECORD
---------                     -------
    99047                     15 files

our value for FLASK_APP expects this directory
@angela-tran angela-tran self-assigned this Dec 19, 2023
@angela-tran angela-tran requested a review from a team as a code owner December 19, 2023 21:28
Copy link

Coverage report

Note

Coverage data for the default branch was not found.
This usually happens when the action has not run on the default
branch yet, for example right after deploying it into the workflows.

The coverage rate is 84.98%.
The branch rate is 85%.

None of the new lines are part of the tested code. Therefore, there is no coverage data about them.

Copy link
Member

@machikoyasuda machikoyasuda left a comment

Choose a reason for hiding this comment

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

🙏🏽🙏🏽

@angela-tran angela-tran merged commit 96e8f16 into dev Dec 19, 2023
7 checks passed
@angela-tran angela-tran deleted the fix/wheel-structure branch December 19, 2023 21:31
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.

2 participants