chore: include migrations in pyinstaller bundle#153
chore: include migrations in pyinstaller bundle#153TommrraraSnow wants to merge 1 commit intomainfrom
Conversation
|
🤖 Hi @TommrraraSnow, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
| PROJECT_ROOT = Path(__file__).resolve().parents[5] | ||
| if str(PROJECT_ROOT) not in sys.path: | ||
| sys.path.insert(0, str(PROJECT_ROOT)) |
There was a problem hiding this comment.
Avoid hard-coded parent depth when loading packaged migrations
The new Alembic env now computes PROJECT_ROOT with Path(__file__).resolve().parents[5]. That works when the migrations live on disk at /…/zsim/api_src/services/database/migrations, but when run_migrations_to_head() loads the scripts via importlib.resources.as_file in a PyInstaller build the directory is extracted to a temporary folder such as /tmp/tmpabcd/migrations. In that context the parents sequence has fewer than six elements and this line raises IndexError before migrations run, causing the packaged API to crash during startup. Consider deriving the project root more defensively (e.g. walk up until you find the zsim package or guard against short paths) so the code works both in-source and when migrations are extracted to a flat temporary directory.
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68eca5f50d30832d9a6ebf6bc0fc9ec4