refactor: remove src/ directory layer from all workspace packages - #8
Merged
Conversation
The src-layout adds unnecessary depth in a uv-managed monorepo workspace.
Paths like modules/products/src/sm_products/module.py become
modules/products/sm_products/module.py — one fewer directory level to
navigate. Hatchling auto-detects flat layout when src/ is absent, so no
pyproject.toml build config changes are needed.
Changes:
- Move all package dirs from {pkg}/src/{name}/ to {pkg}/{name}/
- Update ty extra-paths in root pyproject.toml (drop /src suffix)
- Fix relative path traversals in app_builder.py (one fewer parent dir)
https://claude.ai/code/session_01Fi5iPfiDg7YLggyzS7VgLpNew files added in main under the old src/ paths (inertia_utils.py, permissions.py, validation.ts) are placed at the flat-layout locations. app_builder.py auto-merged cleanly, preserving the corrected relative paths. https://claude.ai/code/session_01Fi5iPfiDg7YLggyzS7VgLp
…th resolution
- pages.ts: update glob pattern and regex to match flat layout
- tsconfig.json: update include paths for modules (no src/)
- biome.json: update file includes for modules (no src/)
- app_builder.py: replace fragile os.path.join("..", "..") chains with
a single _PROJECT_ROOT constant using pathlib; remove unused os import
https://claude.ai/code/session_01Fi5iPfiDg7YLggyzS7VgLpMulti-line function parameters and trailing newline cleanup. https://claude.ai/code/session_01Fi5iPfiDg7YLggyzS7VgLp
antosubash pushed a commit
that referenced
this pull request
Apr 14, 2026
Updates the scaffolding to match PR #8's layout change that removed the src/ directory from all workspace packages: - Generate files at modules/<name>/sm_<name>/ instead of modules/<name>/src/sm_<name>/ - Update root pyproject.toml to insert modules/<name> in ty paths (no /src suffix) - Rewrite insertion helpers with cleaner regex-based approach that correctly handles the new host/pyproject.toml structure with multiple sm-* dependencies https://claude.ai/code/session_01G5HHXJfxAQ53grAwiyUzyj
antosubash pushed a commit
that referenced
this pull request
Apr 14, 2026
…t-delete) - Drop src/ directory layer in path references (main #8) - Keep our Request/Response imports (RedirectResponse no longer used after removing old redirect workaround) - Update pages.ts glob to match new module layout without src/ https://claude.ai/code/session_01TcCi9nT9jkWrXfByuqzDVs
antosubash added a commit
that referenced
this pull request
Apr 14, 2026
* feat: add module scaffolding CLI (make new-module name=<name>) Automates new module creation, eliminating the need to manually create 14+ files and update config. The script generates the full module structure (pyproject.toml, module class, models, service, schemas, contracts, endpoints, deps, tests) and registers the module in host/pyproject.toml and root pyproject.toml. Also updates conftest.py to auto-discover module Base classes via entry points, so new modules' tables are automatically created in the test database. https://claude.ai/code/session_01G5HHXJfxAQ53grAwiyUzyj * refactor: simplify scaffolding code from review findings - conftest.py: reuse framework's discover_modules() + all_module_bases instead of reimplementing entry point discovery; cache with lru_cache; batch create_all into single run_sync; extract _create_all_tables helper - new_module.py: replace hardcoded anchor strings with last-entry insertion via _insert_before_last(); add warnings on missing anchors - test_new_module.py: extract repeated setup into module_root fixture https://claude.ai/code/session_01G5HHXJfxAQ53grAwiyUzyj * fix: adapt scaffolding to new layout without src/ directory Updates the scaffolding to match PR #8's layout change that removed the src/ directory from all workspace packages: - Generate files at modules/<name>/sm_<name>/ instead of modules/<name>/src/sm_<name>/ - Update root pyproject.toml to insert modules/<name> in ty paths (no /src suffix) - Rewrite insertion helpers with cleaner regex-based approach that correctly handles the new host/pyproject.toml structure with multiple sm-* dependencies https://claude.ai/code/session_01G5HHXJfxAQ53grAwiyUzyj * test: expand scaffolding test coverage from 23 to 49 tests Adds coverage for previously untested code paths and behaviors: - _insert_after_last_match helper: 4 direct unit tests - create_file utility: 3 tests (content, parent dir creation, dedent) - main() CLI entry point: 2 tests (happy path + invalid name) - End-to-end subprocess test: verifies script runs standalone New TestUpdateRootPyproject cases: - Realistic multi-module pyproject.toml matching real repo - Skips when already present - Warns to stderr when no insertion point found New TestGeneratedFilesSyntaxValidity: - All generated Python files parse with ast.parse - Generated pyproject.toml parses with tomllib - Compound names (blog_posts) produce valid TOML New TestGeneratedTemplateContent covers: - service.py has full CRUD methods - endpoints/api.py has all REST endpoints with correct status codes - endpoints/views.py uses Inertia properly - deps.py provides DI function - contracts/service.py defines Protocol - contracts/__init__.py exports public API - module.py registers routes and permissions - models.py uses AuditMixin with correct tablename - test_<name>.py contains all expected test classes https://claude.ai/code/session_01G5HHXJfxAQ53grAwiyUzyj * refactor: simplify scaffolding tests from review findings - Add scaffolded_orders fixture: scaffold_module() now runs once per test rather than 10x in TestGeneratedTemplateContent - Add workspace fixture: deduplicates the host/pyproject + root pyproject setup between TestMainCLI tests - Extract MINIMAL_HOST_PYPROJECT and MINIMAL_ROOT_PYPROJECT constants - TestCreateFile: replace inline monkeypatch with the existing module_root fixture (3 tests collapsed to clean one-liners) - TestScaffoldModule: use scaffolded_orders fixture; eliminate repeated `module_root / "modules" / "orders" / "sm_orders"` path strings - TestGeneratedFilesSyntaxValidity: reuse scaffolded_orders for the orders-based tests - Drop TestCLIAsSubprocess: TestMainCLI::test_main_invokes_full_pipeline with capsys covers the same ground without a subprocess fork - Move `import new_module` to module level (reused by all fixtures) - Strip narrative comments 49 tests → 48 tests, suite time 0.58s → 0.42s
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The src-layout adds unnecessary depth in a uv-managed monorepo workspace.
Paths like modules/products/src/sm_products/module.py become
modules/products/sm_products/module.py — one fewer directory level to
navigate. Hatchling auto-detects flat layout when src/ is absent, so no
pyproject.toml build config changes are needed.
Changes:
https://claude.ai/code/session_01Fi5iPfiDg7YLggyzS7VgLp