Skip to content

Conversation

@ianhi
Copy link

@ianhi ianhi commented Sep 29, 2025

Stores versions of tracked packages along with test passes/failures in an orphaned branch. then can create issues like this: ianhi/git-expt#6 when a test starts failing due to a change in an upstream dependency.

solution ot #56

I did some encoding of versioning schemes of common scientific python packages (numpy pandas etc) so that we can correctly generate github links for them.

attn @keewis

I've written this primarily by guiding claude. At time of opening if have personally reviewed some, but not all secitons of the code.

ianhi and others added 15 commits September 26, 2025 12:06
- Add python-command input to specify how to invoke Python in test environment
- Support pip, conda, uv, poetry, pixi, and other package managers
- Use importlib.metadata for universal package detection (works with all managers)
- Capture package versions from actual test environment, not action environment
- Store both package versions and Git commit info for comprehensive bisection
- Generate per-test analysis showing exactly when each test last passed
- Improve branch handling with better error recovery and git configuration
- Add comprehensive tests for new functionality
- Update documentation with examples for all major package managers

Backward compatible: existing workflows continue to work without changes.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
This commit improves maintainability and enhances the bisection feature:

- Extract inline Python code from action.yaml to capture_versions.py for better maintainability
- Add GitHub diff links for common packages (numpy, pandas, pytest, etc.) in bisection output
- Include package metadata for 22 popular Python packages to generate release comparison links
- Update package changes display to include clickable links when available
- Add comprehensive tests for GitHub link generation functionality
- Fix mypy type annotations to use modern Python 3.10+ syntax (str | None instead of Optional[str])

The bisection output now shows package changes like:
- [numpy: 1.24.0 → 1.25.0](numpy/numpy@v1.24.0...v1.25.0)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
This ensures the environment information step shows the actual Python
environment being used for tests, not just the action's Python.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Added actionlint and mypy to existing pre-commit configuration:
- actionlint for GitHub Actions workflow validation
- mypy for type checking with proper type stubs
- Fixed pkg_resources import type annotation with type: ignore

Pre-commit now includes:
- ruff (linting and formatting)
- black (code formatting)
- prettier (markdown/yaml formatting)
- actionlint (workflow validation)
- mypy (type checking)
- Standard hooks (trailing whitespace, end-of-file, etc.)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Updated pre-commit configuration to use ruff for both linting and formatting:
- Removed black (redundant with ruff-format)
- Added ruff-format for consistent code formatting
- Kept actionlint for GitHub Actions validation
- Fixed formatting issues found by ruff-format

This provides a more streamlined toolchain with ruff handling both
linting and formatting responsibilities.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Major improvements to bisection implementation:

### Fixed Issues:
- Updated outdated GitHub Actions (checkout@v3 → v4, setup-python@v4 → v5)
- Updated pre-commit hooks to latest versions
- All pre-commit checks now passing (ruff, actionlint, mypy)

### Refactored Git Operations:
- Moved Git branch operations from Python subprocess to GitHub Actions steps
- Created simple_bisect.py for clean data-only operations
- Git operations now transparent in workflow logs
- Easier debugging and better error handling

### Benefits:
- No more complex subprocess Git calls in Python
- Clear separation of concerns (Python = data, Actions = Git)
- Better error visibility in workflow logs
- Follows GitHub Actions best practices

The action now handles Git operations in workflow steps while Python
focuses purely on data processing and analysis.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add git revision extraction from nightly wheels and setuptools_scm packages
- Support both traditional version strings and new format with git info
- Create comprehensive test suite for version extraction functionality
- Make repository installable as Python package with entry points
- Update package change detection to handle git revision changes
- Add support for scientific Python nightly wheel tracking

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Move Python modules to src/issue_from_pytest_log_action/ package structure
- Update action.yaml to install and use package instead of direct script calls
- Enhance git hash extraction to parse version strings with 'g' prefix patterns
- Add comprehensive tests for version string parsing (30 new test cases)
- Support nightly wheel patterns: +gabc123d, .gabc123d, dev0+123.gabc123d
- Handle packages starting with 'g' correctly (glib, gtk, greenlet, etc.)
- Validate minimum git hash length (7+ characters) and hex-only content
- Backward compatible with existing setuptools_scm and versioneer approaches
- Update .gitignore to exclude build artifacts and temporary files

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Add comprehensive test workflow with Python 3.9-3.13 matrix testing
- Include lint job with ruff and mypy validation
- Add action integration test to verify CLI functionality works
- Create CLAUDE.md with project overview, goals, and structure
- Test both package installation and git info extraction capabilities

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Completely rewrote generate_package_diff_link() to properly handle different tag formats
- Added PACKAGE_METADATA with tag formats for common packages (numpy, pandas, etc.)
- Support commit-to-commit comparison when git hashes are available
- Clean version strings for proper tag matching
- Handle special cases like SQLAlchemy's rel_ prefix and hypothesis naming
- Fix py_version undefined error in format_collection_error()

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Remove old Python files that were moved into the package structure:
- generate_bisect_comparison.py → src/issue_from_pytest_log_action/simple_bisect.py
- parse_logs.py → src/issue_from_pytest_log_action/parse_logs.py
- store_bisect_data.py → merged into simple_bisect.py
- test_parse_log.py → tests/test_parse_logs.py
- test_track_packages.py → tests/test_version_string_parsing.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
… extraction

- Create new extract_run_metadata.py module with proper CLI interface
- Add extract-run-metadata console script to pyproject.toml
- Replace complex Python one-liners in action.yaml with clean command calls
- Fix shell syntax error with multi-line commit message quotes
- Add comprehensive tests for the new functionality
- Ensure action uses the package consistently throughout

The action now uses:
- python -m issue_from_pytest_log_action.extract_run_metadata test_status
- python -m issue_from_pytest_log_action.extract_run_metadata failed_count

Instead of complex inline Python expressions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Fix all ruff import errors and mypy type issues across modules
- Add comprehensive end-to-end testing framework with 11 test scenarios
- Add specialized tests for scientific packages (numpy, pandas, xarray, zarr)
- Increase test coverage from 29% to 69% with 170 total tests
- Add integration markers and performance benchmarks for large log files
- Fix PreformattedReport type annotations and JSON parsing issues

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Fix import organization and code formatting from pre-commit hooks

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@ianhi
Copy link
Author

ianhi commented Nov 21, 2025

I don't remember why I put this as a draft, seems functional. @keewis if you're interested still I could take a harder look and try to get this in before I forget about it again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant