Conversation
WalkthroughConverted many relative imports to absolute package imports across examples, src, and tests; updated typing union syntax and a mapper field() overload type; and adjusted pyproject.toml (msgspec constraint and Ruff lint rules). Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (64)
examples/testapp/testapp/app.py(1 hunks)examples/testapp/testapp/schema.py(1 hunks)examples/testapp/testapp/types.py(1 hunks)pyproject.toml(2 hunks)src/strawchemy/__init__.py(2 hunks)src/strawchemy/dto/__init__.py(1 hunks)src/strawchemy/dto/base.py(2 hunks)src/strawchemy/dto/pydantic.py(1 hunks)src/strawchemy/dto/utils.py(1 hunks)src/strawchemy/mapper.py(3 hunks)src/strawchemy/sqlalchemy/__init__.py(1 hunks)src/strawchemy/sqlalchemy/_executor.py(1 hunks)src/strawchemy/sqlalchemy/_query.py(2 hunks)src/strawchemy/sqlalchemy/_scope.py(1 hunks)src/strawchemy/sqlalchemy/_transpiler.py(3 hunks)src/strawchemy/sqlalchemy/hook.py(1 hunks)src/strawchemy/sqlalchemy/inspector.py(1 hunks)src/strawchemy/sqlalchemy/repository/__init__.py(1 hunks)src/strawchemy/sqlalchemy/repository/_async.py(1 hunks)src/strawchemy/sqlalchemy/repository/_sync.py(1 hunks)src/strawchemy/sqlalchemy/typing.py(1 hunks)src/strawchemy/strawberry/__init__.py(1 hunks)src/strawchemy/strawberry/_field.py(2 hunks)src/strawchemy/strawberry/_registry.py(2 hunks)src/strawchemy/strawberry/_utils.py(1 hunks)src/strawchemy/strawberry/dto.py(1 hunks)src/strawchemy/strawberry/factories/aggregations.py(1 hunks)src/strawchemy/strawberry/factories/inputs.py(1 hunks)src/strawchemy/strawberry/factories/types.py(1 hunks)src/strawchemy/strawberry/filters/__init__.py(1 hunks)src/strawchemy/strawberry/filters/base.py(1 hunks)src/strawchemy/strawberry/filters/geo.py(1 hunks)src/strawchemy/strawberry/filters/inputs.py(2 hunks)src/strawchemy/strawberry/mutation/input.py(1 hunks)src/strawchemy/strawberry/repository/__init__.py(1 hunks)src/strawchemy/strawberry/repository/_async.py(1 hunks)src/strawchemy/strawberry/repository/_base.py(1 hunks)src/strawchemy/strawberry/repository/_sync.py(1 hunks)src/strawchemy/strawberry/typing.py(1 hunks)src/strawchemy/testing/__init__.py(1 hunks)src/strawchemy/typing.py(1 hunks)src/strawchemy/validation/pydantic.py(1 hunks)tests/conftest.py(1 hunks)tests/fixtures.py(1 hunks)tests/integration/conftest.py(1 hunks)tests/integration/fixtures.py(2 hunks)tests/integration/geo/test_geo_filters.py(1 hunks)tests/integration/test_aggregation_filters.py(1 hunks)tests/integration/test_aggregations.py(1 hunks)tests/integration/test_custom_resolver.py(1 hunks)tests/integration/test_distinct_on.py(1 hunks)tests/integration/test_field_extension.py(1 hunks)tests/integration/test_filters.py(1 hunks)tests/integration/test_mutations.py(1 hunks)tests/integration/test_optimizations.py(1 hunks)tests/integration/test_order_by.py(1 hunks)tests/integration/test_queries.py(1 hunks)tests/integration/test_query_hooks.py(1 hunks)tests/integration/test_schema.py(1 hunks)tests/integration/test_upsert.py(1 hunks)tests/integration/types/__init__.py(1 hunks)tests/unit/dc_models.py(1 hunks)tests/unit/test_mutation_input.py(1 hunks)tests/utils.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (40)
tests/integration/fixtures.py (1)
tests/integration/models.py (7)
Color(149-155)Department(200-208)Fruit(127-146)FruitFarm(114-118)Group(158-162)Topic(165-169)User(172-189)
tests/integration/test_custom_resolver.py (1)
tests/integration/fixtures.py (1)
QueryTracker(851-908)
src/strawchemy/strawberry/__init__.py (1)
src/strawchemy/strawberry/_utils.py (1)
default_session_getter(29-34)
src/strawchemy/strawberry/repository/_base.py (1)
src/strawchemy/strawberry/repository/_node.py (1)
StrawberryQueryNode(31-121)
tests/integration/test_upsert.py (1)
tests/integration/fixtures.py (1)
QueryTracker(851-908)
src/strawchemy/strawberry/mutation/input.py (1)
src/strawchemy/strawberry/mutation/types.py (6)
RelationType(39-41)ToManyCreateInput(119-139)ToManyUpdateInput(164-181)ToManyUpsertInput(61-73)ToOneInput(77-96)ToOneUpsertInput(45-57)
src/strawchemy/strawberry/_registry.py (2)
src/strawchemy/strawberry/_utils.py (1)
strawberry_contained_types(41-51)src/strawchemy/strawberry/typing.py (1)
StrawchemyTypeWithStrawberryObjectDefinition(75-75)
src/strawchemy/strawberry/_field.py (3)
src/strawchemy/strawberry/_utils.py (3)
dto_model_from_type(37-38)strawberry_contained_types(41-51)strawberry_contained_user_type(54-58)src/strawchemy/strawberry/exceptions.py (1)
StrawchemyFieldError(6-6)src/strawchemy/strawberry/repository/_async.py (1)
StrawchemyAsyncRepository(30-259)
src/strawchemy/dto/pydantic.py (1)
src/strawchemy/dto/backend/pydantic.py (2)
MappedPydanticDTO(38-38)PydanticDTOBackend(41-111)
src/strawchemy/sqlalchemy/hook.py (2)
tests/fixtures.py (1)
strawchemy(34-35)src/strawchemy/sqlalchemy/exceptions.py (1)
QueryHookError(16-17)
tests/integration/test_queries.py (2)
tests/integration/types/postgres.py (1)
UserType(97-97)tests/integration/fixtures.py (1)
QueryTracker(851-908)
src/strawchemy/strawberry/_utils.py (1)
src/strawchemy/strawberry/mutation/types.py (1)
ErrorType(185-195)
tests/integration/test_optimizations.py (1)
tests/integration/fixtures.py (1)
QueryTracker(851-908)
tests/integration/test_mutations.py (1)
tests/integration/fixtures.py (1)
QueryTracker(851-908)
src/strawchemy/strawberry/repository/_sync.py (1)
src/strawchemy/strawberry/repository/_base.py (2)
GraphQLResult(51-130)StrawchemyRepository(134-263)
tests/integration/geo/test_geo_filters.py (1)
tests/integration/geo/models.py (1)
GeoModel(18-42)
src/strawchemy/strawberry/typing.py (2)
src/strawchemy/strawberry/dto.py (10)
AggregateDTO(440-440)FilterFunctionInfo(212-225)GraphQLFieldDefinition(229-290)GraphQLFilterDTO(434-437)MappedStrawberryGraphQLDTO(428-428)OrderByDTO(451-467)OutputFunctionInfo(204-208)QueryNodeMetadata(93-101)StrawchemyDTOAttributes(104-111)UnmappedStrawberryGraphQLDTO(431-431)src/strawchemy/validation/pydantic.py (1)
MappedPydanticGraphQLDTO(60-62)
tests/integration/test_aggregation_filters.py (1)
tests/integration/fixtures.py (1)
QueryTracker(851-908)
examples/testapp/testapp/types.py (1)
examples/testapp/testapp/models.py (4)
Customer(73-79)Milestone(38-43)Project(52-62)Ticket(30-35)
src/strawchemy/sqlalchemy/_query.py (3)
src/strawchemy/sqlalchemy/exceptions.py (1)
TranspilingError(8-9)src/strawchemy/sqlalchemy/_scope.py (1)
QueryScope(596-963)src/strawchemy/sqlalchemy/hook.py (1)
QueryHook(40-217)
src/strawchemy/dto/utils.py (1)
src/strawchemy/dto/types.py (4)
DTOConfig(105-257)DTOFieldConfig(93-101)Purpose(57-77)PurposeConfig(81-89)
src/strawchemy/strawberry/filters/geo.py (2)
src/strawchemy/strawberry/filters/base.py (1)
FilterProtocol(34-40)src/strawchemy/strawberry/filters/inputs.py (1)
GraphQLComparison(63-92)
examples/testapp/testapp/app.py (2)
examples/testapp/testapp/models.py (1)
Base(17-27)tests/integration/models.py (1)
Base(76-78)
src/strawchemy/sqlalchemy/_transpiler.py (3)
tests/typing.py (1)
SyncQueryExecutor(18-19)src/strawchemy/sqlalchemy/exceptions.py (1)
TranspilingError(8-9)src/strawchemy/sqlalchemy/hook.py (1)
QueryHook(40-217)
src/strawchemy/sqlalchemy/_executor.py (2)
src/strawchemy/sqlalchemy/exceptions.py (1)
QueryResultError(12-13)src/strawchemy/sqlalchemy/_scope.py (1)
QueryScope(596-963)
src/strawchemy/sqlalchemy/repository/__init__.py (3)
src/strawchemy/sqlalchemy/repository/_async.py (1)
SQLAlchemyGraphQLAsyncRepository(34-513)src/strawchemy/sqlalchemy/repository/_base.py (1)
SQLAlchemyGraphQLRepository(123-345)src/strawchemy/sqlalchemy/repository/_sync.py (1)
SQLAlchemyGraphQLSyncRepository(36-513)
tests/integration/test_aggregations.py (3)
tests/integration/fixtures.py (1)
QueryTracker(851-908)tests/integration/models.py (1)
Fruit(127-146)tests/integration/utils.py (3)
compute_aggregation(97-117)from_graphql_representation(85-90)python_type(93-94)
src/strawchemy/sqlalchemy/__init__.py (4)
tests/fixtures.py (1)
strawchemy(34-35)src/strawchemy/sqlalchemy/repository/_async.py (1)
SQLAlchemyGraphQLAsyncRepository(34-513)src/strawchemy/sqlalchemy/repository/_base.py (1)
SQLAlchemyGraphQLRepository(123-345)src/strawchemy/sqlalchemy/repository/_sync.py (1)
SQLAlchemyGraphQLSyncRepository(36-513)
src/strawchemy/dto/base.py (3)
src/strawchemy/dto/utils.py (1)
config(45-69)src/strawchemy/graph.py (1)
Node(76-526)src/strawchemy/utils.py (2)
is_type_hint_optional(75-97)non_optional_type_hint(63-72)
tests/integration/test_distinct_on.py (1)
tests/integration/fixtures.py (1)
QueryTracker(851-908)
src/strawchemy/strawberry/dto.py (1)
src/strawchemy/strawberry/filters/inputs.py (2)
EqualityComparison(98-119)GraphQLComparison(63-92)
src/strawchemy/validation/pydantic.py (1)
src/strawchemy/validation/base.py (2)
InputValidationError(18-45)ValidationProtocol(48-78)
tests/utils.py (1)
tests/typing.py (2)
AsyncQueryExecutor(22-23)SyncQueryExecutor(18-19)
src/strawchemy/dto/__init__.py (3)
src/strawchemy/dto/base.py (1)
DTOFieldDefinition(270-382)src/strawchemy/dto/types.py (3)
DTOConfig(105-257)Purpose(57-77)PurposeConfig(81-89)src/strawchemy/dto/utils.py (2)
config(45-69)field(72-83)
src/strawchemy/testing/__init__.py (1)
src/strawchemy/testing/pytest_plugin.py (1)
MockContext(103-111)
src/strawchemy/typing.py (3)
tests/fixtures.py (1)
strawchemy(34-35)src/strawchemy/strawberry/repository/_async.py (1)
StrawchemyAsyncRepository(30-259)src/strawchemy/strawberry/repository/_sync.py (1)
StrawchemySyncRepository(32-257)
src/strawchemy/strawberry/factories/types.py (4)
src/strawchemy/strawberry/factories/aggregations.py (1)
AggregationInspector(253-500)src/strawchemy/strawberry/factories/base.py (3)
GraphQLDTOFactory(81-398)StrawchemyMappedFactory(401-546)_ChildOptions(76-78)src/strawchemy/strawberry/factories/enum.py (2)
EnumDTOFactory(96-201)UpsertConflictFieldsEnumDTOBackend(69-93)src/strawchemy/strawberry/factories/inputs.py (1)
OrderByDTOFactory(351-480)
tests/integration/test_query_hooks.py (1)
tests/integration/fixtures.py (1)
QueryTracker(851-908)
tests/fixtures.py (1)
tests/syrupy.py (1)
GraphQLFileExtension(57-58)
tests/unit/dc_models.py (1)
tests/unit/models.py (1)
validate_tomato_type(21-25)
🪛 Ruff (0.14.8)
src/strawchemy/mapper.py
159-159: Unused noqa directive (non-enabled: PLC0415)
Remove unused noqa directive
(RUF100)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
- GitHub Check: 🔬 integration-postgres on 3.11
- GitHub Check: 🔬 unit on 3.13
- GitHub Check: 🔬 integration-mysql on 3.10
- GitHub Check: 🔬 integration-postgres on 3.10
- GitHub Check: 🔬 integration-mysql on 3.12
- GitHub Check: 🔬 integration-sqlite on 3.13
- GitHub Check: 🔬 integration-postgres on 3.12
- GitHub Check: 🔬 integration-postgres on 3.13
- GitHub Check: 🔬 integration-sqlite on 3.12
- GitHub Check: 🔬 integration-postgres on 3.14
- GitHub Check: 🔬 unit on 3.10
- GitHub Check: 🔬 unit-no-extras on 3.12
- GitHub Check: 🔬 unit-no-extras on 3.10
- GitHub Check: 🔬 unit on 3.12
- GitHub Check: 🔬 unit-no-extras on 3.13
- GitHub Check: 🔬 unit-no-extras on 3.11
- GitHub Check: 🔬 unit-no-extras on 3.14
- GitHub Check: 🔬 unit on 3.11
- GitHub Check: 🔬 unit on 3.14
- GitHub Check: Optimize new code in this PR
🔇 Additional comments (77)
src/strawchemy/testing/__init__.py (1)
3-3: LGTM! Relative import correctly converted to absolute.The import path is accurate and aligns with the PR objective to enforce absolute imports across the codebase. The public API remains unchanged.
src/strawchemy/strawberry/factories/inputs.py (1)
28-29: LGTM! Clean conversion to absolute imports.The conversion from relative to absolute imports follows Python best practices and aligns with the PR objective to enforce absolute imports via Ruff configuration.
src/strawchemy/strawberry/factories/aggregations.py (1)
22-23: LGTM! Absolute imports improve clarity.The conversion to absolute imports makes the module dependencies explicit and easier to understand.
src/strawchemy/strawberry/factories/types.py (1)
27-35: LGTM! Comprehensive migration to absolute imports.The migration to absolute imports across all factory dependencies is well-executed and consistent. This improves maintainability by making module dependencies explicit and reducing ambiguity.
tests/unit/dc_models.py (1)
11-11: LGTM! Import path correctly updated to absolute.The change from relative to absolute import aligns with the PR objective and maintains the same functionality.
pyproject.toml (1)
377-378: LGTM! Ruff configuration correctly enforces absolute imports.The flake8-tidy-imports rule with
ban-relative-imports = "all"will prevent future relative imports, ensuring consistency with this refactoring.tests/fixtures.py (1)
12-12: LGTM! Import path correctly updated to absolute.The change maintains the same functionality while aligning with the project's new import style.
tests/unit/test_mutation_input.py (1)
9-10: LGTM! Import paths correctly updated to absolute.Both imports now use absolute paths consistently with the PR objective, maintaining the same test functionality.
src/strawchemy/validation/pydantic.py (1)
19-19: LGTM! Import path correctly updated to absolute.The change from relative to absolute import maintains functionality while following the new import convention.
tests/utils.py (1)
28-28: LGTM! Type import correctly updated to absolute path.The change maintains type-checking functionality while using the absolute import pattern.
tests/integration/test_query_hooks.py (2)
7-7: LGTM! Import path correctly updated to absolute.The RawRecordData import now uses an absolute path, maintaining test functionality.
14-14: LGTM! Type import correctly updated to absolute path.The QueryTracker type import now uses an absolute path in the TYPE_CHECKING block.
src/strawchemy/strawberry/filters/base.py (1)
19-30: LGTM! Type imports correctly updated to absolute path.The change from relative to absolute import maintains type-checking functionality while following the new convention.
src/strawchemy/strawberry/repository/_sync.py (1)
16-16: LGTM!The absolute import path correctly resolves to the base module, and both
GraphQLResultandStrawchemyRepositoryare confirmed to exist at that location.src/strawchemy/strawberry/_utils.py (1)
10-10: LGTM!The absolute import path correctly resolves to the mutation types module where
ErrorTypeis defined.tests/integration/test_filters.py (1)
7-9: LGTM!The absolute imports from
tests.integration.*are correctly structured and the imported symbols (QueryTracker,RawRecordData,to_graphql_representation) are confirmed to exist at those locations.tests/integration/test_optimizations.py (1)
9-9: LGTM!The absolute import path correctly resolves to
tests.integration.fixtureswhereQueryTrackeris defined.src/strawchemy/strawberry/mutation/input.py (1)
14-21: LGTM!The absolute import path correctly resolves to
strawchemy.strawberry.mutation.types, and all imported symbols (RelationType,ToManyCreateInput,ToManyUpdateInput,ToManyUpsertInput,ToOneInput,ToOneUpsertInput) are confirmed to exist at that location.tests/integration/test_aggregations.py (1)
8-11: LGTM!The absolute imports from
tests.integration.*are correctly structured, and all imported symbols (QueryTracker,RawRecordData,compute_aggregation,from_graphql_representation,python_type) are confirmed to exist at their respective locations.examples/testapp/testapp/types.py (1)
8-8: LGTM!The absolute import from
testapp.modelsis correct. This assumestestappis configured as a top-level package (e.g., viaPYTHONPATHor package installation), which aligns with typical example app setup patterns.tests/integration/geo/test_geo_filters.py (1)
12-12: LGTM!The absolute import path correctly resolves to
tests.integration.geo.modelswhereGeoModelandgeo_metadataare defined.src/strawchemy/strawberry/filters/geo.py (1)
14-15: LGTM! Clean conversion to absolute imports.The relative imports have been correctly converted to absolute imports using the full
strawchemy.strawberry.filters.*namespace. This change aligns with the PR's goal to enforce absolute imports across the codebase.tests/integration/test_schema.py (1)
4-5: LGTM! Test imports correctly converted to absolute paths.The relative imports have been properly converted to absolute imports using the
tests.integration.*namespace. This ensures consistency with the project-wide migration to absolute imports.src/strawchemy/sqlalchemy/typing.py (1)
14-15: LGTM! Type-checking imports correctly converted.The relative imports within the
TYPE_CHECKINGblock have been properly converted to absolute imports using the fullstrawchemy.sqlalchemy.*namespace. This maintains type-checking functionality while adhering to the absolute import convention.src/strawchemy/dto/base.py (1)
32-46: LGTM! Comprehensive conversion to absolute imports.All relative imports have been systematically converted to absolute imports using the full
strawchemy.*namespace. The changes include DTO types, utilities, graph components, and general utilities—all correctly resolved to their absolute paths.src/strawchemy/strawberry/repository/_base.py (1)
34-34: LGTM! Internal module import correctly converted.The relative import of
StrawberryQueryNodehas been properly converted to an absolute import using the fullstrawchemy.strawberry.repository._nodepath, maintaining consistency with the project-wide absolute import convention.src/strawchemy/sqlalchemy/inspector.py (1)
40-40: LGTM! Type import correctly updated.The relative import of
FilterMapwithin theTYPE_CHECKINGblock has been properly converted to an absolute import using the fullstrawchemy.sqlalchemy.typingpath. This maintains type-checking functionality without runtime overhead.src/strawchemy/sqlalchemy/__init__.py (1)
9-13: LGTM! Package exports correctly updated.The relative import in the package's
__init__.pyhas been properly converted to an absolute import using the fullstrawchemy.sqlalchemy.repositorypath. The public API remains unchanged with the same exports in__all__.src/strawchemy/dto/__init__.py (1)
5-7: LGTM! Package initialization correctly refactored.All relative imports in the package's
__init__.pyhave been systematically converted to absolute imports using the fullstrawchemy.dto.*namespace. The public API exports remain unchanged, ensuring backward compatibility.src/strawchemy/dto/pydantic.py (1)
7-9: LGTM! Absolute imports improve clarity.The conversion from relative to absolute imports is correct and aligns with the PR objective to enforce absolute imports across the codebase.
tests/integration/conftest.py (1)
3-3: LGTM! Absolute import path is correct.The conversion from relative to absolute import for the fixtures module is correct and consistent with the PR's refactoring objective.
examples/testapp/testapp/app.py (1)
9-10: LGTM! Absolute imports are correct.The conversion from relative to absolute imports for the testapp modules is correct and improves import clarity.
tests/integration/test_queries.py (2)
9-10: LGTM! Absolute imports are correct.The conversion from relative to absolute imports for test types is correct and aligns with the PR's refactoring objective.
17-17: LGTM! TYPE_CHECKING import updated correctly.The QueryTracker import under TYPE_CHECKING has been correctly updated to use the absolute import path.
src/strawchemy/strawberry/filters/inputs.py (1)
20-32: LGTM! Filter imports correctly updated to absolute paths.The conversion from relative to absolute imports for filter base classes and typing is correct and consistent with the PR's refactoring objective.
tests/integration/test_mutations.py (1)
7-8: LGTM! Test fixture imports correctly updated.The conversion from relative to absolute imports for test fixtures and typing is correct and consistent with the PR's refactoring objective.
src/strawchemy/sqlalchemy/_executor.py (2)
18-19: LGTM! Exception and typing imports correctly updated.The conversion from relative to absolute imports for exceptions and typing is correct and improves import clarity.
25-25: LGTM! TYPE_CHECKING import correctly updated.The QueryScope import under TYPE_CHECKING has been correctly updated to use the absolute import path from
strawchemy.sqlalchemy._scope.src/strawchemy/sqlalchemy/repository/__init__.py (1)
3-5: LGTM! Repository imports correctly updated.The conversion from relative to absolute imports for repository classes is correct and maintains the same public API via
__all__.src/strawchemy/dto/utils.py (1)
17-26: LGTM!The conversion from relative to absolute imports is correct. The import paths align with the module structure, and all imported symbols (
DTO_INFO_KEY,DTOConfig,DTOFieldConfig,DTOScope,ExcludeFields,IncludeFields,Purpose,PurposeConfig) are verified to exist in their respective target modules.src/strawchemy/strawberry/repository/_async.py (1)
14-14: LGTM!The absolute import path
strawchemy.strawberry.repository._basecorrectly reflects the module structure for this file located within the same package.src/strawchemy/strawberry/repository/__init__.py (1)
3-4: LGTM!The absolute imports correctly reference the sibling modules, and the public API exported via
__all__remains unchanged.tests/integration/test_custom_resolver.py (1)
14-14: LGTM!The absolute import path
tests.integration.fixturescorrectly maps to the fixtures module, andQueryTrackeris confirmed to exist there (as shown in the relevant code snippets).src/strawchemy/sqlalchemy/hook.py (1)
19-20: LGTM!The absolute imports correctly reference the sibling modules within the
strawchemy.sqlalchemypackage.QueryHookErroris confirmed to exist in the exceptions module per the relevant code snippets.src/strawchemy/sqlalchemy/_scope.py (1)
38-40: LGTM! Import paths correctly updated to absolute imports.The conversion from relative imports (
.exceptions,.inspector,.typing) to absolute imports (strawchemy.sqlalchemy.*) is correct and aligns with the PR objective. The functionality remains unchanged.Also applies to: 49-49
tests/integration/test_aggregation_filters.py (1)
7-8: LGTM! Test imports correctly updated to absolute paths.The conversion to absolute imports (
tests.integration.fixturesandtests.integration.typing) is correct and improves import clarity in test modules.examples/testapp/testapp/schema.py (1)
7-7: LGTM! Example app imports correctly updated.The conversion from relative import (
.types) to absolute import (testapp.types) is correct for the example application.tests/integration/test_field_extension.py (1)
5-5: LGTM! Import path correctly updated.The conversion to absolute import (
tests.integration.typing) is correct.tests/integration/test_distinct_on.py (1)
7-8: LGTM! Test imports correctly converted to absolute paths.The import paths are correctly updated to
tests.integration.fixturesandtests.integration.typing.tests/conftest.py (1)
1-1: LGTM! Test configuration imports correctly updated.The conversion from
.fixturestotests.fixturesis correct and improves clarity in the test configuration module.src/strawchemy/strawberry/__init__.py (1)
3-4: LGTM! Package imports correctly updated to absolute paths.The conversion from relative imports (
._instance,._utils) to absolute imports (strawchemy.strawberry.*) is correct. The public API exports remain unchanged.src/strawchemy/strawberry/filters/__init__.py (1)
3-3: LGTM! Filter module imports correctly updated.The conversion from
.inputstostrawchemy.strawberry.filters.inputsis correct and maintains the same public API.tests/integration/types/__init__.py (1)
5-5: LGTM! Clean conversion to absolute imports.The refactoring correctly converts the relative import to an absolute import path, improving code clarity and aligning with modern Python best practices.
tests/integration/fixtures.py (2)
44-54: LGTM! Proper conversion to absolute imports.The model imports have been correctly converted from relative to absolute paths, maintaining the same functionality while improving import clarity.
76-76: LGTM! Correctly moved type-only import to TYPE_CHECKING block.Moving
RawRecordDatato the TYPE_CHECKING block with an absolute import path is excellent practice—it avoids runtime circular imports while maintaining type safety.tests/integration/test_order_by.py (1)
7-9: LGTM! Consistent absolute import conversion.The test utility imports have been correctly converted to absolute paths, maintaining consistency with the broader refactoring effort across the test suite.
src/strawchemy/sqlalchemy/_query.py (2)
37-38: LGTM! Proper separation of runtime and type-checking imports.The absolute imports for
TranspilingErrorand typing definitions are correctly placed at the module level since they're used at runtime (e.g., Line 576 raisesTranspilingError).
58-59: LGTM! Correctly moved type-only imports to TYPE_CHECKING.The absolute import paths for
QueryScopeandQueryHookwithin the TYPE_CHECKING block are appropriate—these types are only used for type annotations, avoiding potential circular import issues at runtime.src/strawchemy/sqlalchemy/repository/_sync.py (2)
14-14: LGTM! Runtime imports correctly converted to absolute paths.The base repository classes are properly imported using absolute paths from
strawchemy.sqlalchemy.repository._base.
26-26: LGTM! Type-only imports correctly placed in TYPE_CHECKING block.The type aliases
InsertOrUpdateandRowLikeare appropriately imported within TYPE_CHECKING using absolute paths, which is optimal for type safety without runtime overhead.tests/integration/test_upsert.py (1)
7-7: LGTM! Consistent absolute import pattern.The
QueryTrackerimport has been correctly converted to use the absolute path, maintaining consistency with the project-wide refactoring.src/strawchemy/strawberry/_registry.py (2)
26-26: LGTM! Runtime utility correctly imported with absolute path.The
strawberry_contained_typesfunction is properly imported using an absolute path since it's used at runtime (e.g., Line 181).
45-45: LGTM! Type definitions correctly placed in TYPE_CHECKING block.The type aliases are appropriately imported within TYPE_CHECKING using absolute paths from
strawchemy.strawberry.typing, maintaining type safety without runtime import overhead.src/strawchemy/strawberry/dto.py (2)
53-53: LGTM! Runtime typing imports correctly converted.The typing definitions (
GraphQLPurpose,OrderByDTOT,QueryNodeType) are properly imported at runtime using absolute paths fromstrawchemy.strawberry.typing, as they're used in class definitions and annotations throughout the module.
59-60: LGTM! Type-only imports properly organized in TYPE_CHECKING.The filter and function typing imports are correctly placed within the TYPE_CHECKING block using absolute paths, optimizing for type safety while avoiding unnecessary runtime imports.
src/strawchemy/strawberry/typing.py (1)
14-26: LGTM!The TYPE_CHECKING imports have been correctly converted to absolute paths (
strawchemy.strawberry.dtoandstrawchemy.validation.pydantic). The newly imported types (GraphQLFieldDefinition,QueryNodeMetadata,StrawchemyDTOAttributes,MappedPydanticGraphQLDTO) are properly used in the type aliases defined later in the file (lines 67-75).src/strawchemy/sqlalchemy/repository/_async.py (2)
12-12: LGTM!The runtime import of
InsertData,MutationData, andSQLAlchemyGraphQLRepositoryfrom the absolute pathstrawchemy.sqlalchemy.repository._baseis correct and consistent with the PR's objective.
24-24: LGTM!The TYPE_CHECKING import of
InsertOrUpdateandRowLikecorrectly uses the absolute path.src/strawchemy/sqlalchemy/_transpiler.py (2)
38-65: LGTM!The runtime imports have been correctly converted to absolute paths:
strawchemy.sqlalchemy._executor,_query,_scope,exceptions,inspector,typingstrawchemy.strawberry.dtoandstrawchemy.strawberry.filtersThe import structure is clean and consistent.
75-75: LGTM!The TYPE_CHECKING import of
QueryHookcorrectly uses the absolute pathstrawchemy.sqlalchemy.hook.src/strawchemy/strawberry/_field.py (3)
29-29: LGTM!The import of
dto_model_from_type,strawberry_contained_types, andstrawberry_contained_user_typecorrectly uses the absolute pathstrawchemy.strawberry._utils.
37-39: LGTM!The imports of
StrawchemyFieldErrorandStrawchemyAsyncRepositorycorrectly use absolute paths.StrawchemyAsyncRepositoryis appropriately imported at runtime as it's used inisinstancechecks.
58-68: LGTM!The expanded TYPE_CHECKING imports correctly use absolute paths and bring in types that are used in method signatures and type aliases throughout the file (
ValidationErrorType,StrawchemySyncRepository,GraphQLResult,AnyMappedDTO,FilterStatementCallable,MappedGraphQLDTO,StrawchemyTypeWithStrawberryObjectDefinition,AnyRepository,ValidationProtocol).src/strawchemy/typing.py (1)
10-10: LGTM!The TYPE_CHECKING import correctly uses the absolute path
from strawchemy import StrawchemyAsyncRepository, StrawchemySyncRepository. This assumes these classes are re-exported from the package's__init__.py, which aligns with the PR's broader import restructuring.src/strawchemy/mapper.py (2)
10-34: LGTM!The runtime imports have been correctly converted to absolute paths across all strawchemy submodules (
strawchemy.config.base,strawchemy.dto.*,strawchemy.strawberry.*,strawchemy.types). The import structure is clean and well-organized.
45-49: LGTM!The expanded TYPE_CHECKING imports correctly use absolute paths and bring in types used throughout the class methods and overloaded signatures (
QueryHookCallable,FilterStatementCallable,MappedGraphQLDTO,AnyRepository,SupportedDialect,ValidationProtocol).src/strawchemy/__init__.py (1)
5-20: All imports are correct and properly use absolute paths.Verified that all 13 imported symbols exist in their target modules and no import errors would occur. The absolute imports align with Python best practices and the Ruff configuration objective of disallowing relative imports.
| ] | ||
| dependencies = [ | ||
| "msgspec", | ||
| "msgspec>=0.4.2", |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# Search for msgspec usage in Python files
rg -n "msgspec" --type=py -B2 -A3Repository: gazorby/strawchemy
Length of output: 2507
🏁 Script executed:
# Also check the full pyproject.toml for context around the dependency
cat -n pyproject.toml | grep -A5 -B5 msgspecRepository: gazorby/strawchemy
Length of output: 880
🏁 Script executed:
# Check if there's a changelog or release notes that might document version requirements
git log --oneline -n 20 -- pyproject.toml | head -20Repository: gazorby/strawchemy
Length of output: 111
Correct msgspec minimum version constraint to reflect actual requirements.
The msgspec.convert function was introduced in version 0.16.0 to replace the deprecated from_builtins. However, the code imports and uses msgspec.convert in repository/_base.py, yet the constraint specifies msgspec>=0.4.2, which does not include this function. Update the constraint to msgspec>=0.16.0 to match the actual minimum version required by the codebase.
🤖 Prompt for AI Agents
In pyproject.toml at line 32, the msgspec dependency is incorrectly constrained
as "msgspec>=0.4.2" while the codebase uses msgspec.convert (introduced in
0.16.0); update the constraint to "msgspec>=0.16.0" so the declared minimum
version matches the actual required API, then run a quick dependency
install/check (pip or poetry) to verify no other version conflicts.
| An instance of PydanticMapper. | ||
| """ | ||
| from .validation.pydantic import PydanticMapper # noqa: PLC0415 | ||
| from strawchemy.validation.pydantic import PydanticMapper # noqa: PLC0415 |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Remove unused noqa directive.
The # noqa: PLC0415 comment suppresses the "import not at top of file" rule, but static analysis indicates this rule is not enabled in your Ruff configuration. The lazy import pattern itself is valid and intentional to avoid circular imports.
🔎 Apply this diff to remove the unused directive:
- from strawchemy.validation.pydantic import PydanticMapper # noqa: PLC0415
+ from strawchemy.validation.pydantic import PydanticMapper📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| from strawchemy.validation.pydantic import PydanticMapper # noqa: PLC0415 | |
| from strawchemy.validation.pydantic import PydanticMapper |
🧰 Tools
🪛 Ruff (0.14.8)
159-159: Unused noqa directive (non-enabled: PLC0415)
Remove unused noqa directive
(RUF100)
🤖 Prompt for AI Agents
In src/strawchemy/mapper.py around line 159, the inline comment "# noqa:
PLC0415" on the lazy import is unnecessary; remove the " # noqa: PLC0415" suffix
so the line becomes a plain lazy import (keep the import in place to avoid
circular import issues) and save the file.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #136 +/- ##
==========================================
- Coverage 94.37% 94.33% -0.05%
==========================================
Files 63 63
Lines 5833 5838 +5
Branches 775 776 +1
==========================================
+ Hits 5505 5507 +2
- Misses 186 189 +3
Partials 142 142 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
pyproject.toml (1)
32-32: This issue was already flagged in a previous review.The msgspec version constraint should be updated to
>=0.16.0since the codebase usesmsgspec.convert, which was introduced in that version.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
pyproject.toml(2 hunks)src/strawchemy/dto/types.py(2 hunks)src/strawchemy/sqlalchemy/repository/_base.py(2 hunks)tests/integration/types/__init__.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/strawchemy/dto/types.py (2)
src/strawchemy/dto/base.py (1)
get_type_hints(242-242)src/strawchemy/dto/inspectors/sqlalchemy.py (1)
get_type_hints(278-285)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
- GitHub Check: 🔬 integration-sqlite on 3.12
- GitHub Check: 🔬 integration-mysql on 3.14
- GitHub Check: 🔬 integration-mysql on 3.11
- GitHub Check: 🔬 integration-sqlite on 3.11
- GitHub Check: 🔬 integration-postgres on 3.14
- GitHub Check: 🔬 integration-sqlite on 3.10
- GitHub Check: 🔬 integration-sqlite on 3.14
- GitHub Check: 🔬 integration-sqlite on 3.13
- GitHub Check: 🔬 integration-mysql on 3.13
- GitHub Check: 🔬 unit-no-extras on 3.11
- GitHub Check: 🔬 integration-postgres on 3.12
- GitHub Check: 🔬 unit-no-extras on 3.12
- GitHub Check: 🔬 unit on 3.12
- GitHub Check: 🔬 unit-no-extras on 3.13
- GitHub Check: 🔬 integration-postgres on 3.13
- GitHub Check: 🔬 unit-no-extras on 3.10
- GitHub Check: 🔬 unit-no-extras on 3.14
- GitHub Check: 🔬 unit on 3.13
- GitHub Check: 🔬 unit on 3.10
- GitHub Check: Optimize new code in this PR
🔇 Additional comments (8)
pyproject.toml (1)
378-379: Good practice to ban relative imports.This configuration aligns with the PR objective and improves code maintainability by enforcing absolute imports throughout the codebase. Verification confirms no relative imports remain in the codebase.
src/strawchemy/dto/types.py (2)
8-8: LGTM: get_type_hints import is necessary.The import of
get_type_hintsfrom typing is required for thewith_base_annotationsmethod at line 239, where it's used to extract type annotations from base classes with proper forward reference resolution.
23-24: LGTM: Modern string-literal TypeAlias syntax.The conversion to string-literal TypeAlias with pipe union syntax is consistent with PEP 563 (enabled via
from __future__ import annotationson line 3) and modern Python typing practices. These aliases are used purely for type annotations and will be correctly handled by type checkers.tests/integration/types/__init__.py (3)
3-3: LGTM: Union import correctly removed.Since the type aliases now use pipe syntax within string literals, the
Unionimport is no longer necessary. This change is consistent with the refactoring to modern Python typing syntax.
9-12: LGTM: Improved TypeAlias readability and consistency.The conversion from nested
Uniontypes to string-literal TypeAlias with pipe syntax improves readability and modernizes the codebase. The flattened union syntax (e.g.,"postgres.AsyncQuery | mysql.AsyncQuery | sqlite.AsyncQuery") is clearer than the previous nested Union form. These will be correctly evaluated by type checkers thanks to PEP 563.
5-5: The absolute import path is correct and all submodules exist. Submodules mysql.py, postgres.py, and sqlite.py are located in tests/integration/types/, and the full package hierarchy with init.py files is properly configured. With init.py files arranged as packages, pytest resolves the full package name correctly, allowing the absolute importfrom tests.integration.types import mysql, postgres, sqliteto work as intended. The change successfully achieves the PR objective to disallow relative imports.src/strawchemy/sqlalchemy/repository/_base.py (2)
6-6: LGTM: Import cleanup aligns with union syntax modernization.The removal of
Unionfrom the typing imports is correct, as the file now uses the modern|union syntax at line 40.
40-40: Type alias union syntax is compatible with project requirements.The change from
Union[type[DeclarativeBase], Table]totype[DeclarativeBase] | Tableis appropriate. The project requires Python 3.10+ (requires-python = ">=3.10"in pyproject.toml), which fully supports PEP 604 union syntax. The modernization is valid.
|
|
||
| [tool.ruff.lint.per-file-ignores] | ||
| "tests/*" = ["TC001", "UP037", "PLR2004", "PLC0415"] | ||
| "src/strawchemy/strawberry/factories/*" = ["UP007", "UP045"] |
There was a problem hiding this comment.
Remove redundant per-file ignore configuration.
The rules UP007 and UP045 are already globally ignored at lines 359-360, making this per-file ignore redundant. The global ignores already apply to src/strawchemy/strawberry/factories/*.
🔎 Apply this diff to remove the redundant configuration:
-"src/strawchemy/strawberry/factories/*" = ["UP007", "UP045"]📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "src/strawchemy/strawberry/factories/*" = ["UP007", "UP045"] |
🤖 Prompt for AI Agents
In pyproject.toml around line 373, remove the redundant per-file ignore entry
""src/strawchemy/strawberry/factories/*" = ["UP007", "UP045"]" because UP007 and
UP045 are already globally ignored at lines 359-360; simply delete this line to
avoid duplication and keep global ignores only.
Description
Types of Changes
Issues Fixed or Closed by This PR
Checklist
Summary by CodeRabbit
New Features
Dependencies
Chores
Refactor
Tests
✏️ Tip: You can customize this high-level summary in your review settings.