gitingest-tddschn 0.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gitingest_tddschn-0.3.1/LICENSE +21 -0
- gitingest_tddschn-0.3.1/PKG-INFO +422 -0
- gitingest_tddschn-0.3.1/README.md +355 -0
- gitingest_tddschn-0.3.1/pyproject.toml +135 -0
- gitingest_tddschn-0.3.1/setup.cfg +4 -0
- gitingest_tddschn-0.3.1/src/gitingest/__init__.py +5 -0
- gitingest_tddschn-0.3.1/src/gitingest/__main__.py +204 -0
- gitingest_tddschn-0.3.1/src/gitingest/clone.py +176 -0
- gitingest_tddschn-0.3.1/src/gitingest/config.py +14 -0
- gitingest_tddschn-0.3.1/src/gitingest/entrypoint.py +352 -0
- gitingest_tddschn-0.3.1/src/gitingest/ingestion.py +325 -0
- gitingest_tddschn-0.3.1/src/gitingest/output_formatter.py +243 -0
- gitingest_tddschn-0.3.1/src/gitingest/query_parser.py +190 -0
- gitingest_tddschn-0.3.1/src/gitingest/schemas/__init__.py +7 -0
- gitingest_tddschn-0.3.1/src/gitingest/schemas/cloning.py +42 -0
- gitingest_tddschn-0.3.1/src/gitingest/schemas/filesystem.py +161 -0
- gitingest_tddschn-0.3.1/src/gitingest/schemas/ingestion.py +101 -0
- gitingest_tddschn-0.3.1/src/gitingest/utils/__init__.py +1 -0
- gitingest_tddschn-0.3.1/src/gitingest/utils/auth.py +27 -0
- gitingest_tddschn-0.3.1/src/gitingest/utils/compat_func.py +44 -0
- gitingest_tddschn-0.3.1/src/gitingest/utils/compat_typing.py +18 -0
- gitingest_tddschn-0.3.1/src/gitingest/utils/exceptions.py +27 -0
- gitingest_tddschn-0.3.1/src/gitingest/utils/file_utils.py +77 -0
- gitingest_tddschn-0.3.1/src/gitingest/utils/git_utils.py +531 -0
- gitingest_tddschn-0.3.1/src/gitingest/utils/ignore_patterns.py +240 -0
- gitingest_tddschn-0.3.1/src/gitingest/utils/ingestion_utils.py +88 -0
- gitingest_tddschn-0.3.1/src/gitingest/utils/logging_config.py +200 -0
- gitingest_tddschn-0.3.1/src/gitingest/utils/notebook.py +159 -0
- gitingest_tddschn-0.3.1/src/gitingest/utils/os_utils.py +24 -0
- gitingest_tddschn-0.3.1/src/gitingest/utils/pattern_utils.py +73 -0
- gitingest_tddschn-0.3.1/src/gitingest/utils/query_parser_utils.py +243 -0
- gitingest_tddschn-0.3.1/src/gitingest/utils/timeout_wrapper.py +46 -0
- gitingest_tddschn-0.3.1/src/gitingest_tddschn.egg-info/PKG-INFO +422 -0
- gitingest_tddschn-0.3.1/src/gitingest_tddschn.egg-info/SOURCES.txt +59 -0
- gitingest_tddschn-0.3.1/src/gitingest_tddschn.egg-info/dependency_links.txt +1 -0
- gitingest_tddschn-0.3.1/src/gitingest_tddschn.egg-info/entry_points.txt +2 -0
- gitingest_tddschn-0.3.1/src/gitingest_tddschn.egg-info/requires.txt +29 -0
- gitingest_tddschn-0.3.1/src/gitingest_tddschn.egg-info/top_level.txt +3 -0
- gitingest_tddschn-0.3.1/src/server/__init__.py +1 -0
- gitingest_tddschn-0.3.1/src/server/__main__.py +32 -0
- gitingest_tddschn-0.3.1/src/server/form_types.py +16 -0
- gitingest_tddschn-0.3.1/src/server/main.py +213 -0
- gitingest_tddschn-0.3.1/src/server/metrics_server.py +68 -0
- gitingest_tddschn-0.3.1/src/server/models.py +198 -0
- gitingest_tddschn-0.3.1/src/server/query_processor.py +429 -0
- gitingest_tddschn-0.3.1/src/server/routers/__init__.py +7 -0
- gitingest_tddschn-0.3.1/src/server/routers/dynamic.py +39 -0
- gitingest_tddschn-0.3.1/src/server/routers/index.py +37 -0
- gitingest_tddschn-0.3.1/src/server/routers/ingest.py +153 -0
- gitingest_tddschn-0.3.1/src/server/routers_utils.py +57 -0
- gitingest_tddschn-0.3.1/src/server/s3_utils.py +561 -0
- gitingest_tddschn-0.3.1/src/server/server_config.py +56 -0
- gitingest_tddschn-0.3.1/src/server/server_utils.py +73 -0
- gitingest_tddschn-0.3.1/tests/test_cli.py +99 -0
- gitingest_tddschn-0.3.1/tests/test_clone.py +223 -0
- gitingest_tddschn-0.3.1/tests/test_git_utils.py +277 -0
- gitingest_tddschn-0.3.1/tests/test_gitignore_feature.py +69 -0
- gitingest_tddschn-0.3.1/tests/test_ingestion.py +235 -0
- gitingest_tddschn-0.3.1/tests/test_notebook_utils.py +270 -0
- gitingest_tddschn-0.3.1/tests/test_pattern_utils.py +45 -0
- gitingest_tddschn-0.3.1/tests/test_summary.py +111 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Romain Courtois
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gitingest-tddschn
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: CLI tool to analyze and create text dumps of codebases for LLMs
|
|
5
|
+
Author: Filip Christiansen
|
|
6
|
+
Author-email: Romain Courtois <romain@coderamp.io>
|
|
7
|
+
License: MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2024 Romain Courtois
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
Project-URL: homepage, https://gitingest.com
|
|
30
|
+
Project-URL: github, https://github.com/coderamp-labs/gitingest
|
|
31
|
+
Classifier: Development Status :: 3 - Alpha
|
|
32
|
+
Classifier: Intended Audience :: Developers
|
|
33
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
40
|
+
Requires-Python: >=3.8
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
42
|
+
License-File: LICENSE
|
|
43
|
+
Requires-Dist: click>=8.0.0
|
|
44
|
+
Requires-Dist: gitpython>=3.1.0
|
|
45
|
+
Requires-Dist: httpx
|
|
46
|
+
Requires-Dist: loguru>=0.7.0
|
|
47
|
+
Requires-Dist: pathspec>=0.12.1
|
|
48
|
+
Requires-Dist: pydantic
|
|
49
|
+
Requires-Dist: python-dotenv
|
|
50
|
+
Requires-Dist: starlette>=0.40.0
|
|
51
|
+
Requires-Dist: strenum; python_version < "3.11"
|
|
52
|
+
Requires-Dist: typing_extensions>=4.0.0; python_version < "3.10"
|
|
53
|
+
Provides-Extra: dev
|
|
54
|
+
Requires-Dist: eval-type-backport; extra == "dev"
|
|
55
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
56
|
+
Requires-Dist: pytest; extra == "dev"
|
|
57
|
+
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
58
|
+
Requires-Dist: pytest-mock; extra == "dev"
|
|
59
|
+
Provides-Extra: server
|
|
60
|
+
Requires-Dist: boto3>=1.28.0; extra == "server"
|
|
61
|
+
Requires-Dist: fastapi[standard]>=0.109.1; extra == "server"
|
|
62
|
+
Requires-Dist: prometheus-client; extra == "server"
|
|
63
|
+
Requires-Dist: sentry-sdk[fastapi]; extra == "server"
|
|
64
|
+
Requires-Dist: slowapi; extra == "server"
|
|
65
|
+
Requires-Dist: uvicorn>=0.11.7; extra == "server"
|
|
66
|
+
Dynamic: license-file
|
|
67
|
+
|
|
68
|
+
# Gitingest
|
|
69
|
+
|
|
70
|
+
[](https://gitingest.com)
|
|
71
|
+
|
|
72
|
+
<!-- Badges -->
|
|
73
|
+
<!-- markdownlint-disable MD033 -->
|
|
74
|
+
<p align="center">
|
|
75
|
+
<!-- row 1 — install & compat -->
|
|
76
|
+
<a href="https://pypi.org/project/gitingest"><img src="https://img.shields.io/pypi/v/gitingest.svg" alt="PyPI"></a>
|
|
77
|
+
<a href="https://pypi.org/project/gitingest"><img src="https://img.shields.io/pypi/pyversions/gitingest.svg" alt="Python Versions"></a>
|
|
78
|
+
<br>
|
|
79
|
+
<!-- row 2 — quality & community -->
|
|
80
|
+
<a href="https://github.com/coderamp-labs/gitingest/actions/workflows/ci.yml?query=branch%3Amain"><img src="https://github.com/coderamp-labs/gitingest/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI"></a>
|
|
81
|
+
|
|
82
|
+
<a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff"></a>
|
|
83
|
+
<a href="https://scorecard.dev/viewer/?uri=github.com/coderamp-labs/gitingest"><img src="https://api.scorecard.dev/projects/github.com/coderamp-labs/gitingest/badge" alt="OpenSSF Scorecard"></a>
|
|
84
|
+
<br>
|
|
85
|
+
<a href="https://github.com/coderamp-labs/gitingest/blob/main/LICENSE"><img src="https://img.shields.io/github/license/coderamp-labs/gitingest.svg" alt="License"></a>
|
|
86
|
+
<a href="https://pepy.tech/project/gitingest"><img src="https://pepy.tech/badge/gitingest" alt="Downloads"></a>
|
|
87
|
+
<a href="https://github.com/coderamp-labs/gitingest"><img src="https://img.shields.io/github/stars/coderamp-labs/gitingest" alt="GitHub Stars"></a>
|
|
88
|
+
<a href="https://discord.com/invite/zerRaGK9EC"><img src="https://img.shields.io/badge/Discord-Join_chat-5865F2?logo=discord&logoColor=white" alt="Discord"></a>
|
|
89
|
+
<br>
|
|
90
|
+
<a href="https://trendshift.io/repositories/13519"><img src="https://trendshift.io/api/badge/repositories/13519" alt="Trendshift" height="50"></a>
|
|
91
|
+
</p>
|
|
92
|
+
<!-- markdownlint-enable MD033 -->
|
|
93
|
+
|
|
94
|
+
Turn any Git repository into a prompt-friendly text ingest for LLMs.
|
|
95
|
+
|
|
96
|
+
You can also replace `hub` with `ingest` in any GitHub URL to access the corresponding digest.
|
|
97
|
+
|
|
98
|
+
<!-- Extensions -->
|
|
99
|
+
[gitingest.com](https://gitingest.com) · [Chrome Extension](https://chromewebstore.google.com/detail/adfjahbijlkjfoicpjkhjicpjpjfaood) · [Firefox Add-on](https://addons.mozilla.org/firefox/addon/gitingest)
|
|
100
|
+
|
|
101
|
+
<!-- Languages -->
|
|
102
|
+
[Deutsch](https://www.readme-i18n.com/coderamp-labs/gitingest?lang=de) |
|
|
103
|
+
[Español](https://www.readme-i18n.com/coderamp-labs/gitingest?lang=es) |
|
|
104
|
+
[Français](https://www.readme-i18n.com/coderamp-labs/gitingest?lang=fr) |
|
|
105
|
+
[日本語](https://www.readme-i18n.com/coderamp-labs/gitingest?lang=ja) |
|
|
106
|
+
[한국어](https://www.readme-i18n.com/coderamp-labs/gitingest?lang=ko) |
|
|
107
|
+
[Português](https://www.readme-i18n.com/coderamp-labs/gitingest?lang=pt) |
|
|
108
|
+
[Русский](https://www.readme-i18n.com/coderamp-labs/gitingest?lang=ru) |
|
|
109
|
+
[中文](https://www.readme-i18n.com/coderamp-labs/gitingest?lang=zh)
|
|
110
|
+
|
|
111
|
+
## 🚀 Features
|
|
112
|
+
|
|
113
|
+
- **Easy code context**: Get a text digest from a Git repository URL or a directory
|
|
114
|
+
- **Smart Formatting**: Optimized output format for LLM prompts
|
|
115
|
+
- **Statistics about**:
|
|
116
|
+
- File and directory structure
|
|
117
|
+
- Size of the extract
|
|
118
|
+
- Token count
|
|
119
|
+
- **CLI tool**: Run it as a shell command
|
|
120
|
+
- **Python package**: Import it in your code
|
|
121
|
+
|
|
122
|
+
## 📚 Requirements
|
|
123
|
+
|
|
124
|
+
- Python 3.8+
|
|
125
|
+
- For private repositories: A GitHub Personal Access Token (PAT). [Generate your token **here**!](https://github.com/settings/tokens/new?description=gitingest&scopes=repo)
|
|
126
|
+
|
|
127
|
+
### 📦 Installation
|
|
128
|
+
|
|
129
|
+
Gitingest is available on [PyPI](https://pypi.org/project/gitingest/).
|
|
130
|
+
You can install it using `pip`:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
pip install gitingest
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
or
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
pip install gitingest[server]
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
to include server dependencies for self-hosting.
|
|
143
|
+
|
|
144
|
+
However, it might be a good idea to use `pipx` to install it.
|
|
145
|
+
You can install `pipx` using your preferred package manager.
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
brew install pipx
|
|
149
|
+
apt install pipx
|
|
150
|
+
scoop install pipx
|
|
151
|
+
...
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
If you are using pipx for the first time, run:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
pipx ensurepath
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# install gitingest
|
|
162
|
+
pipx install gitingest
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## 🧩 Browser Extension Usage
|
|
166
|
+
|
|
167
|
+
<!-- markdownlint-disable MD033 -->
|
|
168
|
+
<a href="https://chromewebstore.google.com/detail/adfjahbijlkjfoicpjkhjicpjpjfaood" target="_blank" title="Get Gitingest Extension from Chrome Web Store"><img height="48" src="https://github.com/user-attachments/assets/20a6e44b-fd46-4e6c-8ea6-aad436035753" alt="Available in the Chrome Web Store" /></a>
|
|
169
|
+
<a href="https://addons.mozilla.org/firefox/addon/gitingest" target="_blank" title="Get Gitingest Extension from Firefox Add-ons"><img height="48" src="https://github.com/user-attachments/assets/c0e99e6b-97cf-4af2-9737-099db7d3538b" alt="Get The Add-on for Firefox" /></a>
|
|
170
|
+
<a href="https://microsoftedge.microsoft.com/addons/detail/nfobhllgcekbmpifkjlopfdfdmljmipf" target="_blank" title="Get Gitingest Extension from Microsoft Edge Add-ons"><img height="48" src="https://github.com/user-attachments/assets/204157eb-4cae-4c0e-b2cb-db514419fd9e" alt="Get from the Edge Add-ons" /></a>
|
|
171
|
+
<!-- markdownlint-enable MD033 -->
|
|
172
|
+
|
|
173
|
+
The extension is open source at [lcandy2/gitingest-extension](https://github.com/lcandy2/gitingest-extension).
|
|
174
|
+
|
|
175
|
+
Issues and feature requests are welcome to the repo.
|
|
176
|
+
|
|
177
|
+
## 💡 Command line usage
|
|
178
|
+
|
|
179
|
+
The `gitingest` command line tool allows you to analyze codebases and create a text dump of their contents.
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Basic usage (writes to digest.txt by default)
|
|
183
|
+
gitingest /path/to/directory
|
|
184
|
+
|
|
185
|
+
# From URL
|
|
186
|
+
gitingest https://github.com/coderamp-labs/gitingest
|
|
187
|
+
|
|
188
|
+
# or from specific subdirectory
|
|
189
|
+
gitingest https://github.com/coderamp-labs/gitingest/tree/main/src/gitingest/utils
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
For private repositories, use the `--token/-t` option.
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# Get your token from https://github.com/settings/personal-access-tokens
|
|
196
|
+
gitingest https://github.com/username/private-repo --token github_pat_...
|
|
197
|
+
|
|
198
|
+
# Or set it as an environment variable
|
|
199
|
+
export GITHUB_TOKEN=github_pat_...
|
|
200
|
+
gitingest https://github.com/username/private-repo
|
|
201
|
+
|
|
202
|
+
# Include repository submodules
|
|
203
|
+
gitingest https://github.com/username/repo-with-submodules --include-submodules
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
By default, files listed in `.gitignore` are skipped. Use `--include-gitignored` if you
|
|
207
|
+
need those files in the digest.
|
|
208
|
+
|
|
209
|
+
By default, the digest is written to a text file (`digest.txt`) in your current working directory. You can customize the output in two ways:
|
|
210
|
+
|
|
211
|
+
- Use `--output/-o <filename>` to write to a specific file.
|
|
212
|
+
- Use `--output/-o -` to output directly to `STDOUT` (useful for piping to other tools).
|
|
213
|
+
|
|
214
|
+
See more options and usage details with:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
gitingest --help
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## 🐍 Python package usage
|
|
221
|
+
|
|
222
|
+
```python
|
|
223
|
+
# Synchronous usage
|
|
224
|
+
from gitingest import ingest
|
|
225
|
+
|
|
226
|
+
summary, tree, content = ingest("path/to/directory")
|
|
227
|
+
|
|
228
|
+
# or from URL
|
|
229
|
+
summary, tree, content = ingest("https://github.com/coderamp-labs/gitingest")
|
|
230
|
+
|
|
231
|
+
# or from a specific subdirectory
|
|
232
|
+
summary, tree, content = ingest("https://github.com/coderamp-labs/gitingest/tree/main/src/gitingest/utils")
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
For private repositories, you can pass a token:
|
|
236
|
+
|
|
237
|
+
```python
|
|
238
|
+
# Using token parameter
|
|
239
|
+
summary, tree, content = ingest("https://github.com/username/private-repo", token="github_pat_...")
|
|
240
|
+
|
|
241
|
+
# Or set it as an environment variable
|
|
242
|
+
import os
|
|
243
|
+
os.environ["GITHUB_TOKEN"] = "github_pat_..."
|
|
244
|
+
summary, tree, content = ingest("https://github.com/username/private-repo")
|
|
245
|
+
|
|
246
|
+
# Include repository submodules
|
|
247
|
+
summary, tree, content = ingest("https://github.com/username/repo-with-submodules", include_submodules=True)
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
By default, this won't write a file but can be enabled with the `output` argument.
|
|
251
|
+
|
|
252
|
+
```python
|
|
253
|
+
# Asynchronous usage
|
|
254
|
+
from gitingest import ingest_async
|
|
255
|
+
import asyncio
|
|
256
|
+
|
|
257
|
+
result = asyncio.run(ingest_async("path/to/directory"))
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Jupyter notebook usage
|
|
261
|
+
|
|
262
|
+
```python
|
|
263
|
+
from gitingest import ingest_async
|
|
264
|
+
|
|
265
|
+
# Use await directly in Jupyter
|
|
266
|
+
summary, tree, content = await ingest_async("path/to/directory")
|
|
267
|
+
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
This is because Jupyter notebooks are asynchronous by default.
|
|
271
|
+
|
|
272
|
+
## 🐳 Self-host
|
|
273
|
+
|
|
274
|
+
### Using Docker
|
|
275
|
+
|
|
276
|
+
1. Build the image:
|
|
277
|
+
|
|
278
|
+
``` bash
|
|
279
|
+
docker build -t gitingest .
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
2. Run the container:
|
|
283
|
+
|
|
284
|
+
``` bash
|
|
285
|
+
docker run -d --name gitingest -p 8000:8000 gitingest
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
The application will be available at `http://localhost:8000`.
|
|
289
|
+
|
|
290
|
+
If you are hosting it on a domain, you can specify the allowed hostnames via env variable `ALLOWED_HOSTS`.
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
# Default: "gitingest.com, *.gitingest.com, localhost, 127.0.0.1".
|
|
294
|
+
ALLOWED_HOSTS="example.com, localhost, 127.0.0.1"
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Environment Variables
|
|
298
|
+
|
|
299
|
+
The application can be configured using the following environment variables:
|
|
300
|
+
|
|
301
|
+
- **ALLOWED_HOSTS**: Comma-separated list of allowed hostnames (default: "gitingest.com, *.gitingest.com, localhost, 127.0.0.1")
|
|
302
|
+
- **GITINGEST_METRICS_ENABLED**: Enable Prometheus metrics server (set to any value to enable)
|
|
303
|
+
- **GITINGEST_METRICS_HOST**: Host for the metrics server (default: "127.0.0.1")
|
|
304
|
+
- **GITINGEST_METRICS_PORT**: Port for the metrics server (default: "9090")
|
|
305
|
+
- **GITINGEST_SENTRY_ENABLED**: Enable Sentry error tracking (set to any value to enable)
|
|
306
|
+
- **GITINGEST_SENTRY_DSN**: Sentry DSN (required if Sentry is enabled)
|
|
307
|
+
- **GITINGEST_SENTRY_TRACES_SAMPLE_RATE**: Sampling rate for performance data (default: "1.0", range: 0.0-1.0)
|
|
308
|
+
- **GITINGEST_SENTRY_PROFILE_SESSION_SAMPLE_RATE**: Sampling rate for profile sessions (default: "1.0", range: 0.0-1.0)
|
|
309
|
+
- **GITINGEST_SENTRY_PROFILE_LIFECYCLE**: Profile lifecycle mode (default: "trace")
|
|
310
|
+
- **GITINGEST_SENTRY_SEND_DEFAULT_PII**: Send default personally identifiable information (default: "true")
|
|
311
|
+
- **S3_ALIAS_HOST**: Public URL/CDN for accessing S3 resources (default: "127.0.0.1:9000/gitingest-bucket")
|
|
312
|
+
- **S3_DIRECTORY_PREFIX**: Optional prefix for S3 file paths (if set, prefixes all S3 paths with this value)
|
|
313
|
+
|
|
314
|
+
### Using Docker Compose
|
|
315
|
+
|
|
316
|
+
The project includes a `compose.yml` file that allows you to easily run the application in both development and production environments.
|
|
317
|
+
|
|
318
|
+
#### Compose File Structure
|
|
319
|
+
|
|
320
|
+
The `compose.yml` file uses YAML anchoring with `&app-base` and `<<: *app-base` to define common configuration that is shared between services:
|
|
321
|
+
|
|
322
|
+
```yaml
|
|
323
|
+
# Common base configuration for all services
|
|
324
|
+
x-app-base: &app-base
|
|
325
|
+
build:
|
|
326
|
+
context: .
|
|
327
|
+
dockerfile: Dockerfile
|
|
328
|
+
ports:
|
|
329
|
+
- "${APP_WEB_BIND:-8000}:8000" # Main application port
|
|
330
|
+
- "${GITINGEST_METRICS_HOST:-127.0.0.1}:${GITINGEST_METRICS_PORT:-9090}:9090" # Metrics port
|
|
331
|
+
# ... other common configurations
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
#### Services
|
|
335
|
+
|
|
336
|
+
The file defines three services:
|
|
337
|
+
|
|
338
|
+
1. **app**: Production service configuration
|
|
339
|
+
- Uses the `prod` profile
|
|
340
|
+
- Sets the Sentry environment to "production"
|
|
341
|
+
- Configured for stable operation with `restart: unless-stopped`
|
|
342
|
+
|
|
343
|
+
2. **app-dev**: Development service configuration
|
|
344
|
+
- Uses the `dev` profile
|
|
345
|
+
- Enables debug mode
|
|
346
|
+
- Mounts the source code for live development
|
|
347
|
+
- Uses hot reloading for faster development
|
|
348
|
+
|
|
349
|
+
3. **minio**: S3-compatible object storage for development
|
|
350
|
+
- Uses the `dev` profile (only available in development mode)
|
|
351
|
+
- Provides S3-compatible storage for local development
|
|
352
|
+
- Accessible via:
|
|
353
|
+
- API: Port 9000 ([localhost:9000](http://localhost:9000))
|
|
354
|
+
- Web Console: Port 9001 ([localhost:9001](http://localhost:9001))
|
|
355
|
+
- Default admin credentials:
|
|
356
|
+
- Username: `minioadmin`
|
|
357
|
+
- Password: `minioadmin`
|
|
358
|
+
- Configurable via environment variables:
|
|
359
|
+
- `MINIO_ROOT_USER`: Custom admin username (default: minioadmin)
|
|
360
|
+
- `MINIO_ROOT_PASSWORD`: Custom admin password (default: minioadmin)
|
|
361
|
+
- Includes persistent storage via Docker volume
|
|
362
|
+
- Auto-creates a bucket and application-specific credentials:
|
|
363
|
+
- Bucket name: `gitingest-bucket` (configurable via `S3_BUCKET_NAME`)
|
|
364
|
+
- Access key: `gitingest` (configurable via `S3_ACCESS_KEY`)
|
|
365
|
+
- Secret key: `gitingest123` (configurable via `S3_SECRET_KEY`)
|
|
366
|
+
- These credentials are automatically passed to the app-dev service via environment variables:
|
|
367
|
+
- `S3_ENDPOINT`: URL of the MinIO server
|
|
368
|
+
- `S3_ACCESS_KEY`: Access key for the S3 bucket
|
|
369
|
+
- `S3_SECRET_KEY`: Secret key for the S3 bucket
|
|
370
|
+
- `S3_BUCKET_NAME`: Name of the S3 bucket
|
|
371
|
+
- `S3_REGION`: Region for the S3 bucket (default: us-east-1)
|
|
372
|
+
- `S3_ALIAS_HOST`: Public URL/CDN for accessing S3 resources (default: "127.0.0.1:9000/gitingest-bucket")
|
|
373
|
+
|
|
374
|
+
#### Usage Examples
|
|
375
|
+
|
|
376
|
+
To run the application in development mode:
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
docker compose --profile dev up
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
To run the application in production mode:
|
|
383
|
+
|
|
384
|
+
```bash
|
|
385
|
+
docker compose --profile prod up -d
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
To build and run the application:
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
docker compose --profile prod build
|
|
392
|
+
docker compose --profile prod up -d
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
## 🤝 Contributing
|
|
396
|
+
|
|
397
|
+
### Non-technical ways to contribute
|
|
398
|
+
|
|
399
|
+
- **Create an Issue**: If you find a bug or have an idea for a new feature, please [create an issue](https://github.com/coderamp-labs/gitingest/issues/new) on GitHub. This will help us track and prioritize your request.
|
|
400
|
+
- **Spread the Word**: If you like Gitingest, please share it with your friends, colleagues, and on social media. This will help us grow the community and make Gitingest even better.
|
|
401
|
+
- **Use Gitingest**: The best feedback comes from real-world usage! If you encounter any issues or have ideas for improvement, please let us know by [creating an issue](https://github.com/coderamp-labs/gitingest/issues/new) on GitHub or by reaching out to us on [Discord](https://discord.com/invite/zerRaGK9EC).
|
|
402
|
+
|
|
403
|
+
### Technical ways to contribute
|
|
404
|
+
|
|
405
|
+
Gitingest aims to be friendly for first time contributors, with a simple Python and HTML codebase. If you need any help while working with the code, reach out to us on [Discord](https://discord.com/invite/zerRaGK9EC). For detailed instructions on how to make a pull request, see [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
406
|
+
|
|
407
|
+
## 🛠️ Stack
|
|
408
|
+
|
|
409
|
+
- [Tailwind CSS](https://tailwindcss.com) - Frontend
|
|
410
|
+
- [FastAPI](https://github.com/fastapi/fastapi) - Backend framework
|
|
411
|
+
- [Jinja2](https://jinja.palletsprojects.com) - HTML templating
|
|
412
|
+
- [tiktoken](https://github.com/openai/tiktoken) - Token estimation
|
|
413
|
+
- [posthog](https://github.com/PostHog/posthog) - Amazing analytics
|
|
414
|
+
- [Sentry](https://sentry.io) - Error tracking and performance monitoring
|
|
415
|
+
|
|
416
|
+
### Looking for a JavaScript/FileSystemNode package?
|
|
417
|
+
|
|
418
|
+
Check out the NPM alternative 📦 Repomix: <https://github.com/yamadashy/repomix>
|
|
419
|
+
|
|
420
|
+
## 🚀 Project Growth
|
|
421
|
+
|
|
422
|
+
[](https://star-history.com/#coderamp-labs/gitingest&Date)
|