You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .kiro/specs/black-to-ruff-migration/design.md
+34-33Lines changed: 34 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,25 +28,32 @@ Ruff will be configured in `pyproject.toml` using the `[tool.ruff]` section with
28
28
29
29
#### pyproject.toml Updates
30
30
31
+
**Rationale**: Centralizing all tool configuration in pyproject.toml follows Python packaging standards and simplifies maintenance.
32
+
31
33
- Remove `[tool.black]` section
32
34
- Remove `[tool.isort]` section
33
35
- Add comprehensive `[tool.ruff]` configuration
34
36
- Add Ruff as a development dependency in the "# Development & Debugging" section alongside django-debug-toolbar
37
+
- Remove Black and isort from dependencies if present
35
38
36
39
#### Pre-commit Configuration Updates
37
40
41
+
**Rationale**: Maintaining pre-commit integration ensures code quality checks remain automated and consistent across the development team.
42
+
38
43
- Replace Black hook (currently using psf/black rev 23.3.0) with Ruff formatter hook
39
44
- Replace isort hook (currently using pycqa/isort rev 5.12.0) with Ruff import sorting hook
40
45
- Maintain existing exclusion patterns for migrations and .vscode folders
41
46
- Keep all other pre-commit hooks unchanged (trailing-whitespace, end-of-file-fixer, etc.)
42
47
43
48
#### Documentation Updates
44
49
50
+
**Rationale**: Comprehensive documentation updates ensure all team members and new contributors understand the current tooling and maintain consistency across the project.
51
+
45
52
- Update `.kiro/steering/tech.md` Code Quality Tools section to reference Ruff instead of Black and isort
46
53
- Update `.kiro/steering/structure.md` Development Conventions section to reference Ruff formatting
47
54
- Check and update `README.md` if it contains references to Black or isort
48
55
- Update any developer setup instructions to include Ruff-specific commands
49
-
- Ensure all documentation maintains consistency with Ruff usage and 79-character line length
56
+
- Ensure all documentation maintains consistency with Ruff usage
50
57
51
58
### Ruff Configuration Sections
52
59
@@ -56,39 +63,15 @@ Based on the current Black and isort configuration, Ruff will be configured as f
**Rationale**: Django-aware import sorting maintains the existing project's import organization patterns while leveraging Ruff's performance benefits. This ensures proper separation of Django imports from other third-party libraries, maintaining the project's existing import organization standards.
@@ -119,11 +102,15 @@ No data models are affected by this migration as it only changes development too
119
102
120
103
### Validation Steps
121
104
105
+
**Rationale**: These validation steps ensure the migration maintains code quality and formatting consistency while verifying all requirements are met.
106
+
122
107
1. Install Ruff and configure in pyproject.toml
123
-
2. Run `ruff format --check` on codebase to verify compatibility
124
-
3. Run `ruff check --select I` to test import sorting
125
-
4. Test pre-commit hooks in isolated environment
126
-
5. Compare output with existing Black/isort formatting
108
+
2. Run `docker compose run --rm app uv run ruff format --check .` on codebase to verify compatibility (respects pyproject.toml settings)
109
+
3. Run `docker compose run --rm app uv run ruff check --select I .` to test import sorting (respects pyproject.toml settings)
110
+
4. Test pre-commit hooks in containerized environment using `docker compose run --rm app pre-commit run --all-files`
111
+
5. Compare output with existing Black/isort formatting to ensure consistency
112
+
6. Verify uv commands work correctly with Ruff (addresses Requirement 4.4)
113
+
7. Confirm migrations are properly excluded from formatting and linting
127
114
128
115
### Performance Verification
129
116
@@ -134,9 +121,11 @@ No data models are affected by this migration as it only changes development too
134
121
135
122
### Dependency Management
136
123
137
-
- Ruff will be added to the "# Development & Debugging" section in pyproject.toml dependencies (following the existing organizational pattern where development tools like django-debug-toolbar are grouped)
138
-
- Black and isort configurations will be removed from pyproject.toml (they are not explicitly listed as dependencies, only configured)
139
-
- uv will handle Ruff installation and version management
124
+
**Rationale**: Proper dependency management ensures Ruff is available in all development environments and follows the project's existing organizational patterns.
125
+
126
+
- Ruff will be added to the "# Development & Debugging" section in pyproject.toml dependencies (addresses Requirement 4.1, 4.3)
127
+
- Black and isort configurations will be removed from pyproject.toml (addresses Requirement 4.2)
128
+
- uv will handle Ruff installation and version management (addresses Requirement 4.4)
140
129
- Ruff will be placed appropriately within the development tools section to maintain logical grouping
141
130
142
131
### Backward Compatibility
@@ -150,3 +139,15 @@ No data models are affected by this migration as it only changes development too
150
139
- Developers will need to update their local pre-commit hooks
151
140
- IDE integrations may need to be updated to use Ruff instead of Black
152
141
- Documentation will guide developers through the transition
142
+
143
+
## Requirements Traceability
144
+
145
+
This design addresses all requirements from the requirements document:
146
+
147
+
**Requirement 1 (Tool Replacement)**: Addressed through pyproject.toml configuration sections that replace Black and isort with Ruff while maintaining migration exclusions, and Django-aware import sorting.
148
+
149
+
**Requirement 2 (Pre-commit Integration)**: Addressed through pre-commit configuration updates that replace Black and isort hooks with Ruff equivalents while maintaining existing exclusion patterns.
150
+
151
+
**Requirement 3 (Documentation Updates)**: Addressed through systematic updates to steering documents, README, and developer setup instructions to reflect Ruff usage consistently.
152
+
153
+
**Requirement 4 (Dependency Management)**: Addressed through adding Ruff to development dependencies and removing Black/isort configurations, with uv handling installation and version management.
Copy file name to clipboardExpand all lines: .kiro/specs/black-to-ruff-migration/requirements.md
+5-7Lines changed: 5 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,15 +14,14 @@ This feature involves migrating the We All Code Django project from using Black
14
14
15
15
1. WHEN the project is configured THEN Ruff SHALL replace Black as the code formatter
16
16
2. WHEN the project is configured THEN Ruff SHALL replace isort for import sorting
17
-
3. WHEN Ruff is configured THEN it SHALL maintain the existing 79-character line length
18
-
4. WHEN Ruff is configured THEN it SHALL exclude migrations from formatting (same as current Black config)
19
-
5. WHEN Ruff is configured THEN it SHALL maintain Django-aware import sorting sections
17
+
3. WHEN Ruff is configured THEN it SHALL exclude migrations from formatting (same as current Black config)
18
+
4. WHEN Ruff is configured THEN it SHALL maintain Django-aware import sorting sections with proper separation of Django imports from other third-party libraries
20
19
21
20
### Requirement 2: Pre-commit Integration
22
21
23
22
**User Story:** As a developer, I want the pre-commit hooks updated to use Ruff, so that code quality checks run automatically before commits.
24
23
25
-
#### Pre-commit Acceptance Criteria
24
+
#### Acceptance Criteria
26
25
27
26
1. WHEN pre-commit hooks are updated THEN they SHALL use Ruff instead of Black and isort
28
27
2. WHEN pre-commit runs THEN it SHALL format code using Ruff
@@ -33,20 +32,19 @@ This feature involves migrating the We All Code Django project from using Black
33
32
34
33
**User Story:** As a developer, I want all project documentation updated to reflect the Ruff migration, so that new contributors understand the current tooling and existing developers have accurate reference materials.
35
34
36
-
#### Documentation Acceptance Criteria
35
+
#### Acceptance Criteria
37
36
38
37
1. WHEN documentation is updated THEN .kiro/steering/tech.md SHALL reference Ruff instead of Black and isort in the Code Quality Tools section
39
38
2. WHEN documentation is updated THEN .kiro/steering/structure.md SHALL reference Ruff formatting conventions instead of Black
40
39
3. WHEN documentation is updated THEN README.md SHALL be updated if it contains references to Black or isort
41
40
4. WHEN documentation is updated THEN any developer setup instructions SHALL include Ruff-specific commands
42
41
5. WHEN documentation is updated THEN all references to code formatting tools SHALL be consistent with Ruff usage
43
-
6. WHEN documentation is updated THEN it SHALL maintain accuracy about the 79-character line length requirement
44
42
45
43
### Requirement 4: Dependency Management
46
44
47
45
**User Story:** As a developer, I want Ruff to be added as a project dependency, so that it's available in the development environment.
48
46
49
-
#### Dependency Acceptance Criteria
47
+
#### Acceptance Criteria
50
48
51
49
1. WHEN dependencies are updated THEN Ruff SHALL be added to pyproject.toml
52
50
2. WHEN dependencies are updated THEN Black and isort SHALL be removed from dependencies (if present)
0 commit comments