feat: config parameters as environment variables
Great project! Its a great way for AI agents to ingest codebases!
Have you all considered surfacing the config.py variables such as MAX_FILES and others as environment variables? So that users can override default values.
I occasionally run into such issues when working with large scientific codes (especially with recurse submodules)
Thanks!
Hi @adityakavalur, thanks for the kind words and the suggestion!
Current state
Only MAX_FILE_SIZE is configurable now:
| How | Example |
|---|---|
| Python | ingest(repo_path, max_file_size=5_000_000) |
| CLI | gitingest -s 5_000_000 /path/to/repo |
Proposal: GITINGEST_* environment variables
Let every constant in config.py be override-able, e.g.:
export GITINGEST_MAX_FILES=5000
export GITINGEST_MAX_TOTAL_SIZE_BYTES=$((10 * 1024 * 1024))
gitingest /path/to/repo # CLI
Python picks these up automatically:
from gitingest import ingest
summary, tree, content = ingest("path/to/repo")
Precedence: CLI/Python arg → GITINGEST_* env var → default in config.py.
Implementation is just a quick os.getenv check—no new deps, no breaking changes.
Optional: repo-level config
If you’d rather commit defaults, we could also parse a .gitingest.toml (or [tool.gitingest] in pyproject.toml). Env vars / flags would still win.
Quick questions
- Do you mostly use the CLI, the Python API, or both?
- Are env vars enough, or would a dot-file help too?
(FYI: recursive submodules are disabled by default since PR https://github.com/cyclotruc/gitingest/pull/209 and an opt-in flag is in PR https://github.com/cyclotruc/gitingest/pull/221.)
Thanks again! Keen to hear what fits your workflow best!
@filipchristiansen thanks for taking a look at the issue!
I see the max_file_size as an option in the ingest call, thanks for the pointer. I think surfacing the rest of them that way would be great! I generally use it through Python API calls so its actually easier this way actually.
Just for background, I use it as a function in shell-gpt
Thanks for the extra context, @adityakavalur! 🙌
I’ve assigned the issue to myself and will tackle it soon. Here’s the plan:
- Python API – surface every
config.pyconstant as a keyword argument iningest(), mirroring the existingmax_file_size. - Environment variables – support matching
GITINGEST_*env vars so both the Python API and the CLI can pick them up transparently. - CLI flags – add equivalent
--flagoptions for each constant, giving one-liner control without exporting env vars. - Docs/examples – update both Python and CLI snippets to showcase the new knobs.
I should have a PR up shortly. Thanks again for the suggestion! 🎉
See my other application
@Cheelax Is going to be working on this, Thanks a lot! Looking forward to the pr
Hi there! We haven’t seen activity here for 45 days, so I’m marking this issue as stale. If you’d like to keep it open, please leave a comment within 10 days. Thanks!
Hi there! We haven’t heard anything for 10 days, so I’m closing this issue. Feel free to reopen if you’d like to continue the discussion. Thanks!