Conversation
13ed6ed to
2de13e4
Compare
b2942f9 to
493b0ff
Compare
Unused outside of tests
Moves migrations into the package and updates CheckpointManager to
resolve the migration path via importlib.resources, plus packaging
updates so the migrations ship in wheels/sdists.
- commcare_export/checkpoint.py now uses
`resources.files("commcare_export") / "migrations"` and
`resources.as_file(...)` when configuring Alembic so packaged installs
can find migration files.
- commcare_export/migrations/ is now the migrations home, and its README
references the new path.
- Packaging config includes the new subpackages and migration files so
PyPI installs contain them.
493b0ff to
e029914
Compare
millerdev
approved these changes
Jan 26, 2026
commcare_export/checkpoint.py
Outdated
| command.upgrade(cfg, revision) | ||
|
|
||
| with resources.as_file(self.migrations_repository) as migrations_path: | ||
| cfg = config.Config(os.path.join(migrations_path, 'alembic.ini')) |
Contributor
There was a problem hiding this comment.
nit: is migrations_path a Path object? Given the syntax used above on line 89 I'm guessing it is.
Suggested change
| cfg = config.Config(os.path.join(migrations_path, 'alembic.ini')) | |
| cfg = config.Config(migrations_path / 'alembic.ini') |
Contributor
Author
There was a problem hiding this comment.
Alembic's Config takes a str, but migrations_path / 'alembic.ini' returns a Traversable.
But config.Config(str(migrations_path / 'alembic.ini')) should work.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are two things happening in this PR, and the second change takes advantage of the clean-up in the first:
migrations/directory inside thecommcare-exportpackage.The logging change replaces a custom Logger class with standard Python logging features.
The
migrations/directory is required byCheckpointManagerand is currently missing unlesscommcare-exportis installed from source. (Exports succeed, but checkpoints are not set.)commcare_export/checkpoint.pynow usesresources.files("commcare_export") / "migrations"andresources.as_file(...)when configuring Alembic so packaged installations can find migration files.commcare_export/migrations/is now the migrations home, and its README references the new path.Packaging config includes the new subpackages and migration files so PyPI installs contain them.
🐬 Easier to review commit-by-commit.