Skip to content

feat: add reusable GitHub Release binary installer framework#325

Merged
endavis merged 2 commits intomainfrom
feat/293-install-tools-framework
Apr 2, 2026
Merged

feat: add reusable GitHub Release binary installer framework#325
endavis merged 2 commits intomainfrom
feat/293-install-tools-framework

Conversation

@endavis
Copy link
Copy Markdown
Owner

@endavis endavis commented Apr 2, 2026

Description

Extract the inline direnv installation logic from tools/doit/install.py into a reusable framework (tools/doit/install_tools.py) with 5 public functions for installing any tool from GitHub releases. Refactor the existing task_install_direnv to use the new framework.

Related Issue

Addresses #293

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test improvement

Changes Made

  • Added tools/doit/install_tools.py with 5 public functions:
    • get_latest_github_release() - query GitHub API for latest release version
    • get_install_dir() - return standard ~/.local/bin path, creating if needed
    • download_github_release_binary() - download and chmod a release asset
    • install_tool() - orchestrate check-or-install for a named tool
    • create_install_task() - factory that returns a doit task dict
  • Refactored tools/doit/install.py to remove inline helpers and use create_install_task() for the direnv task
  • Added tests/test_doit_install_tools.py with 20 tests covering all 5 public functions

Testing

  • All existing tests pass
  • Added new tests for new functionality
  • Manually tested the changes

Checklist

  • My code follows the code style of this project (ran doit format)
  • I have run linting checks (doit lint)
  • I have run type checking (doit type_check)
  • I have added tests that prove my fix is effective or that my feature works
  • All new and existing tests pass (doit test)
  • I have updated the documentation accordingly
  • I have updated the CHANGELOG.md
  • My changes generate no new warnings

Additional Notes

The framework uses urllib.request (stdlib only) to avoid adding dependencies. macOS falls back to brew install for all tools; Linux downloads the binary directly from GitHub releases. The asset_patterns dict makes it straightforward to add new tools by defining only the platform-specific asset filenames.

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Details
Benchmark suite Current: de5dc58 Previous: 67fa7ca Ratio
tests/benchmarks/test_bench_core.py::test_bench_greet_default 8915740.663347503 iter/sec (stddev: 1.045047665948324e-8) 8028010.666531343 iter/sec (stddev: 1.2844789793973327e-8) 0.90
tests/benchmarks/test_bench_core.py::test_bench_greet_with_name 8984220.838640621 iter/sec (stddev: 1.0655546739217191e-8) 8555061.455777109 iter/sec (stddev: 1.0720310573196015e-8) 0.95
tests/benchmarks/test_bench_core.py::test_bench_greet_long_name 5401220.5019876035 iter/sec (stddev: 1.756926515539787e-8) 5405940.513984225 iter/sec (stddev: 2.9791131609054912e-8) 1.00
tests/benchmarks/test_bench_logging.py::test_bench_get_logger 1672708.3804903491 iter/sec (stddev: 2.5689462554489816e-7) 1626518.8868520118 iter/sec (stddev: 2.7748832059429893e-7) 0.97
tests/benchmarks/test_bench_logging.py::test_bench_setup_logging 495741.12334466365 iter/sec (stddev: 5.093802226899766e-7) 506261.6526102393 iter/sec (stddev: 4.610588757791842e-7) 1.02

This comment was automatically generated by workflow using github-action-benchmark.

chmod is a no-op on Windows, so the permission assertion fails.
@endavis endavis added the ready-to-merge PR is reviewed and ready to merge label Apr 2, 2026
@endavis endavis merged commit 75cbe9b into main Apr 2, 2026
20 of 21 checks passed
@endavis endavis deleted the feat/293-install-tools-framework branch April 2, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge PR is reviewed and ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant