-
-
Notifications
You must be signed in to change notification settings - Fork 467
fix: re-export from litestar.plugins.sqlalchemy.repository
#4163
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
base: main
Are you sure you want to change the base?
Conversation
This commit introduces a new module to re-export repository classes from `advanced_alchemy.repository`. It simplifies imports by allowing direct access via `litestar.plugins.sqlalchemy.repository`.
Introduce a module that re-exports the `wrap_sqlalchemy_exception` from `advanced_alchemy.exceptions`. This simplifies imports for users of `litestar.plugins.sqlalchemy`.
Consolidated and streamlined the `sqlalchemy.py` file by replacing verbose dynamic imports with explicit re-exports. The file now serves as a lightweight compatibility layer, deferring functionality to the new package structure.
Updated import paths from `litestar.plugins.sqlalchemy` to `advanced_alchemy` to resolve module resolution issues. The original paths referenced non-existent packages due to incorrect structure assumptions.
Introduces a new SQLAlchemy plugin module to streamline imports and maintain backward compatibility. Includes deprecation warnings for certain attributes, specifying their removal in version 3.0 and encouraging updated import paths.
litestar.plugins.sqlalchemy.repository
litestar.plugins.sqlalchemy.repository
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4163 +/- ##
==========================================
- Coverage 98.38% 98.36% -0.02%
==========================================
Files 348 351 +3
Lines 15889 15914 +25
Branches 1755 1757 +2
==========================================
+ Hits 15632 15654 +22
- Misses 121 124 +3
Partials 136 136 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Introduce tests to verify SQLAlchemy module imports, ensuring proper functionality and expected deprecation warnings. These tests validate direct imports, module redirections, and deprecated paths to maintain consistent behavior across interfaces.
Replaced modern type hinting syntax with `List` and `Union` to pass mypy lint
Ensure files comply with standard formatting by adding a newline at the end. This resolves potential issues with certain tools or environments that require properly terminated files.
Eliminated the unnecessary assertion comparing ModelT between modules.
Adjusted the positioning of the module-level docstring to conform to formatting standards. This change ensures better readability and consistency with the project's style guidelines.
Adjusted the docstring in the SQLAlchemy exceptions module to a single-line format for improved readability. No functional changes were made to the module.
Reordered imports to follow standard conventions, ensuring better readability and maintainability. No functional changes were made to the code.
Updated whitespace and indentation in `test_sqlalchemy_imports.py` for better readability and adherence to style guidelines. These changes ensure consistent formatting, improving code maintainability and clarity without altering test behavior.
The `sqlalchemy.py` file was replaced by a package structure
@cofin can you take a look at this one? I'm actually not 100% sure what the intended functionality here is. |
You are creating multiple notifications for me, judging by the name, the above accounts belong to a single entity, can you refrain from breaking thoughts into multiple replies? I am waiting for evaluations from the team. |
I deleted those comments and reported them as spam, sorry for the incovenience @YuanhengZ |
Thank for the cleaning up! |
This PR completes the deprecation and migration of SQLAlchemy functionality from `litestar.contrib.sqlalchemy` to `litestar.plugins.sqlalchemy`. BREAKING CHANGE: `litestar.contrib.sqlalchemy` module has been completely removed. All imports must now use `litestar.plugins.sqlalchemy`. Changes: - Removed entire `litestar/contrib/sqlalchemy/` directory tree - Updated all documentation examples to use new import paths - Updated all tests to use new import paths - Created proper submodule structure in `litestar/plugins/sqlalchemy/` with direct re-exports from `advanced_alchemy` - Fixed type hint preservation for re-exported modules - All functionality remains available through the new import structure Migration: - `from litestar.contrib.sqlalchemy import X` → `from litestar.plugins.sqlalchemy import X` - `from litestar.contrib.sqlalchemy.plugins import Y` → `from litestar.plugins.sqlalchemy import Y` Related PRs: - litestar-org#4069 - Initial attempt by @provinzkraut - litestar-org#4163 - Second attempt by @cofin - litestar-org#3755 - Original deprecation PR Closes litestar-org#4069 Closes litestar-org#4163 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
This PR completes the deprecation and migration of SQLAlchemy functionality from `litestar.contrib.sqlalchemy` to `litestar.plugins.sqlalchemy`. BREAKING CHANGE: `litestar.contrib.sqlalchemy` module has been completely removed. All imports must now use `litestar.plugins.sqlalchemy`. Changes: - Removed entire `litestar/contrib/sqlalchemy/` directory tree - Updated all documentation examples to use new import paths - Updated all tests to use new import paths - Created proper submodule structure in `litestar/plugins/sqlalchemy/` with direct re-exports from `advanced_alchemy` - Fixed type hint preservation for re-exported modules - All functionality remains available through the new import structure Migration: - `from litestar.contrib.sqlalchemy import X` → `from litestar.plugins.sqlalchemy import X` - `from litestar.contrib.sqlalchemy.plugins import Y` → `from litestar.plugins.sqlalchemy import Y` Related PRs: - litestar-org#4069 - Initial attempt by @provinzkraut - litestar-org#4163 - Second attempt by @cofin - litestar-org#3755 - Original deprecation PR Closes litestar-org#4069 Closes litestar-org#4163 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
…alchemy imports BREAKING CHANGE: All SQLAlchemy functionality has been removed from Litestar. Both litestar.contrib.sqlalchemy and litestar.plugins.sqlalchemy modules have been completely removed. Users must now import directly from advanced-alchemy. Migration: - from litestar.contrib.sqlalchemy import X → from advanced_alchemy.extensions.litestar import X - from litestar.plugins.sqlalchemy import Y → from advanced_alchemy.extensions.litestar import Y This completes the separation of concerns, with advanced-alchemy being the sole provider of SQLAlchemy integration for Litestar. Changes: - Removed entire litestar/contrib/sqlalchemy/ directory tree - Removed litestar/plugins/sqlalchemy.py re-export file - Updated all documentation examples to use new import paths - Updated all tests to use new import paths - Deleted tests for deprecated functionality - Added changelog entry explaining the breaking change Related to: - litestar-org#4225 - Previous near-perfect implementation - litestar-org#4069, litestar-org#4163 - Earlier attempts - litestar-org#3755 - Original deprecation
Description
As discussed in #4117, this looks like a re-export issue, I tried to re-export everything related directly from
advanced_alchemy
Closes
Fix #4117