Skip to content

feat: group python version by minor - #24

Merged
psincraian merged 2 commits into
mainfrom
claude/group-python-versions-minor-01T2Mpxr7UhEjdoAsoGC6dY1
Nov 15, 2025
Merged

psincraian merged 2 commits into
mainfrom
claude/group-python-versions-minor-01T2Mpxr7UhEjdoAsoGC6dY1

Conversation

@psincraian

Copy link
Copy Markdown
Owner

No description provided.

Modified Python version analytics to group by minor version (e.g., 3.14)
instead of patch version (e.g., 3.14.1, 3.14.2) for cleaner dashboard metrics.

Changes:
- Updated get_python_version_distribution() to extract and group by major.minor
- Updated get_unique_python_versions_count() to count unique minor versions
- Updated get_unique_users_by_dimension() to handle python_version dimension with minor version grouping

Uses PostgreSQL regexp_replace to extract "3.14" from versions like "3.14.1", "3.14.2", etc.
Added support for both PostgreSQL and SQLite databases in Python version
minor version extraction logic. This allows tests to run on SQLite while
production uses PostgreSQL.

Changes:
- Added _extract_minor_version() helper method in AnalyticsEventRepository
  - PostgreSQL: Uses regexp_replace for version extraction
  - SQLite: Uses substr/instr for version extraction
- Updated get_python_version_distribution() to use helper method
- Updated get_unique_python_versions_count() to use helper method
- Updated get_unique_users_by_dimension() to use helper method
- Added comprehensive test suite in test_python_version_grouping.py
  - Tests version distribution grouping
  - Tests unique version counting
  - Tests user grouping by version
  - Tests edge case of already-minor versions

All tests pass, linting clean, type checking passes.
@psincraian
psincraian merged commit 544b130 into main Nov 15, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants