Open
Conversation
This commit represents a comprehensive refactor of the codebase with significant improvements to code quality, developer experience, and maintainability. - Migrated from pip/venv to uv for faster dependency management - Added pyproject.toml with proper project metadata and dependencies - Added uv.lock for reproducible builds - Added python-dotenv for environment variable management - Created unified CLI entrypoint (trr.py) for all scripts - All individual scripts now accessible via subcommands: - download, analyze, summary, tvl, deployments, scan, compare, tdp - Improved user experience with consistent interface - Maintains backward compatibility with individual script usage - Enhanced avg_tvls.py to return full TVL dataset (not just mean) - Added linear interpolation for missing data points - Added is_interpolated flag to distinguish raw vs interpolated data - Support for CSV (default) and JSON output formats - Backward compatible --mean flag for average-only output - Edge case handling: forward-fill at start, backward-fill at end - Fixed all linting issues (ruff): - Replaced bare except clauses with specific Exception types - Fixed exception chaining (raise ... from err) - Updated type hints to modern Python syntax (list, dict, tuple) - Fixed unused variables and import ordering - Applied consistent code formatting across all files - All 33 tests passing - Added Makefile with development commands: - make lint, make lint-fix, make format, make format-check - make test, make cichecks (runs all CI checks) - Added ruff for linting and formatting - Added comprehensive test suite for TVL functionality - Fixed test infrastructure (mock patches, config loading) - Added .env.example template for API keys - Added .env to .gitignore - All scripts now automatically load .env via python-dotenv - Support for ETHERSCAN_API_KEY, ARBISCAN_API_KEY, ETH_RPC_URL - Updated README.md with new uv-based setup instructions - Added unified CLI usage examples - Added development scripts documentation - Added .env configuration instructions - Updated all examples to use new CLI interface - Fixed test_scanner.py to work with new module structure - Updated all mock patches to use correct module paths - Added test environment detection for config loading - Fixed test expectations to match actual behavior - 17 files modified (code quality, type hints, formatting) - 6 new files (trr.py, pyproject.toml, Makefile, .env.example, test_avg_tvls.py, __init__.py) - Updated .gitignore for .env files None - all changes maintain backward compatibility. - All 33 tests passing - All linting checks passing - All formatting checks passing - make cichecks passes completely
- Add linear extrapolation for start/end dates using trend from nearest two points - Add --no-extrapolate flag to disable extrapolation (only interpolate between points) - Add make tvl and make avgtvl targets for easy TVL queries - Add comprehensive test suite (26 tests) for all TVL functionality - Update README with complete documentation and real examples - Simplify test code with helper function and update to 2025 dates - Add extrapolate parameter to get_tvl_dataset() and get_average_tvl() - Document all features with examples using real Euler Finance data - Add .ruff_cache/ to .gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add TVL Extrapolation Feature and Enhanced Tooling
Summary
This PR introduces linear extrapolation for TVL data analysis, adds convenient make targets for quick queries, and includes a comprehensive test suite with 26 tests covering all functionality.
New Features
TVL Extrapolation
--no-extrapolateflag: Optional flag to disable extrapolation and only return dates that can be interpolated between two surrounding data pointsMake Targets for Easy Usage
make tvl: Get daily TVL data in CSV formatmake avgtvl: Get average TVL with interpolation/extrapolationOPTS='--no-extrapolate'or other flagsTechnical Details
API Changes
extrapolate: bool = Trueparameter to:get_tvl_dataset()get_average_tvl()_get_extrapolation_slope()helper functionHow Extrapolation Works
Example Output
Backward Compatibility
Fully backward compatible
--no-extrapolateflagUsage Examples
Testing Instructions
Run the test suite:
make testTest with real data:
Run all CI checks: