v1.4.0 - Comprehensive Package Enhancement and Tooling Migration
📋 Overview
This release introduces significant enhancements to the toolbox-python package, including a new generators module, expanded validation capabilities, comprehensive docstring standards, and modernized CI/CD workflows. The changes span 30 commits across multiple areas of the codebase to improve functionality, maintainability, and developer experience while maintaining full backward compatibility.
🆕 New Modules and Core Functionality
Generators Module
- New module:
toolbox_python.generators- Provides functions for computing data on-the-fly based on input parameters rather than storing it in databases or files - New function:
generate_group_cutoffs()- Divides a total number of items into specified groups, returning start and end indices for each group with proper validation and error handling - Documentation: Added comprehensive documentation with examples and complete test coverage
Enhanced Checkers Module
- New constant:
OPERATORSdictionary - Defines comparison operations for value validation including<,<=,>,>=,==,!=,in, andnot in - New function:
is_valid_value()- Checks if a value is valid based on a specified operator and target value - New function:
assert_is_valid_value()- Assert version of the validation function with proper error handling - Enhanced aliases: Added
is_validandassert_is_validfunction aliases for consistency and convenience
Enhanced Strings Module
- New function:
str_to_list()- Converts strings to single-element lists while preserving other data types unchanged - Type safety: Includes comprehensive overloads and type hints for better development experience
- Input flexibility: Provides a convenient way to normalize string inputs for functions that expect list-like objects
🔧 Function Enhancements and Type Safety
Improved Type Hints and Overloads
- Enhanced overloads: Added
@overloaddecorators for better type hints in:toolbox_python.checkers.is_value_of_type()- Now properly handles both single types and tuple of typestoolbox_python.output.list_columns()- Distinguishes between print and return modestoolbox_python.retry.retry()- Better handling of different parameter combinations
- Type validation: Enhanced parameter validation across multiple functions using new assertion functions
Function Robustness Improvements
- Parameter validation: Added comprehensive input validation using
assert_is_validfunctions to ensure type safety and value constraints - Error handling: Improved exception handling for the
retry()function with better logging initialization and normalized exception parameter handling - Code structure: Better organization with descriptive comments separating validation, preparation, processing, and output phases
- Column width logic: Simplified logic in
list_columns()by replacing conditional assignment withmin()function for cleaner code
📜 Package Scripts and Automation
Comprehensive Utility Scripts
- Script module:
src/utils/scripts.py- Extensive collection of utility functions organized into categories:- Syncing:
uv_sync()for dependency management - Linting:
run_black(),run_isort(),run_pycln(),run_pyupgrade(),run_blacken_docs(), and combinedlint() - Checking:
check_black(),check_mypy(),check_pytest(),check_codespell(),check_pylint(), and comprehensivecheck() - Git operations:
add_git_credentials(),git_refresh_current_branch(),git_switch_to_main_branch(),git_add_coverage_report() - Documentation:
docs_build_static(),docs_serve_versioned(),build_versioned_docs(), and version management
- Syncing:
Project Scripts Configuration
- Package scripts: Added extensive
[project.scripts]table inpyproject.tomlwith organized sections:- Syncing:
sync - Linting:
run-black,run-isort,lint,lint-check - Checking:
check-black,check-mypy,check-pytest,check-docstrings,check - Git:
add-git-credentials,git-switch-to-main-branch,bump-version,git-update-version - Docs:
docs-serve-static,build-versioned-docs,docs-check-versions
- Syncing:
- Enhanced version management: Updated
src/utils/bump_version.pyfor better CLI compatibility and version tracking
📚 Docstring Standards and Validation
Automated Docstring Validation System
- Validation infrastructure: Implemented comprehensive docstring checking with strict formatting requirements:
FunctionAndClassDetails()- Named tuple for tracking function and class detailscheck_docstrings_file()- Validates docstrings in individual files with detailed error reporting_check_single_docstring()- Validates individual function/class docstrings against standards_check_section_order()- Ensures proper section ordering (Summary → Params → Returns/Yields → Examples)_validate_section_formats()- Validates specific section formats and content structurecheck_docstrings_cli(),check_docstrings_all(),check_docstrings_dir()- Various checking interfaces
Enhanced Docstring Standards
- Mandatory sections: Summary, Params, Returns/Yields, and Examples sections now required for all functions and classes
- Format consistency: Fixed typos across all docstrings from
!!! summary "Summary"to!!! note "Summary" - Examples improvements: Updated all code examples to use
pyconsyntax for better clarity and consistency - Type information: Enhanced
Raisesstatements with proper exception types (e.g.,TypeError,ValueError,LookupError) and detailed descriptions - Documentation quality: Improved parameter descriptions, return value specifications, and comprehensive usage examples
🚀 CI/CD Workflow Modernization
Migration to UV-Based Tooling
- CI workflow: Complete refactoring of
.github/workflows/ci.yml:- Replaced all
makecommands withuv runcommands for improved consistency and performance - Added UV environment variables for optimal configuration
- Streamlined dependency installation and checking processes
- Replaced all
- CD workflow: Comprehensive modernization of
.github/workflows/cd.yml:- Replaced
makecommands withuv runcommands throughout all jobs - Added environment variables for UV configuration (
UV_LINK_MODE,UV_NATIVE_TLS,UV_NO_SYNC) - Improved git operations with new utility functions
- Enhanced version management and tag handling
- Fixed tag reference issues to ensure correct version numbers in releases
- Streamlined package building and publishing processes
- Replaced
Enhanced Pre-commit Integration
- Hook updates: Updated pre-commit hook versions for better compatibility:
- Updated
mypyfrom v1.15.0 to v1.16.1 with additional--allow-redefinitionflag - Updated
pyupgradefrom v3.19.1 to v3.20.0 - Updated
uv-pre-commitfrom 0.6.12 to 0.7.20 - Removed outdated poetry check hooks
- Updated
- New validation: Added
check-docstringshook for continuous validation during development workflow
⚙️ Configuration and Build System Updates
Project Configuration Enhancements
- Build system: Migrated from
hatchlingtouv_buildfor better integration with UV toolchain and improved build reliability - MyPy configuration: Updated to include
no-redefindisable_error_codelist for better type checking compatibility - Dependencies: Added
uvto the development dependency group for comprehensive toolchain integration - Python requirements: Updated syntax from
">3.9,<4.0"to">=3.9,<4.0"for standard compliance
Documentation Configuration
- MkDocs updates:
- Added new
generatorsmodule to navigation structure for complete module coverage - Fixed repository icon from
material/gitlabtomaterial/githubfor accurate branding - Enhanced navigation structure to reflect all available modules
- Added new
- Improved organization: Better categorization and presentation of module documentation
Enhanced Type System
- Collection types: Expanded
collection_types.pywith new type aliases:- Added
datetimecollections:datetime_list,datetime_tuple,datetime_set,datetime_list_tuple - Added
intcollections:int_set,int_list_tuple - Enhanced
dictcollections: reorganized and added better documentation - Improved organization with clear section comments for better maintainability
- Added
🧪 Testing and Quality Assurance
Comprehensive Test Coverage
- New test modules: Added extensive test coverage for new functionality:
src/tests/test_generators.py- Complete test suite for the generators module with edge cases- Enhanced
src/tests/test_strings.py- Tests for newstr_to_list()function with various input types - Expanded
src/tests/test_checkers.py- Comprehensive tests for new validation functions includingOPERATORStesting
- Test improvements: Updated existing tests to use
pytest.raisesinstead ofpytestimports for better compatibility - Coverage maintenance: Maintained 100% test coverage across all modules while adding new functionality
Quality Improvements
- Validation robustness: Enhanced function robustness through comprehensive parameter validation using new assertion functions
- Error handling: Improved error capture and reporting in docstring checking with detailed feedback
- Type safety: Better type hints and validation across the codebase with overloads and proper type checking
- Code organization: Improved code structure with better separation of concerns and descriptive comments
🎯 Impact and Benefits
This release significantly enhances the toolbox-python package by:
- Expanding core functionality with new modules and utilities that provide valuable data processing capabilities for on-demand computation
- Improving developer experience through better type hints, comprehensive validation, standardized tooling, and automated quality checks
- Enhancing code quality with comprehensive validation systems, consistent documentation standards, and robust error handling
- Modernizing CI/CD with migration to UV-based tooling for better reliability, performance, and maintainability
- Strengthening maintainability through comprehensive testing, automated docstring validation, and organized project scripts
- Improving type safety with enhanced type hints, validation functions, and comprehensive overloads for better IDE support
💪 Pull Requests
- Reorder classifiers and update Python requirement syntax in
pyproject.tomlby @chrimaho in #35 - Comprehensive Package Enhancement and Tooling Migration with new modules, improved validation, and modernized CI/CD workflows by @chrimaho in #36
The changes maintain full backward compatibility while providing substantial improvements to functionality, developer experience, and project maintenance workflows. All existing APIs remain unchanged, ensuring seamless upgrades for existing users.
Full Changelog: v1.3.1...v1.4.0