Skip to content

Commit d216da6

Browse files
committed
style: improve import formatting and increase line length to 120
Configuration Changes: - Increase ruff line-length from 100 to 120 characters - Increase isort line_length to 120 to match - Set force_grid_wrap = 0 to allow single imports on one line - Keep vertical hanging indent for multi-line imports Import Formatting Changes: - Single imports now use: from module import Item - Multiple imports use hanging indent with parentheses: from module import ( Item1, Item2, ) Files Updated: - pyproject.toml: Updated ruff and isort configuration - python/rivet_di/__init__.py: Single-line imports - python/rivet_di/container.py: Single-line imports - python/rivet_di/decorators.py: Mixed single/multi-line imports - python/rivet_di/scope.py: Single-line import - python/rivet_di/_rivet_core.pyi: Single-line imports This provides cleaner, more readable imports while maintaining consistency with Black formatting style for multi-line cases.
1 parent 9d7846d commit d216da6

File tree

6 files changed

+16
-35
lines changed

6 files changed

+16
-35
lines changed

pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ ignore_missing_imports = true
7878

7979
[tool.ruff]
8080
target-version = "py311"
81-
line-length = 100
81+
line-length = 120
8282

8383
[tool.ruff.lint]
8484
select = [
@@ -105,12 +105,14 @@ docstring-code-format = true
105105

106106
[tool.isort]
107107
profile = "black"
108-
line_length = 100
108+
line_length = 120
109109
multi_line_output = 3 # Vertical Hanging Indent
110110
include_trailing_comma = true
111-
force_grid_wrap = 1
111+
force_grid_wrap = 0 # Disable forced grid wrap - use only when needed
112112
use_parentheses = true
113113
ensure_newline_before_comments = true
114+
# Single imports should be on one line: from module import Item
115+
# Multiple imports use hanging indent with parentheses
114116

115117
[tool.coverage.run]
116118
branch = true

python/rivet_di/__init__.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
"""rivet-di: Fast, Rust-backed declarative dependency injection for Python."""
22

3-
from rivet_di.container import (
4-
Container,
5-
)
6-
from rivet_di.decorators import (
7-
component,
8-
)
9-
from rivet_di.scope import (
10-
Scope,
11-
)
3+
from .container import Container
4+
from .decorators import component
5+
from .scope import Scope
126

137
__version__ = '0.1.0'
148
__all__ = [

python/rivet_di/_rivet_core.pyi

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
"""Type stubs for Rust core module."""
22

3-
from collections.abc import (
4-
Callable,
5-
)
6-
from typing import (
7-
TypeVar,
8-
)
3+
from collections.abc import Callable
4+
from typing import TypeVar
95

106
T = TypeVar('T')
117

python/rivet_di/container.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
"""Dependency injection container."""
22

3-
from collections.abc import (
4-
Callable,
5-
)
6-
from typing import (
7-
TypeVar,
8-
)
3+
from collections.abc import Callable
4+
from typing import TypeVar
95

106
from rivet_di._rivet_core import Container as RustContainer
117

python/rivet_di/decorators.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
"""Decorator for marking classes as DI components."""
22

3-
from typing import (
4-
Any,
5-
TypeVar,
6-
)
7-
8-
from rivet_di.scope import (
9-
Scope,
10-
)
3+
from typing import Any, TypeVar
4+
5+
from rivet_di.scope import Scope
116

127
T = TypeVar('T')
138

python/rivet_di/scope.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
"""Dependency injection scopes."""
22

3-
from enum import (
4-
Enum,
5-
)
3+
from enum import Enum
64

75

86
class Scope(str, Enum):

0 commit comments

Comments
 (0)