gitlytics 0.2.2__tar.gz → 0.3.2__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.
Files changed (46) hide show
  1. {gitlytics-0.2.2 → gitlytics-0.3.2}/PKG-INFO +1 -1
  2. {gitlytics-0.2.2 → gitlytics-0.3.2}/pyproject.toml +1 -1
  3. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/__init__.py +1 -1
  4. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/core.py +18 -2
  5. gitlytics-0.3.2/src/gitlytics/static/assets/index-0jm8mzmF.js +127 -0
  6. gitlytics-0.3.2/src/gitlytics/static/assets/index-ClrHOmX2.css +1 -0
  7. gitlytics-0.2.2/src/gitlytics/static/assets/index.es-BArdAPDI.js → gitlytics-0.3.2/src/gitlytics/static/assets/index.es-BgNblKBK.js +1 -1
  8. gitlytics-0.2.2/src/gitlytics/static/assets/jspdf.es.min-RN_PhxQY.js → gitlytics-0.3.2/src/gitlytics/static/assets/jspdf.es.min-D0gHkC9f.js +3 -3
  9. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/static/index.html +2 -2
  10. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics.egg-info/PKG-INFO +1 -1
  11. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics.egg-info/SOURCES.txt +4 -4
  12. gitlytics-0.2.2/src/gitlytics/static/assets/index-CEcch8Fa.css +0 -1
  13. gitlytics-0.2.2/src/gitlytics/static/assets/index-DRUIdkFE.js +0 -87
  14. {gitlytics-0.2.2 → gitlytics-0.3.2}/LICENSE +0 -0
  15. {gitlytics-0.2.2 → gitlytics-0.3.2}/README.md +0 -0
  16. {gitlytics-0.2.2 → gitlytics-0.3.2}/setup.cfg +0 -0
  17. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/__main__.py +0 -0
  18. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/api.py +0 -0
  19. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/automation.py +0 -0
  20. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/cli.py +0 -0
  21. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/process.py +0 -0
  22. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/static/android-chrome-192x192.png +0 -0
  23. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/static/android-chrome-512x512.png +0 -0
  24. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/static/apple-touch-icon.png +0 -0
  25. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/static/assets/html2canvas-pro.esm-9xys3ejh.js +0 -0
  26. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/static/assets/html2canvas.esm-DXEQVQnt.js +0 -0
  27. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/static/assets/purify.es-CC4Brkr_.js +0 -0
  28. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/static/favicon-16x16.png +0 -0
  29. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/static/favicon-32x32.png +0 -0
  30. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/static/favicon-48x48.png +0 -0
  31. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/static/favicon.ico +0 -0
  32. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/static/gitlytics-logo.png +0 -0
  33. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/static/google-search-icon-48x48.png +0 -0
  34. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/static/google-search-icon.png +0 -0
  35. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/static/robots.txt +0 -0
  36. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics/static/sitemap.xml +0 -0
  37. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics.egg-info/dependency_links.txt +0 -0
  38. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics.egg-info/entry_points.txt +0 -0
  39. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics.egg-info/requires.txt +0 -0
  40. {gitlytics-0.2.2 → gitlytics-0.3.2}/src/gitlytics.egg-info/top_level.txt +0 -0
  41. {gitlytics-0.2.2 → gitlytics-0.3.2}/tests/test_api.py +0 -0
  42. {gitlytics-0.2.2 → gitlytics-0.3.2}/tests/test_automation.py +0 -0
  43. {gitlytics-0.2.2 → gitlytics-0.3.2}/tests/test_cli.py +0 -0
  44. {gitlytics-0.2.2 → gitlytics-0.3.2}/tests/test_core.py +0 -0
  45. {gitlytics-0.2.2 → gitlytics-0.3.2}/tests/test_process.py +0 -0
  46. {gitlytics-0.2.2 → gitlytics-0.3.2}/tests/test_username.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitlytics
3
- Version: 0.2.2
3
+ Version: 0.3.2
4
4
  Summary: Monitor and automate your GitHub repository traffic analytics.
5
5
  Author-email: Ameya Chopade <ameyaccod171@gmail.com>
6
6
  License: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "gitlytics"
7
- version = "0.2.2"
7
+ version = "0.3.2"
8
8
  description = "Monitor and automate your GitHub repository traffic analytics."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -9,7 +9,7 @@ from pathlib import Path
9
9
 
10
10
  # Single source of truth for the package version.
11
11
  # Mirrors the version in pyproject.toml — keep them in sync.
12
- __version__ = "0.2.2"
12
+ __version__ = "0.3.2"
13
13
 
14
14
  __all__ = ["fetch_traffic", "sync", "serve_dashboard", "__version__"]
15
15
 
@@ -25,6 +25,7 @@ _GITHUB_BASE_HEADERS = {
25
25
  _PUBLIC_HEADERS = dict(_GITHUB_BASE_HEADERS)
26
26
  _MAX_RELEASE_PAGES = 10 # hard cap when walking /releases
27
27
  _MAX_PR_PAGES = 10 # hard cap when walking /pulls
28
+ _MAX_COMMIT_PAGES = 50 # hard cap when counting /commits (50 * 100 = 5000)
28
29
  _PER_PAGE = 100 # request size for paginated endpoints
29
30
 
30
31
 
@@ -254,13 +255,28 @@ def get_deep_repo_stats(token: str, full_name: str) -> dict:
254
255
  }
255
256
 
256
257
  # Commit activity — GitHub computes this async and returns 202 when not ready.
257
- # total_commits here is the trailing 52-week (12-month) sum, NOT lifetime.
258
+ # NOTE: stats/commit_activity only reports the trailing 52-week window, so for
259
+ # repos where the user expects to see lifetime history we count via
260
+ # /repos/{full_name}/commits?per_page=100 and walk pages. GitHub hard-caps
261
+ # /commits at ~1000 results on a single unauthenticated/traffic endpoint, so
262
+ # the lifetime count returned here is the lifetime visible to the API.
258
263
  ca_url = f"{BASE}/repos/{full_name}/stats/commit_activity"
259
264
  ca_data, status = _safe_get(ca_url, h)
260
265
  if status == 202:
261
266
  logger.info(f"Commit activity not ready yet (202) for {full_name}; will populate on next fetch.")
262
- if isinstance(ca_data, list):
267
+ if isinstance(ca_data, list) and ca_data:
263
268
  stats["total_commits"] = sum(week.get("total", 0) for week in ca_data)
269
+ else:
270
+ # Fall back to a lifetime count when stats/commit_activity is empty or
271
+ # not yet computed (202 / empty list). Walking /commits is slower but
272
+ # always returns the real lifetime history for repos under ~10k commits.
273
+ commits_url = f"{BASE}/repos/{full_name}/commits"
274
+ try:
275
+ stats["total_commits"] = _walk_paginated_count(
276
+ commits_url, h, {"per_page": _PER_PAGE}, _MAX_COMMIT_PAGES
277
+ )
278
+ except Exception as exc:
279
+ logger.warning(f"Could not fetch commit count for {full_name}: {exc}")
264
280
 
265
281
  # Open PRs — walk pages because GitHub's /pulls endpoint doesn't return a total.
266
282
  pr_url = f"{BASE}/repos/{full_name}/pulls"