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: ensure nested packages are included in distribution #389

Merged
merged 1 commit into from
Dec 18, 2023

Conversation

angela-tran
Copy link
Member

Follow-up to #382

Azure app service is failing to start. The logs show this:

2023-12-18T18:20:58.529647182Z + bin/init.sh
2023-12-18T18:20:58.561899719Z + flask init-db
2023-12-18T18:21:01.808387128Z Error: While importing 'eligibility_server.app', an ImportError was raised:
2023-12-18T18:21:01.808429029Z
2023-12-18T18:21:01.808433829Z Traceback (most recent call last):
2023-12-18T18:21:01.808437229Z   File "/home/calitp/.local/lib/python3.11/site-packages/flask/cli.py", line 219, in locate_app
2023-12-18T18:21:01.808440729Z     __import__(module_name)
2023-12-18T18:21:01.808444429Z   File "/home/calitp/.local/lib/python3.11/site-packages/eligibility_server/app.py", line 10, in <module>
2023-12-18T18:21:01.808448329Z     from eligibility_server import __version__, db, sentry
2023-12-18T18:21:01.808451929Z ImportError: cannot import name 'db' from 'eligibility_server' (/home/calitp/.local/lib/python3.11/site-packages/eligibility_server/__init__.py)
2023-12-18T18:21:01.808455429Z
2023-12-18T18:21:01.808458329Z
2023-12-18T18:21:01.814854655Z Usage: flask [OPTIONS] COMMAND [ARGS]...
2023-12-18T18:21:01.814875356Z Try 'flask --help' for help.
2023-12-18T18:21:01.814879456Z
2023-12-18T18:21:01.815534669Z Error: No such command 'init-db'.

I'm not able to reproduce this locally: flask init-db and ./bin/init.sh both work for me. However, I do see that the sdist (tarball) and the wheel are not including the eligibility_server.db package, so in this PR, we tweak the configuration so that nested packages will be included.

See https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#package-discovery-and-namespace-packages for documentation on this configuration change.

@angela-tran angela-tran self-assigned this Dec 18, 2023
@angela-tran angela-tran requested a review from a team as a code owner December 18, 2023 21:46
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.

@machikoyasuda
Copy link
Member

@angela-tran thanks for linking to the relevant docs for both of these prs!

@angela-tran angela-tran merged commit b73035c into dev Dec 18, 2023
6 checks passed
@angela-tran angela-tran deleted the fix/nested-packages branch December 18, 2023 22:44
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