From ec4b34907b7d84bc411c3189fea26669e50d98e4 Mon Sep 17 00:00:00 2001 From: Joseph Pollack Date: Wed, 31 Dec 2025 17:11:05 +0100 Subject: [PATCH] adds uv docs fix --- .github/workflows/ci.yml | 98 +++++++------------ ccbt/consensus/__init__.py | 2 - ccbt/session/download_startup.py | 2 - ccbt/session/manager_startup.py | 2 - docs/overrides/README.md | 1 + docs/overrides/README_RTD.md | 1 + docs/overrides/partials/languages/README.md | 1 + docs/overrides/partials/languages/arc.html | 1 + docs/overrides/partials/languages/ha.html | 1 + docs/overrides/partials/languages/sw.html | 1 + docs/overrides/partials/languages/yo.html | 1 + .../hash_verify-20251231-155619-32b1ca9.json | 42 ++++++++ ...ck_throughput-20251231-155632-32b1ca9.json | 53 ++++++++++ ...iece_assembly-20251231-155634-32b1ca9.json | 35 +++++++ .../timeseries/hash_verify_timeseries.json | 39 ++++++++ .../loopback_throughput_timeseries.json | 50 ++++++++++ .../timeseries/piece_assembly_timeseries.json | 36 +++++++ .../test_advanced_commands_phase2_fixes.py | 1 + .../cli/test_simplification_regression.py | 1 + .../test_tracker_session_statistics.py | 1 + 20 files changed, 300 insertions(+), 69 deletions(-) create mode 100644 docs/reports/benchmarks/runs/hash_verify-20251231-155619-32b1ca9.json create mode 100644 docs/reports/benchmarks/runs/loopback_throughput-20251231-155632-32b1ca9.json create mode 100644 docs/reports/benchmarks/runs/piece_assembly-20251231-155634-32b1ca9.json create mode 100644 docs/reports/benchmarks/timeseries/piece_assembly_timeseries.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 27e1545..f4d918f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,31 +17,35 @@ 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 @@ -49,7 +53,7 @@ jobs: - 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' @@ -86,6 +90,11 @@ 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: @@ -93,14 +102,13 @@ jobs: - 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 @@ -114,6 +122,11 @@ 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: @@ -121,57 +134,16 @@ jobs: - 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: | diff --git a/ccbt/consensus/__init__.py b/ccbt/consensus/__init__.py index e11e302..e1a08c3 100644 --- a/ccbt/consensus/__init__.py +++ b/ccbt/consensus/__init__.py @@ -25,5 +25,3 @@ "RaftState", "RaftStateType", ] - - diff --git a/ccbt/session/download_startup.py b/ccbt/session/download_startup.py index 15744f5..17f5452 100644 --- a/ccbt/session/download_startup.py +++ b/ccbt/session/download_startup.py @@ -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. """ - - diff --git a/ccbt/session/manager_startup.py b/ccbt/session/manager_startup.py index ce270d3..8f3695d 100644 --- a/ccbt/session/manager_startup.py +++ b/ccbt/session/manager_startup.py @@ -3,5 +3,3 @@ This module handles the startup sequence for the session manager, including component initialization, service startup, and background task coordination. """ - - diff --git a/docs/overrides/README.md b/docs/overrides/README.md index cdfd061..47fc828 100644 --- a/docs/overrides/README.md +++ b/docs/overrides/README.md @@ -64,3 +64,4 @@ If you're a native speaker of any of these languages and would like to contribut + diff --git a/docs/overrides/README_RTD.md b/docs/overrides/README_RTD.md index 6e3637e..acf3e20 100644 --- a/docs/overrides/README_RTD.md +++ b/docs/overrides/README_RTD.md @@ -75,3 +75,4 @@ If builds fail on Read the Docs: + diff --git a/docs/overrides/partials/languages/README.md b/docs/overrides/partials/languages/README.md index 51bbcb0..9bac2b8 100644 --- a/docs/overrides/partials/languages/README.md +++ b/docs/overrides/partials/languages/README.md @@ -79,3 +79,4 @@ If you're a native speaker, please contribute translations by: + diff --git a/docs/overrides/partials/languages/arc.html b/docs/overrides/partials/languages/arc.html index dcbc7f1..4a2bf18 100644 --- a/docs/overrides/partials/languages/arc.html +++ b/docs/overrides/partials/languages/arc.html @@ -68,3 +68,4 @@ + diff --git a/docs/overrides/partials/languages/ha.html b/docs/overrides/partials/languages/ha.html index 4e7f4ec..5ec812b 100644 --- a/docs/overrides/partials/languages/ha.html +++ b/docs/overrides/partials/languages/ha.html @@ -67,3 +67,4 @@ + diff --git a/docs/overrides/partials/languages/sw.html b/docs/overrides/partials/languages/sw.html index da54ab5..9aa8baa 100644 --- a/docs/overrides/partials/languages/sw.html +++ b/docs/overrides/partials/languages/sw.html @@ -67,3 +67,4 @@ + diff --git a/docs/overrides/partials/languages/yo.html b/docs/overrides/partials/languages/yo.html index b029f48..ac884cb 100644 --- a/docs/overrides/partials/languages/yo.html +++ b/docs/overrides/partials/languages/yo.html @@ -67,3 +67,4 @@ + diff --git a/docs/reports/benchmarks/runs/hash_verify-20251231-155619-32b1ca9.json b/docs/reports/benchmarks/runs/hash_verify-20251231-155619-32b1ca9.json new file mode 100644 index 0000000..943961c --- /dev/null +++ b/docs/reports/benchmarks/runs/hash_verify-20251231-155619-32b1ca9.json @@ -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 + } + ] +} \ No newline at end of file diff --git a/docs/reports/benchmarks/runs/loopback_throughput-20251231-155632-32b1ca9.json b/docs/reports/benchmarks/runs/loopback_throughput-20251231-155632-32b1ca9.json new file mode 100644 index 0000000..17fa8a0 --- /dev/null +++ b/docs/reports/benchmarks/runs/loopback_throughput-20251231-155632-32b1ca9.json @@ -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 + } + ] +} \ No newline at end of file diff --git a/docs/reports/benchmarks/runs/piece_assembly-20251231-155634-32b1ca9.json b/docs/reports/benchmarks/runs/piece_assembly-20251231-155634-32b1ca9.json new file mode 100644 index 0000000..aa4950b --- /dev/null +++ b/docs/reports/benchmarks/runs/piece_assembly-20251231-155634-32b1ca9.json @@ -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 + } + ] +} \ No newline at end of file diff --git a/docs/reports/benchmarks/timeseries/hash_verify_timeseries.json b/docs/reports/benchmarks/timeseries/hash_verify_timeseries.json index cb982a9..70bdb7d 100644 --- a/docs/reports/benchmarks/timeseries/hash_verify_timeseries.json +++ b/docs/reports/benchmarks/timeseries/hash_verify_timeseries.json @@ -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 + } + ] } ] } \ No newline at end of file diff --git a/docs/reports/benchmarks/timeseries/loopback_throughput_timeseries.json b/docs/reports/benchmarks/timeseries/loopback_throughput_timeseries.json index 5c9d73d..e83f61e 100644 --- a/docs/reports/benchmarks/timeseries/loopback_throughput_timeseries.json +++ b/docs/reports/benchmarks/timeseries/loopback_throughput_timeseries.json @@ -49,6 +49,56 @@ "stall_percent": 0.7751935712223383 } ] + }, + { + "timestamp": "2025-12-31T15:56:32.306398+00:00", + "git": { + "commit_hash": "32b1ca9a87bb5fa5a113702986b04317e335c719", + "commit_hash_short": "32b1ca9", + "branch": "addssessionrefactor", + "author": "Joseph Pollack", + "is_dirty": true + }, + "platform": { + "system": "Windows", + "release": "11", + "python": "3.13.3" + }, + "config": "performance", + "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 + } + ] } ] } \ No newline at end of file diff --git a/docs/reports/benchmarks/timeseries/piece_assembly_timeseries.json b/docs/reports/benchmarks/timeseries/piece_assembly_timeseries.json new file mode 100644 index 0000000..a9b586f --- /dev/null +++ b/docs/reports/benchmarks/timeseries/piece_assembly_timeseries.json @@ -0,0 +1,36 @@ +{ + "entries": [ + { + "timestamp": "2025-12-31T15:56:34.824768+00:00", + "git": { + "commit_hash": "32b1ca9a87bb5fa5a113702986b04317e335c719", + "commit_hash_short": "32b1ca9", + "branch": "addssessionrefactor", + "author": "Joseph Pollack", + "is_dirty": true + }, + "platform": { + "system": "Windows", + "release": "11", + "python": "3.13.3" + }, + "config": "performance", + "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 + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/unit/cli/test_advanced_commands_phase2_fixes.py b/tests/unit/cli/test_advanced_commands_phase2_fixes.py index d647df0..95dc826 100644 --- a/tests/unit/cli/test_advanced_commands_phase2_fixes.py +++ b/tests/unit/cli/test_advanced_commands_phase2_fixes.py @@ -291,5 +291,6 @@ def test_performance_command_execution(self, mock_get_config): + diff --git a/tests/unit/cli/test_simplification_regression.py b/tests/unit/cli/test_simplification_regression.py index 3feeecd..e18259c 100644 --- a/tests/unit/cli/test_simplification_regression.py +++ b/tests/unit/cli/test_simplification_regression.py @@ -340,5 +340,6 @@ def test_no_regressions_in_existing_tests(self): + diff --git a/tests/unit/discovery/test_tracker_session_statistics.py b/tests/unit/discovery/test_tracker_session_statistics.py index cf01a16..559cb26 100644 --- a/tests/unit/discovery/test_tracker_session_statistics.py +++ b/tests/unit/discovery/test_tracker_session_statistics.py @@ -304,5 +304,6 @@ def test_tracker_session_statistics_persistence(self): +