Skip to content

Commit 96e4b3f

Browse files
authored
Add commitrocket package with batching, LFS, resume and CI (#1)
Turn the commit_and_push script into an installable package (uv, hatchling) with a `commitrocket` command and `commitrocket doctor`. - Batch pending files by size (deterministic, sequential, soft) and commit and push each batch with live progress and an average-speed ETA. - Git LFS support for large files: local-only rules by default, optional committed rules, configurable threshold, grouped uploads and thread settings. - Reliability: dry run, push retries, resume after failure or interruption, stuck-commit detection, post-push verification, http.postBuffer tuning. - Usability: config file, include/exclude patterns, remote/branch selection, no-push mode, commit message templates, JSON report and notifications. - Per-run log files in the OS-standard log folder. - Never commit the run's own log or report files. - Tests (unit and marked integration), pre-commit, and GitHub workflows for lint, tests and PyPI release.
1 parent 0f43e01 commit 96e4b3f

51 files changed

Lines changed: 5501 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/lint.yml‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
concurrency:
9+
group: lint-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
ruff:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- uses: astral-sh/setup-uv@v5
22+
23+
- name: Install
24+
run: uv sync --python 3.11
25+
26+
- name: Ruff
27+
run: uv run ruff check .

‎.github/workflows/release.yml‎

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Release
2+
3+
# Publishes to PyPI when a version tag such as v0.2.0 is pushed.
4+
# Needs a PYPI_API_TOKEN secret (Settings > Secrets and variables > Actions).
5+
on:
6+
push:
7+
tags: ["v*.*.*"]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
check:
14+
name: Check version and tests
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: astral-sh/setup-uv@v5
20+
21+
- name: Tag must match the package version
22+
shell: bash
23+
run: |
24+
tag="${GITHUB_REF_NAME#v}"
25+
project=$(python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
26+
module=$(python3 -c "import re; print(re.search(r'__version__ = \"(.+?)\"', open('src/commitrocket/__init__.py').read()).group(1))")
27+
echo "tag=$tag pyproject=$project __init__=$module"
28+
if [ "$tag" != "$project" ] || [ "$tag" != "$module" ]; then
29+
echo "::error::Tag v$tag must match the version in pyproject.toml ($project) and src/commitrocket/__init__.py ($module)."
30+
exit 1
31+
fi
32+
33+
- name: Install
34+
run: uv sync --python 3.11
35+
36+
- name: Lint
37+
run: uv run ruff check .
38+
39+
- name: Unit tests
40+
run: uv run pytest -m "not integration"
41+
42+
- name: Integration tests
43+
run: uv run pytest -m integration
44+
45+
publish:
46+
name: Build and publish
47+
needs: check
48+
runs-on: ubuntu-latest
49+
environment: pypi
50+
permissions:
51+
contents: write
52+
steps:
53+
- uses: actions/checkout@v4
54+
55+
- uses: astral-sh/setup-uv@v5
56+
57+
- name: Build
58+
run: uv build
59+
60+
- name: Publish to PyPI
61+
env:
62+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
63+
run: uv publish
64+
65+
- name: GitHub release
66+
uses: softprops/action-gh-release@v2
67+
with:
68+
generate_release_notes: true
69+
files: dist/*

‎.github/workflows/tests.yml‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
concurrency:
9+
group: tests-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
test:
17+
name: ${{ matrix.os }} / Python ${{ matrix.python }}
18+
runs-on: ${{ matrix.os }}
19+
# Python 3.15 may still be a pre-release; don't let it block the build.
20+
continue-on-error: ${{ matrix.python == '3.15' }}
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
include:
25+
- { os: ubuntu-latest, python: "3.11" }
26+
- { os: ubuntu-latest, python: "3.12" }
27+
- { os: ubuntu-latest, python: "3.13" }
28+
- { os: ubuntu-latest, python: "3.14" }
29+
- { os: ubuntu-latest, python: "3.15" }
30+
- { os: windows-latest, python: "3.11" }
31+
- { os: macos-latest, python: "3.11" }
32+
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- uses: astral-sh/setup-uv@v5
37+
38+
- name: Install
39+
run: uv sync --python ${{ matrix.python }}
40+
41+
- name: Unit tests
42+
run: uv run pytest -m "not integration" -n auto
43+
44+
- name: Integration tests
45+
run: uv run pytest -m integration -n auto

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,6 @@ __marimo__/
218218

219219
# Streamlit
220220
.streamlit/secrets.toml
221+
222+
CLAUDE.md
223+
.temp/

‎.pre-commit-config.yaml‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Install once with: uv run pre-commit install
2+
# Integration tests (marker "integration") are slower and run only in CI.
3+
repos:
4+
- repo: https://github.com/astral-sh/ruff-pre-commit
5+
rev: v0.17.2
6+
hooks:
7+
- id: ruff
8+
args: [--fix, --exit-non-zero-on-fix]
9+
10+
- repo: local
11+
hooks:
12+
- id: pytest
13+
name: pytest (unit tests)
14+
entry: uv run pytest -m "not integration" -n auto -q
15+
language: system
16+
types: [python]
17+
pass_filenames: false

‎.python-version‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11

‎CHANGELOG.md‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Changelog
2+
3+
## [Unreleased]
4+
5+
## [0.1.0] - 2026-10-24
6+
7+
### Added
8+
- CommitRocket is now an installable package with a `commitrocket` command.
9+
- Files over 100 MiB are detected up front, and the run stops with a hint to use `--use-lfs` instead of failing at push time.
10+
- The overall progress bar shows an ETA based on the average speed of the whole run so far, updating live during each upload.
11+
- `--use-lfs` stores files over 100 MiB with Git LFS during the run, without committing any LFS config, and removes the local setup afterwards.
12+
- `--report FILE` writes a machine-readable JSON summary of every run.
13+
- `--notify` and `--notify-webhook` tell you when a run ends, via a desktop notification or a web hook.
14+
- `commitrocket doctor` checks Git, git-lfs, your settings, the remote and the repository before a run.
15+
- Settings can be saved in `commitrocket.toml` or `[tool.commitrocket]` in `pyproject.toml`.
16+
- `--include`, `--exclude`, `--include-from`, `--exclude-from` and `.commitrocketignore` choose which files are handled, using `.gitignore`-style patterns.
17+
- `--remote` and `--branch` choose where to push, `--no-push` only commits, and `--message-template` customises commit messages.
18+
- `--lfs-commit-rules` commits LFS rules per file type so clones get the real files.
19+
- A failed `--use-lfs` run now keeps the LFS hooks until its commits are pushed, so LFS files are never published as bare pointers.
20+
- `--repo` now defaults to the current folder.
21+
- A `--log-file` or `--report` inside the repository is no longer committed, which previously made a run commit its own log forever.
22+
- `--dry-run` shows the planned batches and commit messages without changing anything.
23+
- Failed pushes are retried with growing waits (`--retries`, default 3); rejections are not retried.
24+
- Interrupted or failed runs can be resumed by running the same command again.
25+
- `--post-buffer-mib` raises Git's HTTP buffer for large pushes over HTTPS.
26+
- Each push is checked against the remote, and LFS files are confirmed as pointers before upload.
27+
- `--lfs-threshold-mib` sets the size above which `--use-lfs` applies (default 100); `0` sends every file through LFS.
28+
- Each run writes a log file to the system's standard log folder; `--level` sets the detail and `--log-file` overrides the location.
29+
- `--batch-type` chooses how files are grouped: `deterministic` (default, unchanged), `sequential` or `soft`.
30+
- `--compression-threads`, `--lfs-threads` and `--lfs-batch-mib` speed up pushes; the thread settings apply to the repository only and are restored afterwards.
31+
- Leftover local commits containing files over 100 MiB are detected at startup, with the command to clean them up.

0 commit comments

Comments
 (0)