Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 35 additions & 63 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,43 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install UV
uses: astral-sh/setup-uv@v4
with:
version: "latest"

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip dependencies
- name: Cache uv dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
path: ~/.cache/uv
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-uv-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pre-commit
uv sync --dev

- name: Lint with pre-commit
run: pre-commit run --all-files
run: |
uv run pre-commit run --all-files -c dev/pre-commit-config.yaml

- name: Validate changelog
run: |
python dev/scripts/validate_changelog.py || {
uv run python dev/scripts/validate_changelog.py || {
echo "⚠️ Changelog validation failed. This is a warning for CI."
echo "Please ensure dev/CHANGELOG.md is updated with your changes."
exit 0 # Don't fail CI, just warn
}

- name: Test with pytest
run: |
pytest tests/ -v --cov=ccbt --cov-report=xml --cov-report=html
uv run pytest -c dev/pytest.ini tests/ -v --cov=ccbt --cov-report=xml --cov-report=html

- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
Expand Down Expand Up @@ -86,21 +90,25 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install UV
uses: astral-sh/setup-uv@v4
with:
version: "latest"

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
uv sync --dev

- name: Run performance benchmarks
run: |
python benchmarks/bench_throughput.py
python benchmarks/bench_disk.py
python benchmarks/bench_hash_verification.py
uv run python benchmarks/bench_throughput.py
uv run python benchmarks/bench_disk.py
uv run python benchmarks/bench_hash_verification.py

docs:
runs-on: ubuntu-latest
Expand All @@ -114,64 +122,28 @@ jobs:
with:
fetch-depth: 0

- name: Install UV
uses: astral-sh/setup-uv@v4
with:
version: "latest"

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install mkdocs mkdocs-material mkdocs-i18n mkdocstrings[python]
uv sync --dev

- name: Build documentation
run: |
uv run python << 'PYTHON_EOF'
# Apply patch BEFORE importing mkdocs
import mkdocs_static_i18n
from mkdocs_static_i18n.plugin import I18n
import mkdocs_static_i18n.reconfigure

# Store original functions
original_is_relative_to = mkdocs_static_i18n.is_relative_to
original_reconfigure_files = I18n.reconfigure_files

# Create patched functions
def patched_is_relative_to(src_path, dest_path):
if src_path is None:
return False
try:
return original_is_relative_to(src_path, dest_path)
except (TypeError, AttributeError):
return False

def patched_reconfigure_files(self, files, mkdocs_config):
valid_files = [f for f in files if hasattr(f, 'abs_src_path') and f.abs_src_path is not None]
invalid_files = [f for f in files if not hasattr(f, 'abs_src_path') or f.abs_src_path is None]
if valid_files:
result = original_reconfigure_files(self, valid_files, mkdocs_config)
# Add invalid files back using append (I18nFiles is not a list)
if invalid_files:
for invalid_file in invalid_files:
result.append(invalid_file)
return result
# If no valid files, return original files object (shouldn't happen but safe fallback)
return files

# Apply patches - patch the source module first
mkdocs_static_i18n.is_relative_to = patched_is_relative_to
# Patch the local reference in reconfigure module (it imports from __init__)
mkdocs_static_i18n.reconfigure.is_relative_to = patched_is_relative_to
# Patch the reconfigure_files method on the I18n class
I18n.reconfigure_files = patched_reconfigure_files

# Now import and run mkdocs in the same process
import sys
from mkdocs.__main__ import cli
sys.argv = ['mkdocs', 'build', '--strict', '-f', 'dev/mkdocs.yml']
cli()
PYTHON_EOF
# Use the patched build script which includes all necessary patches:
# - i18n plugin fixes (alternates attribute, Locale validation for 'arc')
# - git-revision-date-localized plugin fix for 'arc' locale
# - All patches are applied before mkdocs is imported
# Set MKDOCS_STRICT=true to enable strict mode in CI
MKDOCS_STRICT=true uv run python dev/build_docs_patched_clean.py

- name: Validate translations
run: |
Expand Down
2 changes: 0 additions & 2 deletions ccbt/consensus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,3 @@
"RaftState",
"RaftStateType",
]


2 changes: 0 additions & 2 deletions ccbt/session/download_startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
This module handles the initialization and startup sequence for torrent downloads,
including metadata retrieval, piece manager setup, and initial peer connections.
"""


2 changes: 0 additions & 2 deletions ccbt/session/manager_startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
This module handles the startup sequence for the session manager, including
component initialization, service startup, and background task coordination.
"""


1 change: 1 addition & 0 deletions docs/overrides/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ If you're a native speaker of any of these languages and would like to contribut




1 change: 1 addition & 0 deletions docs/overrides/README_RTD.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@ If builds fail on Read the Docs:




1 change: 1 addition & 0 deletions docs/overrides/partials/languages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,4 @@ If you're a native speaker, please contribute translations by:




1 change: 1 addition & 0 deletions docs/overrides/partials/languages/arc.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@




1 change: 1 addition & 0 deletions docs/overrides/partials/languages/ha.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,4 @@




1 change: 1 addition & 0 deletions docs/overrides/partials/languages/sw.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,4 @@




1 change: 1 addition & 0 deletions docs/overrides/partials/languages/yo.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,4 @@




Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"meta": {
"benchmark": "hash_verify",
"config": "performance",
"timestamp": "2025-12-31T15:56:19.829723+00:00",
"platform": {
"system": "Windows",
"release": "11",
"python": "3.13.3"
},
"git": {
"commit_hash": "32b1ca9a87bb5fa5a113702986b04317e335c719",
"commit_hash_short": "32b1ca9",
"branch": "addssessionrefactor",
"author": "Joseph Pollack",
"is_dirty": false
}
},
"results": [
{
"size_bytes": 1048576,
"iterations": 64,
"elapsed_s": 9.000000136438757e-05,
"bytes_processed": 67108864,
"throughput_bytes_per_s": 745654033140.4323
},
{
"size_bytes": 4194304,
"iterations": 64,
"elapsed_s": 8.620000153314322e-05,
"bytes_processed": 268435456,
"throughput_bytes_per_s": 3114100362246.3823
},
{
"size_bytes": 16777216,
"iterations": 64,
"elapsed_s": 8.899999738787301e-05,
"bytes_processed": 1073741824,
"throughput_bytes_per_s": 12064515230494.896
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"meta": {
"benchmark": "loopback_throughput",
"config": "performance",
"timestamp": "2025-12-31T15:56:32.300566+00:00",
"platform": {
"system": "Windows",
"release": "11",
"python": "3.13.3"
},
"git": {
"commit_hash": "32b1ca9a87bb5fa5a113702986b04317e335c719",
"commit_hash_short": "32b1ca9",
"branch": "addssessionrefactor",
"author": "Joseph Pollack",
"is_dirty": true
}
},
"results": [
{
"payload_bytes": 16384,
"pipeline_depth": 8,
"duration_s": 3.00001759999941,
"bytes_transferred": 31751536640,
"throughput_bytes_per_s": 10583783455.139145,
"stall_percent": 11.111106014752735
},
{
"payload_bytes": 16384,
"pipeline_depth": 128,
"duration_s": 3.0000309999995807,
"bytes_transferred": 62571364352,
"throughput_bytes_per_s": 20856905929.30831,
"stall_percent": 0.7751845337227097
},
{
"payload_bytes": 65536,
"pipeline_depth": 8,
"duration_s": 3.0000116000010166,
"bytes_transferred": 126129930240,
"throughput_bytes_per_s": 42043147513.148705,
"stall_percent": 11.111075188761681
},
{
"payload_bytes": 65536,
"pipeline_depth": 128,
"duration_s": 3.000052200000937,
"bytes_transferred": 247966007296,
"throughput_bytes_per_s": 82653897587.4895,
"stall_percent": 0.7751714364313005
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"meta": {
"benchmark": "piece_assembly",
"config": "performance",
"timestamp": "2025-12-31T15:56:34.822755+00:00",
"platform": {
"system": "Windows",
"release": "11",
"python": "3.13.3"
},
"git": {
"commit_hash": "32b1ca9a87bb5fa5a113702986b04317e335c719",
"commit_hash_short": "32b1ca9",
"branch": "addssessionrefactor",
"author": "Joseph Pollack",
"is_dirty": true
}
},
"results": [
{
"piece_size_bytes": 1048576,
"block_size_bytes": 16384,
"blocks": 64,
"elapsed_s": 0.3204829000023892,
"throughput_bytes_per_s": 3271862.5548888342
},
{
"piece_size_bytes": 4194304,
"block_size_bytes": 16384,
"blocks": 256,
"elapsed_s": 0.30863529999987804,
"throughput_bytes_per_s": 13589838.881040689
}
]
}
39 changes: 39 additions & 0 deletions docs/reports/benchmarks/timeseries/hash_verify_timeseries.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,45 @@
"throughput_bytes_per_s": 12413200251695.68
}
]
},
{
"timestamp": "2025-12-31T15:56:19.831085+00:00",
"git": {
"commit_hash": "32b1ca9a87bb5fa5a113702986b04317e335c719",
"commit_hash_short": "32b1ca9",
"branch": "addssessionrefactor",
"author": "Joseph Pollack",
"is_dirty": false
},
"platform": {
"system": "Windows",
"release": "11",
"python": "3.13.3"
},
"config": "performance",
"results": [
{
"size_bytes": 1048576,
"iterations": 64,
"elapsed_s": 9.000000136438757e-05,
"bytes_processed": 67108864,
"throughput_bytes_per_s": 745654033140.4323
},
{
"size_bytes": 4194304,
"iterations": 64,
"elapsed_s": 8.620000153314322e-05,
"bytes_processed": 268435456,
"throughput_bytes_per_s": 3114100362246.3823
},
{
"size_bytes": 16777216,
"iterations": 64,
"elapsed_s": 8.899999738787301e-05,
"bytes_processed": 1073741824,
"throughput_bytes_per_s": 12064515230494.896
}
]
}
]
}
Loading
Loading