gitlytics 0.7.2__tar.gz → 0.8.0__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.
- {gitlytics-0.7.2 → gitlytics-0.8.0}/MANIFEST.in +2 -0
- {gitlytics-0.7.2/src/gitlytics.egg-info → gitlytics-0.8.0}/PKG-INFO +23 -18
- {gitlytics-0.7.2 → gitlytics-0.8.0}/README.md +19 -15
- {gitlytics-0.7.2 → gitlytics-0.8.0}/pyproject.toml +18 -27
- gitlytics-0.8.0/src/gitlytics/__init__.py +36 -0
- gitlytics-0.8.0/src/gitlytics/__main__.py +9 -0
- gitlytics-0.8.0/src/gitlytics/_version.py +5 -0
- gitlytics-0.8.0/src/gitlytics/api/__init__.py +58 -0
- gitlytics-0.8.0/src/gitlytics/api/app.py +35 -0
- gitlytics-0.8.0/src/gitlytics/api/cache.py +146 -0
- gitlytics-0.8.0/src/gitlytics/api/routes.py +405 -0
- gitlytics-0.8.0/src/gitlytics/api/security.py +197 -0
- gitlytics-0.8.0/src/gitlytics/automation/__init__.py +29 -0
- gitlytics-0.8.0/src/gitlytics/automation/scheduler.py +229 -0
- gitlytics-0.8.0/src/gitlytics/automation/storage.py +200 -0
- gitlytics-0.8.0/src/gitlytics/cli/__init__.py +12 -0
- gitlytics-0.8.0/src/gitlytics/cli/commands.py +211 -0
- gitlytics-0.8.0/src/gitlytics/cli/parser.py +174 -0
- gitlytics-0.8.0/src/gitlytics/core/__init__.py +103 -0
- gitlytics-0.8.0/src/gitlytics/core/client.py +249 -0
- gitlytics-0.8.0/src/gitlytics/core/repos.py +199 -0
- gitlytics-0.8.0/src/gitlytics/core/stars.py +340 -0
- gitlytics-0.8.0/src/gitlytics/core/traffic.py +312 -0
- gitlytics-0.8.0/src/gitlytics/core/users.py +206 -0
- gitlytics-0.8.0/src/gitlytics/core/validation.py +47 -0
- gitlytics-0.8.0/src/gitlytics/exceptions.py +42 -0
- gitlytics-0.8.0/src/gitlytics/io/__init__.py +34 -0
- gitlytics-0.8.0/src/gitlytics/io/atomic.py +93 -0
- gitlytics-0.8.0/src/gitlytics/io/csv.py +102 -0
- gitlytics-0.8.0/src/gitlytics/io/formatting.py +101 -0
- gitlytics-0.8.0/src/gitlytics/io/payloads.py +446 -0
- gitlytics-0.8.0/src/gitlytics/process.py +23 -0
- gitlytics-0.8.0/src/gitlytics/sdk.py +287 -0
- {gitlytics-0.7.2 → gitlytics-0.8.0}/src/gitlytics/static/_headers +1 -1
- gitlytics-0.8.0/src/gitlytics/static/assets/CardModal-CgS7cwE6.js +1 -0
- gitlytics-0.8.0/src/gitlytics/static/assets/CommitActivity-B8loV0zx.js +2 -0
- gitlytics-0.8.0/src/gitlytics/static/assets/DashboardPage-CM3TuMN8.js +8 -0
- gitlytics-0.8.0/src/gitlytics/static/assets/DashboardView-C-bWABhu.js +2 -0
- gitlytics-0.8.0/src/gitlytics/static/assets/ExportModal-Dzj7HavP.js +1 -0
- gitlytics-0.7.2/src/gitlytics/static/assets/HeaderNavbar-DlO42Oi_.js → gitlytics-0.8.0/src/gitlytics/static/assets/HeaderNavbar-B34y2mgI.js +1 -1
- gitlytics-0.8.0/src/gitlytics/static/assets/SettingsPage-BTwXpn2n.js +1 -0
- gitlytics-0.8.0/src/gitlytics/static/assets/UsernameView-UfCI3Zto.js +2 -0
- gitlytics-0.8.0/src/gitlytics/static/assets/download-jFI60Api.js +1 -0
- gitlytics-0.8.0/src/gitlytics/static/assets/exports-XafIIZGe.js +46 -0
- gitlytics-0.8.0/src/gitlytics/static/assets/github-api-nEQh7lEl.js +4 -0
- gitlytics-0.8.0/src/gitlytics/static/assets/index-BXb5FSJ3.css +2 -0
- gitlytics-0.8.0/src/gitlytics/static/assets/index-DWuGnK2H.js +3 -0
- gitlytics-0.7.2/src/gitlytics/static/assets/index.es-Dgvl53Sx.js → gitlytics-0.8.0/src/gitlytics/static/assets/index.es-ScXeqmu0.js +1 -1
- gitlytics-0.8.0/src/gitlytics/static/assets/session-traffic-store-NbhFxYwD.js +1 -0
- gitlytics-0.7.2/src/gitlytics/static/assets/vendor-charts-c52wq6rV.js → gitlytics-0.8.0/src/gitlytics/static/assets/vendor-charts-DJf0ii6C.js +1 -1
- gitlytics-0.8.0/src/gitlytics/static/assets/vendor-html2canvas-Du5bbLwR.js +7 -0
- gitlytics-0.8.0/src/gitlytics/static/assets/vendor-icons-Dz82alpU.js +1 -0
- gitlytics-0.8.0/src/gitlytics/static/assets/vendor-jspdf-CfDsdiuL.js +79 -0
- gitlytics-0.8.0/src/gitlytics/static/assets/vendor-query-Db_ymVcz.js +1 -0
- gitlytics-0.8.0/src/gitlytics/static/assets/vendor-router-ORVwdicZ.js +3 -0
- {gitlytics-0.7.2 → gitlytics-0.8.0}/src/gitlytics/static/index.html +32 -16
- gitlytics-0.8.0/src/gitlytics/static/site.webmanifest +1 -0
- gitlytics-0.8.0/src/gitlytics/username.py +12 -0
- {gitlytics-0.7.2 → gitlytics-0.8.0/src/gitlytics.egg-info}/PKG-INFO +23 -18
- gitlytics-0.8.0/src/gitlytics.egg-info/SOURCES.txt +77 -0
- {gitlytics-0.7.2 → gitlytics-0.8.0}/src/gitlytics.egg-info/requires.txt +1 -1
- gitlytics-0.7.2/src/gitlytics/__init__.py +0 -376
- gitlytics-0.7.2/src/gitlytics/__main__.py +0 -9
- gitlytics-0.7.2/src/gitlytics/api.py +0 -729
- gitlytics-0.7.2/src/gitlytics/automation.py +0 -505
- gitlytics-0.7.2/src/gitlytics/cli.py +0 -310
- gitlytics-0.7.2/src/gitlytics/core.py +0 -1328
- gitlytics-0.7.2/src/gitlytics/process.py +0 -394
- gitlytics-0.7.2/src/gitlytics/static/_redirects +0 -9
- gitlytics-0.7.2/src/gitlytics/static/assets/AuthCallback-BZRv0dDx.js +0 -1
- gitlytics-0.7.2/src/gitlytics/static/assets/CardModal-Cxkcj1h_.js +0 -1
- gitlytics-0.7.2/src/gitlytics/static/assets/CommitActivity-D9llWZjw.js +0 -2
- gitlytics-0.7.2/src/gitlytics/static/assets/DashboardPage-ao6PnR-o.js +0 -8
- gitlytics-0.7.2/src/gitlytics/static/assets/DashboardView-CiHKx_rK.js +0 -2
- gitlytics-0.7.2/src/gitlytics/static/assets/DeepAnalysisView-Y6yWeyi8.js +0 -16
- gitlytics-0.7.2/src/gitlytics/static/assets/DeveloperCard-DM2nWIq5.js +0 -1
- gitlytics-0.7.2/src/gitlytics/static/assets/ExportModal-CsURKObW.js +0 -1
- gitlytics-0.7.2/src/gitlytics/static/assets/ExportOverlay-CIH-K-N3.js +0 -1
- gitlytics-0.7.2/src/gitlytics/static/assets/GithubIcon-DQ0K1Pjq.js +0 -4
- gitlytics-0.7.2/src/gitlytics/static/assets/IntegrationsPage-C1lTdkJz.js +0 -1
- gitlytics-0.7.2/src/gitlytics/static/assets/LanguagePill-Cj9nUU1t.js +0 -1
- gitlytics-0.7.2/src/gitlytics/static/assets/SettingsPage-Bc1f1wVF.js +0 -1
- gitlytics-0.7.2/src/gitlytics/static/assets/UsernameView-RQNzgISl.js +0 -2
- gitlytics-0.7.2/src/gitlytics/static/assets/WidgetPage-BdNMOgyZ.js +0 -2
- gitlytics-0.7.2/src/gitlytics/static/assets/WorkspaceView-DrGl4zNB.js +0 -2
- gitlytics-0.7.2/src/gitlytics/static/assets/analytics-CYMSCHR6.js +0 -1
- gitlytics-0.7.2/src/gitlytics/static/assets/exports-Bwypdker.js +0 -46
- gitlytics-0.7.2/src/gitlytics/static/assets/index-CuEBHdAz.css +0 -2
- gitlytics-0.7.2/src/gitlytics/static/assets/index-bvN1FsLj.js +0 -3
- gitlytics-0.7.2/src/gitlytics/static/assets/query-keys-D0R_JjMY.js +0 -1
- gitlytics-0.7.2/src/gitlytics/static/assets/session-traffic-store-CWDRoP_g.js +0 -1
- gitlytics-0.7.2/src/gitlytics/static/assets/vendor-icons-B7qKqFPQ.js +0 -1
- gitlytics-0.7.2/src/gitlytics/static/assets/vendor-pdf-0_h89gnr.js +0 -85
- gitlytics-0.7.2/src/gitlytics/static/assets/vendor-query-DlE7hwEz.js +0 -1
- gitlytics-0.7.2/src/gitlytics/static/assets/vendor-radix-BsUTY_uy.js +0 -41
- gitlytics-0.7.2/src/gitlytics/static/assets/vendor-router-BG3eF-jK.js +0 -3
- gitlytics-0.7.2/src/gitlytics/static/favicon.png +0 -0
- gitlytics-0.7.2/src/gitlytics/static/google-search-icon-48x48.png +0 -0
- gitlytics-0.7.2/src/gitlytics/static/google-search-icon.png +0 -0
- gitlytics-0.7.2/src/gitlytics/static/llms-full.txt +0 -125
- gitlytics-0.7.2/src/gitlytics/static/llms.txt +0 -19
- gitlytics-0.7.2/src/gitlytics/static/og-cover.png +0 -0
- gitlytics-0.7.2/src/gitlytics/static/robots.txt +0 -4
- gitlytics-0.7.2/src/gitlytics/static/site.webmanifest +0 -1
- gitlytics-0.7.2/src/gitlytics/static/sitemap.xml +0 -8
- gitlytics-0.7.2/src/gitlytics/username.py +0 -16
- gitlytics-0.7.2/src/gitlytics.egg-info/SOURCES.txt +0 -73
- {gitlytics-0.7.2 → gitlytics-0.8.0}/LICENSE +0 -0
- {gitlytics-0.7.2 → gitlytics-0.8.0}/requirements.txt +0 -0
- {gitlytics-0.7.2 → gitlytics-0.8.0}/setup.cfg +0 -0
- {gitlytics-0.7.2 → gitlytics-0.8.0}/src/gitlytics/static/android-chrome-192x192.png +0 -0
- {gitlytics-0.7.2 → gitlytics-0.8.0}/src/gitlytics/static/android-chrome-512x512.png +0 -0
- {gitlytics-0.7.2 → gitlytics-0.8.0}/src/gitlytics/static/apple-touch-icon.png +0 -0
- {gitlytics-0.7.2 → gitlytics-0.8.0}/src/gitlytics/static/assets/purify.es-Dqk5qvad.js +0 -0
- {gitlytics-0.7.2 → gitlytics-0.8.0}/src/gitlytics/static/assets/rolldown-runtime-XKyaHtl9.js +0 -0
- {gitlytics-0.7.2 → gitlytics-0.8.0}/src/gitlytics/static/assets/vendor-react-B6nnNKyz.js +0 -0
- {gitlytics-0.7.2 → gitlytics-0.8.0}/src/gitlytics/static/assets/vendor-ui-C9IATfL8.js +0 -0
- {gitlytics-0.7.2 → gitlytics-0.8.0}/src/gitlytics/static/favicon-16x16.png +0 -0
- {gitlytics-0.7.2 → gitlytics-0.8.0}/src/gitlytics/static/favicon-32x32.png +0 -0
- {gitlytics-0.7.2 → gitlytics-0.8.0}/src/gitlytics/static/favicon-48x48.png +0 -0
- {gitlytics-0.7.2 → gitlytics-0.8.0}/src/gitlytics/static/favicon.ico +0 -0
- {gitlytics-0.7.2 → gitlytics-0.8.0}/src/gitlytics/static/gitlytics-logo.png +0 -0
- {gitlytics-0.7.2 → gitlytics-0.8.0}/src/gitlytics.egg-info/dependency_links.txt +0 -0
- {gitlytics-0.7.2 → gitlytics-0.8.0}/src/gitlytics.egg-info/entry_points.txt +0 -0
- {gitlytics-0.7.2 → gitlytics-0.8.0}/src/gitlytics.egg-info/top_level.txt +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitlytics
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Summary: Monitor and automate your GitHub repository traffic analytics.
|
|
5
|
-
Author-email: Ameya Chopade <
|
|
5
|
+
Author-email: Ameya Chopade <ameyasanjaychopade@gmail.com>
|
|
6
6
|
License-Expression: LicenseRef-Apache-2.0-with-Commons-Clause
|
|
7
7
|
Project-URL: Homepage, https://gitlytics.dev
|
|
8
8
|
Project-URL: Documentation, https://docs.gitlytics.dev
|
|
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
17
|
Classifier: Operating System :: OS Independent
|
|
17
18
|
Requires-Python: >=3.11
|
|
18
19
|
Description-Content-Type: text/markdown
|
|
@@ -29,7 +30,7 @@ Requires-Dist: python-multipart>=0.0.33; extra == "dashboard"
|
|
|
29
30
|
Provides-Extra: dev
|
|
30
31
|
Requires-Dist: pytest>=9.2.0; extra == "dev"
|
|
31
32
|
Requires-Dist: pytest-cov>=7.1.0; extra == "dev"
|
|
32
|
-
Requires-Dist:
|
|
33
|
+
Requires-Dist: httpx2>=2.16.2; extra == "dev"
|
|
33
34
|
Requires-Dist: anyio[trio]>=4.16.0; extra == "dev"
|
|
34
35
|
Requires-Dist: python-dotenv>=1.2.4; extra == "dev"
|
|
35
36
|
Dynamic: license-file
|
|
@@ -41,13 +42,13 @@ Dynamic: license-file
|
|
|
41
42
|
# Gitlytics
|
|
42
43
|
### Next-Gen GitHub Traffic Intelligence, Dynamic SVG Widgets & Automation
|
|
43
44
|
|
|
44
|
-
[](https://pypi.org/project/gitlytics/)
|
|
46
|
+
[](https://www.python.org/) <!-- Python-3.11+ -->
|
|
47
|
+
[](LICENSE)
|
|
48
|
+
[](https://fastapi.tiangolo.com/)
|
|
49
|
+
[](https://react.dev/)
|
|
50
|
+
[](https://dashboard.gitlytics.dev)
|
|
51
|
+
[](https://docs.gitlytics.dev)
|
|
51
52
|
|
|
52
53
|
<br/>
|
|
53
54
|
|
|
@@ -105,9 +106,9 @@ Elevate your GitHub profile README with the Gitlytics hosted native, dynamic vec
|
|
|
105
106
|
<img src="https://api.gitlytics.dev/api/cards/language-diversity/demo.svg?theme=dracula&v=3" alt="Language Diversity" width="95%" />
|
|
106
107
|
</td>
|
|
107
108
|
<td align="center" width="50%">
|
|
108
|
-
<b>📈
|
|
109
|
-
<sub>
|
|
110
|
-
<img src="https://api.gitlytics.dev/api/cards/
|
|
109
|
+
<b>📈 All Contributions</b> (Nord)<br/>
|
|
110
|
+
<sub>Commits, pull requests, issues & code reviews combined</sub><br/><br/>
|
|
111
|
+
<img src="https://api.gitlytics.dev/api/cards/combined-contributions/demo.svg?theme=nord&v=3" alt="All Contributions" width="95%" />
|
|
111
112
|
</td>
|
|
112
113
|
</tr>
|
|
113
114
|
</table>
|
|
@@ -137,7 +138,7 @@ Add any card to your GitHub `README.md` with a single line of Markdown:
|
|
|
137
138
|
| **Velocity** | `commit-velocity` | High-frequency commit trendlines, averages, and momentum. |
|
|
138
139
|
| **Trajectory** | `star-journey` | Milestone progression towards star milestones. |
|
|
139
140
|
| **Reviews** | `review-stats` | PR reviews conducted, turnaround latency, and acceptance rate. |
|
|
140
|
-
| **
|
|
141
|
+
| **Contributions** | `combined-contributions` | Commits, pull requests, issues & code reviews combined. |
|
|
141
142
|
| **Impact** | `open-source-impact` | Ecosystem reach, community forks, and public issue closure rate. |
|
|
142
143
|
|
|
143
144
|
*...and 21 more specialized cards available in the [Interactive Embed Studio](https://dashboard.gitlytics.dev/widgets).*
|
|
@@ -168,7 +169,7 @@ Generate clean capsule badges for your tech stack. Supports official brand logos
|
|
|
168
169
|

|
|
169
170
|
|
|
170
171
|
<!-- Custom text-only concept capsule -->
|
|
171
|
-

|
|
172
173
|
```
|
|
173
174
|
|
|
174
175
|
<div align="center">
|
|
@@ -228,14 +229,18 @@ gitlytics sync --token "ghp_your_token" --data-dir "./data"
|
|
|
228
229
|
# 4. Schedule automatic sync as a background cron job (e.g. daily at 11 PM)
|
|
229
230
|
gitlytics sync --token "ghp_your_token" --data-dir "./data" --schedule-cron "0 23 * * *"
|
|
230
231
|
|
|
231
|
-
# 5. Launch the React + FastAPI web analytics studio
|
|
232
|
+
# 5. Launch the React + FastAPI web analytics studio (loopback 127.0.0.1 by default)
|
|
232
233
|
gitlytics dashboard
|
|
233
234
|
|
|
235
|
+
# 5b. Bind to a non-loopback interface (requires explicit --public-bind; disables pre-loaded tokens)
|
|
236
|
+
gitlytics dashboard --host 0.0.0.0 --public-bind
|
|
237
|
+
|
|
234
238
|
# 6. Retrieve cumulative stargazer trajectory for a repository
|
|
235
239
|
gitlytics stars owner/repo --token "ghp_your_token"
|
|
236
240
|
```
|
|
237
241
|
|
|
238
242
|
> **CLI output contract:** the traffic table and the success summary go to **stdout**; every error and warning goes to **stderr**. Exit codes are meaningful - `0` success, `1` runtime/upstream failure, `2` bad input - so `gitlytics fetch ... > out.csv` never mixes diagnostics into your data.
|
|
243
|
+
> **Dashboard security:** `gitlytics dashboard` binds to `127.0.0.1` by default, does not promote ambient `GITHUB_TOKEN` automatically, and disables `--token`/`GITLYTICS_TOKEN` on `--public-bind` so remote users must authenticate with their own token. See [`SECURITY.md`](SECURITY.md) for details.
|
|
239
244
|
|
|
240
245
|
---
|
|
241
246
|
|
|
@@ -327,6 +332,6 @@ If Gitlytics has saved your repository data or elevated your profile, please con
|
|
|
327
332
|
|
|
328
333
|
---
|
|
329
334
|
|
|
330
|
-
## 📄 License
|
|
335
|
+
## 📄 License & Security
|
|
331
336
|
|
|
332
|
-
Distributed under **Apache License 2.0 + Commons Clause v1.0**. See [`LICENSE`](LICENSE) for full details.
|
|
337
|
+
Distributed under **Apache License 2.0 + Commons Clause v1.0**. See [`LICENSE`](LICENSE) for full details and [`SECURITY.md`](SECURITY.md) for our security policy and vulnerability reporting process.
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
# Gitlytics
|
|
6
6
|
### Next-Gen GitHub Traffic Intelligence, Dynamic SVG Widgets & Automation
|
|
7
7
|
|
|
8
|
-
[](https://pypi.org/project/gitlytics/)
|
|
9
|
+
[](https://www.python.org/) <!-- Python-3.11+ -->
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
[](https://fastapi.tiangolo.com/)
|
|
12
|
+
[](https://react.dev/)
|
|
13
|
+
[](https://dashboard.gitlytics.dev)
|
|
14
|
+
[](https://docs.gitlytics.dev)
|
|
15
15
|
|
|
16
16
|
<br/>
|
|
17
17
|
|
|
@@ -69,9 +69,9 @@ Elevate your GitHub profile README with the Gitlytics hosted native, dynamic vec
|
|
|
69
69
|
<img src="https://api.gitlytics.dev/api/cards/language-diversity/demo.svg?theme=dracula&v=3" alt="Language Diversity" width="95%" />
|
|
70
70
|
</td>
|
|
71
71
|
<td align="center" width="50%">
|
|
72
|
-
<b>📈
|
|
73
|
-
<sub>
|
|
74
|
-
<img src="https://api.gitlytics.dev/api/cards/
|
|
72
|
+
<b>📈 All Contributions</b> (Nord)<br/>
|
|
73
|
+
<sub>Commits, pull requests, issues & code reviews combined</sub><br/><br/>
|
|
74
|
+
<img src="https://api.gitlytics.dev/api/cards/combined-contributions/demo.svg?theme=nord&v=3" alt="All Contributions" width="95%" />
|
|
75
75
|
</td>
|
|
76
76
|
</tr>
|
|
77
77
|
</table>
|
|
@@ -101,7 +101,7 @@ Add any card to your GitHub `README.md` with a single line of Markdown:
|
|
|
101
101
|
| **Velocity** | `commit-velocity` | High-frequency commit trendlines, averages, and momentum. |
|
|
102
102
|
| **Trajectory** | `star-journey` | Milestone progression towards star milestones. |
|
|
103
103
|
| **Reviews** | `review-stats` | PR reviews conducted, turnaround latency, and acceptance rate. |
|
|
104
|
-
| **
|
|
104
|
+
| **Contributions** | `combined-contributions` | Commits, pull requests, issues & code reviews combined. |
|
|
105
105
|
| **Impact** | `open-source-impact` | Ecosystem reach, community forks, and public issue closure rate. |
|
|
106
106
|
|
|
107
107
|
*...and 21 more specialized cards available in the [Interactive Embed Studio](https://dashboard.gitlytics.dev/widgets).*
|
|
@@ -132,7 +132,7 @@ Generate clean capsule badges for your tech stack. Supports official brand logos
|
|
|
132
132
|

|
|
133
133
|
|
|
134
134
|
<!-- Custom text-only concept capsule -->
|
|
135
|
-

|
|
136
136
|
```
|
|
137
137
|
|
|
138
138
|
<div align="center">
|
|
@@ -192,14 +192,18 @@ gitlytics sync --token "ghp_your_token" --data-dir "./data"
|
|
|
192
192
|
# 4. Schedule automatic sync as a background cron job (e.g. daily at 11 PM)
|
|
193
193
|
gitlytics sync --token "ghp_your_token" --data-dir "./data" --schedule-cron "0 23 * * *"
|
|
194
194
|
|
|
195
|
-
# 5. Launch the React + FastAPI web analytics studio
|
|
195
|
+
# 5. Launch the React + FastAPI web analytics studio (loopback 127.0.0.1 by default)
|
|
196
196
|
gitlytics dashboard
|
|
197
197
|
|
|
198
|
+
# 5b. Bind to a non-loopback interface (requires explicit --public-bind; disables pre-loaded tokens)
|
|
199
|
+
gitlytics dashboard --host 0.0.0.0 --public-bind
|
|
200
|
+
|
|
198
201
|
# 6. Retrieve cumulative stargazer trajectory for a repository
|
|
199
202
|
gitlytics stars owner/repo --token "ghp_your_token"
|
|
200
203
|
```
|
|
201
204
|
|
|
202
205
|
> **CLI output contract:** the traffic table and the success summary go to **stdout**; every error and warning goes to **stderr**. Exit codes are meaningful - `0` success, `1` runtime/upstream failure, `2` bad input - so `gitlytics fetch ... > out.csv` never mixes diagnostics into your data.
|
|
206
|
+
> **Dashboard security:** `gitlytics dashboard` binds to `127.0.0.1` by default, does not promote ambient `GITHUB_TOKEN` automatically, and disables `--token`/`GITLYTICS_TOKEN` on `--public-bind` so remote users must authenticate with their own token. See [`SECURITY.md`](SECURITY.md) for details.
|
|
203
207
|
|
|
204
208
|
---
|
|
205
209
|
|
|
@@ -291,6 +295,6 @@ If Gitlytics has saved your repository data or elevated your profile, please con
|
|
|
291
295
|
|
|
292
296
|
---
|
|
293
297
|
|
|
294
|
-
## 📄 License
|
|
298
|
+
## 📄 License & Security
|
|
295
299
|
|
|
296
|
-
Distributed under **Apache License 2.0 + Commons Clause v1.0**. See [`LICENSE`](LICENSE) for full details.
|
|
300
|
+
Distributed under **Apache License 2.0 + Commons Clause v1.0**. See [`LICENSE`](LICENSE) for full details and [`SECURITY.md`](SECURITY.md) for our security policy and vulnerability reporting process.
|
|
@@ -1,28 +1,22 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
# setuptools >= 77 is required for
|
|
3
|
-
# project-table keys (AF2-LIB-11).
|
|
2
|
+
# setuptools >= 77 is required for PEP 639 license and license-files keys.
|
|
4
3
|
requires = ["setuptools>=77.0"]
|
|
5
4
|
build-backend = "setuptools.build_meta"
|
|
6
5
|
|
|
7
6
|
[project]
|
|
8
7
|
name = "gitlytics"
|
|
9
|
-
version = "0.
|
|
8
|
+
version = "0.8.0"
|
|
10
9
|
description = "Monitor and automate your GitHub repository traffic analytics."
|
|
11
10
|
readme = "README.md"
|
|
12
11
|
requires-python = ">=3.11"
|
|
13
|
-
#
|
|
14
|
-
# inlining the whole licence text into the wheel METADATA. The licence is
|
|
15
|
-
# Apache-2.0 with the Commons Clause, which has no upstream SPDX id, so the
|
|
16
|
-
# project uses a LicenseRef (AF2-LIB-11).
|
|
12
|
+
# Declare Apache-2.0 with Commons Clause using a PEP 639 LicenseRef identifier.
|
|
17
13
|
license = "LicenseRef-Apache-2.0-with-Commons-Clause"
|
|
18
14
|
license-files = ["LICENSE"]
|
|
19
15
|
authors = [
|
|
20
|
-
{ name = "Ameya Chopade", email = "
|
|
16
|
+
{ name = "Ameya Chopade", email = "ameyasanjaychopade@gmail.com" }
|
|
21
17
|
]
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
# python-dotenv was removed from runtime deps — the library never reads .env;
|
|
25
|
-
# only tests use it, so it lives in the [dev] extra below.
|
|
18
|
+
# Core runtime dependencies with minimum supported versions.
|
|
19
|
+
# python-dotenv lives in [dev] because only tests load .env files.
|
|
26
20
|
dependencies = [
|
|
27
21
|
"requests>=2.34.2",
|
|
28
22
|
"certifi>=2026.10.23",
|
|
@@ -42,6 +36,7 @@ classifiers = [
|
|
|
42
36
|
"Programming Language :: Python :: 3.11",
|
|
43
37
|
"Programming Language :: Python :: 3.12",
|
|
44
38
|
"Programming Language :: Python :: 3.13",
|
|
39
|
+
"Programming Language :: Python :: 3.14",
|
|
45
40
|
"Operating System :: OS Independent",
|
|
46
41
|
]
|
|
47
42
|
|
|
@@ -52,8 +47,7 @@ Repository = "https://github.com/ameyachopade/gitlytics"
|
|
|
52
47
|
"Bug Tracker" = "https://github.com/ameyachopade/gitlytics/issues"
|
|
53
48
|
|
|
54
49
|
[project.optional-dependencies]
|
|
55
|
-
#
|
|
56
|
-
# requirements.txt was including them as mandatory; that was wrong.
|
|
50
|
+
# Optional extras for the local FastAPI dashboard server.
|
|
57
51
|
dashboard = [
|
|
58
52
|
"fastapi>=0.162.0",
|
|
59
53
|
"uvicorn>=0.54.0",
|
|
@@ -62,9 +56,9 @@ dashboard = [
|
|
|
62
56
|
dev = [
|
|
63
57
|
"pytest>=9.2.0",
|
|
64
58
|
"pytest-cov>=7.1.0",
|
|
65
|
-
"
|
|
66
|
-
"anyio[trio]>=4.16.0",
|
|
67
|
-
"python-dotenv>=1.2.4" # only tests load .env
|
|
59
|
+
"httpx2>=2.16.2", # required by FastAPI TestClient in test_api.py
|
|
60
|
+
"anyio[trio]>=4.16.0", # async test support
|
|
61
|
+
"python-dotenv>=1.2.4" # only tests load .env files
|
|
68
62
|
]
|
|
69
63
|
|
|
70
64
|
|
|
@@ -76,7 +70,13 @@ where = ["src"]
|
|
|
76
70
|
include = ["gitlytics*"]
|
|
77
71
|
# `gitlytics*` also matches `gitlytics.__pycache__`, which setuptools would
|
|
78
72
|
# otherwise ship as a namespace package with host-specific `.pyc` files.
|
|
79
|
-
exclude = [
|
|
73
|
+
exclude = [
|
|
74
|
+
"gitlytics.__pycache__",
|
|
75
|
+
"gitlytics.__pycache__.*",
|
|
76
|
+
"gitlytics.*.__pycache__",
|
|
77
|
+
"*.__pycache__",
|
|
78
|
+
"*.__pycache__.*",
|
|
79
|
+
]
|
|
80
80
|
|
|
81
81
|
[tool.setuptools.package-data]
|
|
82
82
|
"gitlytics" = ["static/**/*", "static/*"]
|
|
@@ -89,12 +89,3 @@ testpaths = ["tests"]
|
|
|
89
89
|
python_files = ["test_*.py"]
|
|
90
90
|
python_classes = ["Test*"]
|
|
91
91
|
python_functions = ["test_*"]
|
|
92
|
-
# pytest-asyncio >= 1.x warns when the event-loop scope for async fixtures is
|
|
93
|
-
# left unset, and the default will change in a future release. Pin it
|
|
94
|
-
# explicitly so the suite is deterministic and warning-free.
|
|
95
|
-
asyncio_default_fixture_loop_scope = "function"
|
|
96
|
-
filterwarnings = [
|
|
97
|
-
"error::DeprecationWarning",
|
|
98
|
-
"error::PendingDeprecationWarning",
|
|
99
|
-
"default::starlette.exceptions.StarletteDeprecationWarning",
|
|
100
|
-
]
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Copyright (c) 2026 Ameya Sanjay Chopade
|
|
2
|
+
# SPDX-License-Identifier: LicenseRef-Apache-2.0-with-Commons-Clause
|
|
3
|
+
"""Public API facade for the gitlytics package."""
|
|
4
|
+
|
|
5
|
+
import logging
|
|
6
|
+
|
|
7
|
+
from ._version import __version__
|
|
8
|
+
from .core.stars import fetch_star_history
|
|
9
|
+
from .exceptions import (
|
|
10
|
+
GitHubAPIError,
|
|
11
|
+
GitHubRateLimitError,
|
|
12
|
+
GitlyticsError,
|
|
13
|
+
NoTrafficDataError,
|
|
14
|
+
StargazersRestrictedError,
|
|
15
|
+
StarHistoryFetchError,
|
|
16
|
+
TokenExpiredError,
|
|
17
|
+
)
|
|
18
|
+
from .io.atomic import _write_csv_safely, _write_json_safely
|
|
19
|
+
from .sdk import _coerce_metrics, fetch_traffic, serve_dashboard, sync
|
|
20
|
+
|
|
21
|
+
# Attach a silent NullHandler so library logs never surprise caller applications.
|
|
22
|
+
logging.getLogger(__name__).addHandler(logging.NullHandler())
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"fetch_traffic",
|
|
26
|
+
"fetch_star_history",
|
|
27
|
+
"sync",
|
|
28
|
+
"serve_dashboard",
|
|
29
|
+
"__version__",
|
|
30
|
+
"GitHubAPIError",
|
|
31
|
+
"GitHubRateLimitError",
|
|
32
|
+
"NoTrafficDataError",
|
|
33
|
+
"StarHistoryFetchError",
|
|
34
|
+
"StargazersRestrictedError",
|
|
35
|
+
"TokenExpiredError",
|
|
36
|
+
]
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Copyright (c) 2026 Ameya Sanjay Chopade
|
|
2
|
+
# SPDX-License-Identifier: LicenseRef-Apache-2.0-with-Commons-Clause
|
|
3
|
+
"""Entry point for `python -m gitlytics`."""
|
|
4
|
+
|
|
5
|
+
from gitlytics.cli import main
|
|
6
|
+
|
|
7
|
+
# Delegate directly to the CLI entrypoint when invoked as a module.
|
|
8
|
+
if __name__ == "__main__":
|
|
9
|
+
main()
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Copyright (c) 2026 Ameya Sanjay Chopade
|
|
2
|
+
# SPDX-License-Identifier: LicenseRef-Apache-2.0-with-Commons-Clause
|
|
3
|
+
"""Optional local FastAPI dashboard server (`pip install gitlytics[dashboard]`)."""
|
|
4
|
+
|
|
5
|
+
from .app import app, create_app
|
|
6
|
+
from .cache import (
|
|
7
|
+
_AUTH_CACHE_MAX,
|
|
8
|
+
_AUTH_CACHE_TTL,
|
|
9
|
+
_AUTH_NEG_TTL,
|
|
10
|
+
_CSV_CACHE,
|
|
11
|
+
_CSV_CACHE_LOCK,
|
|
12
|
+
_DEEP_STATS_CACHE,
|
|
13
|
+
_DEEP_STATS_CACHE_LOCK,
|
|
14
|
+
_DEEP_STATS_CACHE_MAX,
|
|
15
|
+
_DEEP_STATS_CACHE_TTL,
|
|
16
|
+
_TRAFFIC_CACHE,
|
|
17
|
+
_TRAFFIC_CACHE_LOCK,
|
|
18
|
+
_TRAFFIC_CACHE_MAX,
|
|
19
|
+
_TRAFFIC_CACHE_TTL,
|
|
20
|
+
_auth_cache,
|
|
21
|
+
_auth_cache_lock,
|
|
22
|
+
_cached_deep_stats,
|
|
23
|
+
_cached_live_traffic,
|
|
24
|
+
_normalize_csv_header,
|
|
25
|
+
_read_csv_cached,
|
|
26
|
+
_validate_token_cached,
|
|
27
|
+
)
|
|
28
|
+
from .routes import (
|
|
29
|
+
_MAX_UPLOAD_BYTES,
|
|
30
|
+
_SYNC_CSV_RE,
|
|
31
|
+
_fetch_username_data,
|
|
32
|
+
auth,
|
|
33
|
+
get_config,
|
|
34
|
+
get_star_history_endpoint,
|
|
35
|
+
get_traffic,
|
|
36
|
+
get_username_data,
|
|
37
|
+
get_username_data_by_path,
|
|
38
|
+
serve_index,
|
|
39
|
+
serve_spa_fallback,
|
|
40
|
+
upload_csv,
|
|
41
|
+
)
|
|
42
|
+
from .security import (
|
|
43
|
+
_ALLOWED_ORIGINS,
|
|
44
|
+
STATIC_DIR,
|
|
45
|
+
_env_token_allowed,
|
|
46
|
+
_get_token,
|
|
47
|
+
_parse_static_security_headers,
|
|
48
|
+
_require_browser_same_origin,
|
|
49
|
+
_require_upload_access,
|
|
50
|
+
_SecurityHeadersMiddleware,
|
|
51
|
+
_static_security_headers,
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
__all__ = [
|
|
55
|
+
"STATIC_DIR",
|
|
56
|
+
"app",
|
|
57
|
+
"create_app",
|
|
58
|
+
]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Copyright (c) 2026 Ameya Sanjay Chopade
|
|
2
|
+
# SPDX-License-Identifier: LicenseRef-Apache-2.0-with-Commons-Clause
|
|
3
|
+
"""FastAPI application factory and ASGI instance for the local dashboard."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from fastapi import FastAPI
|
|
8
|
+
from fastapi.middleware.cors import CORSMiddleware
|
|
9
|
+
from fastapi.staticfiles import StaticFiles
|
|
10
|
+
|
|
11
|
+
from .routes import router
|
|
12
|
+
from .security import _ALLOWED_ORIGINS, STATIC_DIR, _SecurityHeadersMiddleware
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def create_app() -> FastAPI:
|
|
16
|
+
"""Create and configure the local Gitlytics dashboard FastAPI app."""
|
|
17
|
+
application = FastAPI(title="GitHub Traffic API")
|
|
18
|
+
application.add_middleware(
|
|
19
|
+
CORSMiddleware,
|
|
20
|
+
allow_origins=_ALLOWED_ORIGINS,
|
|
21
|
+
allow_credentials=False,
|
|
22
|
+
allow_methods=["GET", "POST"],
|
|
23
|
+
allow_headers=["Content-Type", "Authorization"],
|
|
24
|
+
)
|
|
25
|
+
application.add_middleware(_SecurityHeadersMiddleware)
|
|
26
|
+
|
|
27
|
+
assets_dir = STATIC_DIR / "assets"
|
|
28
|
+
if assets_dir.exists():
|
|
29
|
+
application.mount("/assets", StaticFiles(directory=assets_dir), name="assets")
|
|
30
|
+
|
|
31
|
+
application.include_router(router)
|
|
32
|
+
return application
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
app = create_app()
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Copyright (c) 2026 Ameya Sanjay Chopade
|
|
2
|
+
# SPDX-License-Identifier: LicenseRef-Apache-2.0-with-Commons-Clause
|
|
3
|
+
"""Thread-safe bounded TTL/LRU caches for the local dashboard server."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
import hashlib
|
|
8
|
+
import threading as _threading
|
|
9
|
+
import time as _time
|
|
10
|
+
from collections import OrderedDict
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
import pandas as pd
|
|
14
|
+
|
|
15
|
+
from gitlytics.core.repos import fetch_deep_stats_for_top
|
|
16
|
+
from gitlytics.core.traffic import fetch_traffic_data
|
|
17
|
+
from gitlytics.core.users import validate_token
|
|
18
|
+
from gitlytics.io.csv import normalize_csv_dataframe
|
|
19
|
+
|
|
20
|
+
# Token validation cache: positive results cache 5m, failures 10s so blips recover fast.
|
|
21
|
+
_auth_cache: "OrderedDict[str, tuple]" = OrderedDict()
|
|
22
|
+
_auth_cache_lock = _threading.Lock()
|
|
23
|
+
_AUTH_CACHE_TTL = 300
|
|
24
|
+
_AUTH_NEG_TTL = 10
|
|
25
|
+
_AUTH_CACHE_MAX = 256
|
|
26
|
+
|
|
27
|
+
# Historical CSV cache keyed by (resolved path, mtime) with mtime_ns + size verification.
|
|
28
|
+
_CSV_CACHE: "OrderedDict[tuple[str, float], tuple[int, int, pd.DataFrame]]" = (
|
|
29
|
+
OrderedDict()
|
|
30
|
+
)
|
|
31
|
+
_CSV_CACHE_LOCK = _threading.Lock()
|
|
32
|
+
|
|
33
|
+
# Short-lived caches for live GitHub traffic and top-20 deep repository stats.
|
|
34
|
+
_TRAFFIC_CACHE: "OrderedDict[str, tuple[float, pd.DataFrame]]" = OrderedDict()
|
|
35
|
+
_TRAFFIC_CACHE_LOCK = _threading.Lock()
|
|
36
|
+
_TRAFFIC_CACHE_TTL = 120.0
|
|
37
|
+
_TRAFFIC_CACHE_MAX = 16
|
|
38
|
+
|
|
39
|
+
_DEEP_STATS_CACHE: "OrderedDict[tuple, tuple[float, dict]]" = OrderedDict()
|
|
40
|
+
_DEEP_STATS_CACHE_LOCK = _threading.Lock()
|
|
41
|
+
_DEEP_STATS_CACHE_TTL = 300.0
|
|
42
|
+
_DEEP_STATS_CACHE_MAX = 16
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _normalize_csv_header(df: pd.DataFrame) -> pd.DataFrame:
|
|
46
|
+
"""Normalize CSV column headers using the shared io.csv helper."""
|
|
47
|
+
return normalize_csv_dataframe(df)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _validate_token_cached(token: str) -> tuple[bool, str]:
|
|
51
|
+
"""Validate a GitHub token with bounded thread-safe LRU/TTL caching."""
|
|
52
|
+
key = hashlib.sha256(token.encode()).hexdigest()
|
|
53
|
+
now = _time.time()
|
|
54
|
+
with _auth_cache_lock:
|
|
55
|
+
cached = _auth_cache.get(key)
|
|
56
|
+
if cached is not None:
|
|
57
|
+
valid, username, expires = cached
|
|
58
|
+
if now < expires:
|
|
59
|
+
_auth_cache.move_to_end(key)
|
|
60
|
+
return valid, username
|
|
61
|
+
|
|
62
|
+
valid, username = validate_token(token)
|
|
63
|
+
ttl = _AUTH_CACHE_TTL if valid else _AUTH_NEG_TTL
|
|
64
|
+
with _auth_cache_lock:
|
|
65
|
+
_auth_cache[key] = (valid, username, now + ttl)
|
|
66
|
+
_auth_cache.move_to_end(key)
|
|
67
|
+
while len(_auth_cache) > _AUTH_CACHE_MAX:
|
|
68
|
+
_auth_cache.popitem(last=False)
|
|
69
|
+
return valid, username
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _read_csv_cached(path: Path) -> pd.DataFrame:
|
|
73
|
+
"""Read and normalize a CSV archive file, reusing cached frames when unchanged on disk."""
|
|
74
|
+
try:
|
|
75
|
+
st = path.stat()
|
|
76
|
+
except OSError:
|
|
77
|
+
return _normalize_csv_header(pd.read_csv(path))
|
|
78
|
+
|
|
79
|
+
key = (str(path.resolve()), st.st_mtime)
|
|
80
|
+
with _CSV_CACHE_LOCK:
|
|
81
|
+
cached = _CSV_CACHE.get(key)
|
|
82
|
+
if cached is not None:
|
|
83
|
+
c_ns, c_size, c_df = cached
|
|
84
|
+
if c_ns == st.st_mtime_ns and c_size == st.st_size:
|
|
85
|
+
_CSV_CACHE.move_to_end(key)
|
|
86
|
+
return c_df.copy()
|
|
87
|
+
|
|
88
|
+
df = _normalize_csv_header(pd.read_csv(path))
|
|
89
|
+
with _CSV_CACHE_LOCK:
|
|
90
|
+
_CSV_CACHE[key] = (st.st_mtime_ns, st.st_size, df.copy())
|
|
91
|
+
_CSV_CACHE.move_to_end(key)
|
|
92
|
+
while len(_CSV_CACHE) > 128:
|
|
93
|
+
_CSV_CACHE.popitem(last=False)
|
|
94
|
+
return df
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def _cached_live_traffic(token: str) -> pd.DataFrame:
|
|
98
|
+
"""Fetch live traffic for a token with a short TTL cache; never caches empty frames."""
|
|
99
|
+
key = hashlib.sha256(token.encode()).hexdigest()
|
|
100
|
+
now = _time.time()
|
|
101
|
+
with _TRAFFIC_CACHE_LOCK:
|
|
102
|
+
hit = _TRAFFIC_CACHE.get(key)
|
|
103
|
+
if hit is not None:
|
|
104
|
+
expires, frame = hit
|
|
105
|
+
if now < expires:
|
|
106
|
+
_TRAFFIC_CACHE.move_to_end(key)
|
|
107
|
+
return frame.copy()
|
|
108
|
+
|
|
109
|
+
frame = fetch_traffic_data(token)
|
|
110
|
+
if not frame.empty:
|
|
111
|
+
with _TRAFFIC_CACHE_LOCK:
|
|
112
|
+
_TRAFFIC_CACHE[key] = (now + _TRAFFIC_CACHE_TTL, frame.copy())
|
|
113
|
+
_TRAFFIC_CACHE.move_to_end(key)
|
|
114
|
+
while len(_TRAFFIC_CACHE) > _TRAFFIC_CACHE_MAX:
|
|
115
|
+
_TRAFFIC_CACHE.popitem(last=False)
|
|
116
|
+
return frame
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def _cached_deep_stats(
|
|
120
|
+
token: str, repos_with_views: list[dict], top_n: int = 20
|
|
121
|
+
) -> dict:
|
|
122
|
+
"""Cache concurrent deep-stats results for the top N viewed repositories."""
|
|
123
|
+
top_names = tuple(
|
|
124
|
+
r["repository"]
|
|
125
|
+
for r in sorted(
|
|
126
|
+
repos_with_views, key=lambda x: x.get("total_views", 0), reverse=True
|
|
127
|
+
)[:top_n]
|
|
128
|
+
)
|
|
129
|
+
key = (hashlib.sha256(token.encode()).hexdigest(), top_names)
|
|
130
|
+
now = _time.time()
|
|
131
|
+
with _DEEP_STATS_CACHE_LOCK:
|
|
132
|
+
hit = _DEEP_STATS_CACHE.get(key)
|
|
133
|
+
if hit is not None:
|
|
134
|
+
expires, stats = hit
|
|
135
|
+
if now < expires:
|
|
136
|
+
_DEEP_STATS_CACHE.move_to_end(key)
|
|
137
|
+
return dict(stats)
|
|
138
|
+
|
|
139
|
+
stats = fetch_deep_stats_for_top(token, repos_with_views, top_n=top_n)
|
|
140
|
+
if stats:
|
|
141
|
+
with _DEEP_STATS_CACHE_LOCK:
|
|
142
|
+
_DEEP_STATS_CACHE[key] = (now + _DEEP_STATS_CACHE_TTL, dict(stats))
|
|
143
|
+
_DEEP_STATS_CACHE.move_to_end(key)
|
|
144
|
+
while len(_DEEP_STATS_CACHE) > _DEEP_STATS_CACHE_MAX:
|
|
145
|
+
_DEEP_STATS_CACHE.popitem(last=False)
|
|
146
|
+
return stats
|