-
Notifications
You must be signed in to change notification settings - Fork 1
refactor(ruff): disallow relative imports #136
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -29,7 +29,7 @@ classifiers = [ | |||
| "Typing :: Typed", | ||||
| ] | ||||
| dependencies = [ | ||||
| "msgspec", | ||||
| "msgspec>=0.4.2", | ||||
| "sqlalchemy>=2.0.10", | ||||
| "strawberry-graphql", | ||||
| "typing-extensions" | ||||
|
|
@@ -370,10 +370,13 @@ convention = "google" | |||
|
|
||||
| [tool.ruff.lint.per-file-ignores] | ||||
| "tests/*" = ["TC001", "UP037", "PLR2004", "PLC0415"] | ||||
| "src/strawchemy/strawberry/factories/*" = ["UP007", "UP045"] | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove redundant per-file ignore configuration. The rules 🔎 Apply this diff to remove the redundant configuration:-"src/strawchemy/strawberry/factories/*" = ["UP007", "UP045"]📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||
|
|
||||
| [tool.ruff.lint.isort] | ||||
| known-first-party = ["strawchemy", "tests"] | ||||
|
|
||||
| [tool.ruff.lint.flake8-tidy-imports] | ||||
| ban-relative-imports = "all" | ||||
|
|
||||
| [tool.unasyncd] | ||||
| add_editors_note = true | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -7,32 +7,31 @@ | |||||
| from strawberry.annotation import StrawberryAnnotation | ||||||
| from strawberry.schema.config import StrawberryConfig | ||||||
|
|
||||||
| from strawchemy.strawberry.factories.aggregations import EnumDTOFactory | ||||||
| from strawchemy.strawberry.factories.enum import EnumDTOBackend, UpsertConflictFieldsEnumDTOBackend | ||||||
|
|
||||||
| from .config.base import StrawchemyConfig | ||||||
| from .dto.backend.strawberry import StrawberrryDTOBackend | ||||||
| from .dto.base import TYPING_NS | ||||||
| from .strawberry._field import ( | ||||||
| from strawchemy.config.base import StrawchemyConfig | ||||||
| from strawchemy.dto.backend.strawberry import StrawberrryDTOBackend | ||||||
| from strawchemy.dto.base import TYPING_NS | ||||||
| from strawchemy.strawberry._field import ( | ||||||
| StrawchemyCreateMutationField, | ||||||
| StrawchemyDeleteMutationField, | ||||||
| StrawchemyField, | ||||||
| StrawchemyUpdateMutationField, | ||||||
| StrawchemyUpsertMutationField, | ||||||
| ) | ||||||
| from .strawberry._registry import StrawberryRegistry | ||||||
| from .strawberry.dto import BooleanFilterDTO, EnumDTO, MappedStrawberryGraphQLDTO, OrderByDTO, OrderByEnum | ||||||
| from .strawberry.factories.inputs import AggregateFilterDTOFactory, BooleanFilterDTOFactory | ||||||
| from .strawberry.factories.types import ( | ||||||
| from strawchemy.strawberry._registry import StrawberryRegistry | ||||||
| from strawchemy.strawberry.dto import BooleanFilterDTO, EnumDTO, MappedStrawberryGraphQLDTO, OrderByDTO, OrderByEnum | ||||||
| from strawchemy.strawberry.factories.aggregations import EnumDTOFactory | ||||||
| from strawchemy.strawberry.factories.enum import EnumDTOBackend, UpsertConflictFieldsEnumDTOBackend | ||||||
| from strawchemy.strawberry.factories.inputs import AggregateFilterDTOFactory, BooleanFilterDTOFactory | ||||||
| from strawchemy.strawberry.factories.types import ( | ||||||
| DistinctOnFieldsDTOFactory, | ||||||
| InputFactory, | ||||||
| OrderByDTOFactory, | ||||||
| RootAggregateTypeDTOFactory, | ||||||
| TypeDTOFactory, | ||||||
| UpsertConflictFieldsDTOFactory, | ||||||
| ) | ||||||
| from .strawberry.mutation import types | ||||||
| from .types import DefaultOffsetPagination | ||||||
| from strawchemy.strawberry.mutation import types | ||||||
| from strawchemy.types import DefaultOffsetPagination | ||||||
|
|
||||||
| if TYPE_CHECKING: | ||||||
| from collections.abc import Callable, Mapping, Sequence | ||||||
|
|
@@ -43,13 +42,12 @@ | |||||
|
|
||||||
| from strawberry import BasePermission | ||||||
| from strawchemy.sqlalchemy.hook import QueryHook | ||||||
| from strawchemy.sqlalchemy.typing import QueryHookCallable | ||||||
| from strawchemy.strawberry.typing import FilterStatementCallable, MappedGraphQLDTO | ||||||
| from strawchemy.typing import AnyRepository, SupportedDialect | ||||||
| from strawchemy.validation.base import ValidationProtocol | ||||||
| from strawchemy.validation.pydantic import PydanticMapper | ||||||
|
|
||||||
| from .sqlalchemy.typing import QueryHookCallable | ||||||
| from .strawberry.typing import FilterStatementCallable, MappedGraphQLDTO | ||||||
| from .typing import AnyRepository, SupportedDialect | ||||||
| from .validation.base import ValidationProtocol | ||||||
|
|
||||||
|
|
||||||
| T = TypeVar("T", bound="DeclarativeBase") | ||||||
|
|
||||||
|
|
@@ -158,7 +156,7 @@ def pydantic(self) -> PydanticMapper: | |||||
| Returns: | ||||||
| An instance of PydanticMapper. | ||||||
| """ | ||||||
| from .validation.pydantic import PydanticMapper # noqa: PLC0415 | ||||||
| from strawchemy.validation.pydantic import PydanticMapper # noqa: PLC0415 | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Remove unused The 🔎 Apply this diff to remove the unused directive:- from strawchemy.validation.pydantic import PydanticMapper # noqa: PLC0415
+ from strawchemy.validation.pydantic import PydanticMapper📝 Committable suggestion
Suggested change
🧰 Tools🪛 Ruff (0.14.8)159-159: Unused Remove unused (RUF100) 🤖 Prompt for AI Agents |
||||||
|
|
||||||
| return PydanticMapper(self) | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: gazorby/strawchemy
Length of output: 2507
🏁 Script executed:
Repository: gazorby/strawchemy
Length of output: 880
🏁 Script executed:
Repository: gazorby/strawchemy
Length of output: 111
Correct msgspec minimum version constraint to reflect actual requirements.
The
msgspec.convertfunction was introduced in version 0.16.0 to replace the deprecatedfrom_builtins. However, the code imports and usesmsgspec.convertinrepository/_base.py, yet the constraint specifiesmsgspec>=0.4.2, which does not include this function. Update the constraint tomsgspec>=0.16.0to match the actual minimum version required by the codebase.🤖 Prompt for AI Agents