Add optional Alembic migration CLI (sqlmodel[migrations]) - #2094
Closed
vmskonakanchi wants to merge 16 commits into
Closed
vmskonakanchi wants to merge 16 commits into
vmskonakanchi wants to merge 16 commits into
Conversation
- Move alembic and typer from core dependencies to a [migrations] optional extra so the base install stays lightweight - Guard CLI imports to show a friendly 'pip install sqlmodel[migrations]' message when the extra is not installed - Revert uv.lock so the PR does not modify the lockfile (regenerated on merge) - Document the migrations extra in the migrations guide
Contributor
|
This PR modifies dependency files ( If you need a dependency change, please open a discussion describing what you need and why. Closing this PR automatically. |
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.
Summary
This carries forward the Alembic migration CLI from #689 against current
main, with the packaging concerns from #2062 resolved. It supersedes #2061, which was auto-closed for modifying dependency files.It adds an optional
sqlmodel migrationsCLI (thin, typed wrappers aroundalembic.command, exposed via Typer) plus documentation, and lays the groundwork for an extensiblesqlmodelCLI via entry points.Packaging changes (addressing why #2061 was closed)
Following the guidance in discussion #2062:
alembicandtyperare now under[project.optional-dependencies]as amigrationsextra, so the basesqlmodelinstall stays lightweight. Users opt in withpip install "sqlmodel[migrations]".uv.lockis unchanged in this PR; it can be regenerated by the maintainers' release workflow on merge.sqlmodel[migrations]rather than a rawModuleNotFoundError.CLI structure
Docs
migrationsextra.Validation
uv run pytest tests/test_cli— passes (6 tests)uv run ruff check sqlmodel/cli tests/test_cli— passesuv run sqlmodel migrations --help— lists all commandstyperis unavailableContext
Happy to adapt the design (e.g. wrapper vs. abstraction scope) based on maintainer preference.