Refactor: integrate Flask app into top-level package#50
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the project structure by moving the sample_registry package from src/sample_registry to the repository root, eliminating the src layout. The changes update import paths throughout the codebase and adjust configuration to support the new package location.
Key changes:
- Updated all import statements to reference
sample_registrydirectly instead ofsrc.sample_registry - Fixed SQLite database path calculation for the relocated package structure
- Added Flask dependencies and package data configuration to support the integrated Flask app
Reviewed Changes
Copilot reviewed 7 out of 37 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/test_util.py | Updated import path from src.sample_registry.util to sample_registry.util |
| tests/test_registrar.py | Updated all imports to remove src. prefix from sample_registry modules |
| tests/test_register.py | Updated all imports to remove src. prefix from sample_registry modules |
| tests/test_mapping.py | Updated import path from src.sample_registry.mapping to sample_registry.mapping |
| sample_registry/init.py | Fixed SQLite database path calculation for new package location |
| pyproject.toml | Added Flask dependencies and package data configuration for templates/static files |
| app/init.py | Removed entire file content that was importing from sample_registry |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| "Missing database connection information in environment, using test SQLite database\n" | ||
| ) | ||
| SQLALCHEMY_DATABASE_URI = f"sqlite:///{Path(__file__).parent.parent.parent.parent.parent.resolve()}/sample_registry.sqlite3" | ||
| SQLALCHEMY_DATABASE_URI = f"sqlite:///{Path(__file__).parent.parent.resolve()}/sample_registry.sqlite3" |
There was a problem hiding this comment.
The path calculation uses multiple .parent calls which is fragile and hard to understand. Consider using a more explicit approach like Path.cwd() or defining a constant for the project root directory.
Summary
sample_registrypackage fromsrcinto repository rootsrclayout is goneTesting
pytest -qhttps://chatgpt.com/codex/tasks/task_e_68c385a656ec8323b6283b6c24eba7e1