refactor: separate shared “core” code from FastAPI server modules #137
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.
Overview
This PR finishes our repository reorganization so that shared “core” logic resides in a
core/
subpackage, the FastAPI app code is underserver/
, and the CLI remains ingitingest/
. This clarifies which modules are CLI-specific vs. server-specific vs. general-purpose, and also preserves top-level exports for users who doimport gitingest
.Key Changes
core/
config.py
,exceptions.py
,ignore_patterns.py
,notebook_utils.py
,query_ingestion.py
,query_parser.py
,repository_clone.py
,repository_ingest.py
, andutils.py
.core/__init__.py
is no longer exporting public APIs directly, so it’s effectively internal.server/
main.py
,query_processor.py
,server_utils.py
,routers/
, plusstatic/
andtemplates/
./server/static
and/server/templates
inmain.py
, Jinja code, and the routers, ensuring Docker can properly serve them.gitingest/
cli.py
).gitingest/__init__.py
, soimport gitingest
still providesrun_ingest_query
,parse_query
,clone_repo
, andingest
.Tests
gitingest.*
tocore.*
orserver.*
as appropriate.Docker Compatibility
docker build -t gitingest .
thendocker run -d --name gitingest -p 8000:8000 gitingest
successfully serves the FastAPI app athttp://localhost:8000/
, loading static files and templates fromserver/
.Why These Changes?
gitingest/__init__.py
ensures users can continue to doimport gitingest
for ingestion functions.server/
, references needed updating so the app works both locally and in Docker.Testing
http://localhost:8000
shows the updated UI and loads images/styles.import gitingest
still provides the same top-level functions (run_ingest_query
,parse_query
, etc.).Context
Relates to #125.
Terminal CLI Note
The terminal CLI is still broken but has been addressed in this PR: #136.