Commit statistics from Bitbucket Cloud — get a per-user commit report for any workspace or repository over a date range. Uses the Bitbucket REST API; no server-side filtering by date/author exists, so this tool fetches and aggregates client-side.
- Per-user commit counts for a given date range
- Single repo or entire workspace — omit
--repoto scan all repositories in a workspace - Optional branch filter — e.g. only
mainordevelop - Progress bars — repo progress and per-repo commit progress (powered by tqdm)
- Credentials via
.env— no need to export secrets in the shell
- Python 3.8+
- Bitbucket Cloud account with access to the workspace/repos you want to report on
- API token with at least Repository read (Bitbucket → Personal settings → API tokens)
git clone https://github.com/qrstuff/commitstats.git
cd commitstatspython3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txtCopy the example env file and add your Bitbucket credentials:
cp .env.example .envEdit .env and set:
BITBUCKET_USER— your Bitbucket account email (not username)BITBUCKET_APP_PASSWORD— your API token (or create one: Personal settings → API tokens → Create token, scope: Repository read)
BITBUCKET_USER=you@example.com
BITBUCKET_APP_PASSWORD=your-api-tokenImportant: Never commit
.env— it is listed in.gitignore. Use.env.exampleas a template only.
All repositories in a workspace (e.g. 69 repos):
python get_commit_report.py --workspace YOUR_WORKSPACE --from 2025-01-01 --to 2025-01-31Single repository:
python get_commit_report.py --workspace YOUR_WORKSPACE --repo my-repo --from 2025-01-01 --to 2025-01-31Only a specific branch (e.g. main):
python get_commit_report.py --workspace YOUR_WORKSPACE --from 2025-01-01 --to 2025-01-31 --branch mainRepos: 100%|██████████| 3/3 [00:45<00:00, 15.2s/ repo]
Repo 3/3: my-repo: 1200/1200 commits [00:12, 98.3 commits/s]
Commits in 2025-01-01 .. 2025-01-31 (workspace MYWORKSPACE, branch: default): 342
User (display) Count
---------------------------------------------
Alice Smith 89
Bob Jones 72
Carol Lee 58
...
| Option | Required | Description |
|---|---|---|
--workspace |
Yes | Bitbucket workspace (team) slug |
--repo |
No | Repository slug. If omitted, all repos in the workspace are scanned |
--from |
Yes | Start date (YYYY-MM-DD) |
--to |
Yes | End date (YYYY-MM-DD) |
--branch |
No | Limit to a branch (e.g. main, develop) |
--pagelen |
No | API page size (default: 100) |
- 401 Unauthorized — Check that
BITBUCKET_USERis your email, that the token is valid and has Repository read, and that you have access to the workspace. - No repositories found — Verify the workspace slug and that your account is a member (or has access) to that workspace.
- Progress bar looks wrong — Ensure
tqdmis installed (pip install -r requirements.txt). The script still runs without it.
This project is licensed under the MIT License — see LICENSE for details.