Closed jschalk closed 3 days ago
This PR implements a significant refactoring of Excel file handling in the codebase by introducing a new upsert_sheet
function that replaces direct usage of ExcelWriter. The changes also include enabling several test files by uncommenting them and updating their implementation to use the new function.
sequenceDiagram
participant User
participant ExcelHandler
participant FileSystem
User->>ExcelHandler: Call upsert_sheet(file_path, sheet_name, dataframe)
ExcelHandler->>FileSystem: Check if file exists
alt File does not exist
ExcelHandler->>FileSystem: Create new file with sheet
else File exists
ExcelHandler->>FileSystem: Replace or add sheet
end
FileSystem-->>ExcelHandler: Confirmation
ExcelHandler-->>User: Operation complete
classDiagram
class ExcelHandler {
+upsert_sheet(file_path: str, sheet_name: str, dataframe: DataFrame)
}
class ExcelWriter
class DataFrame
ExcelHandler --> ExcelWriter : uses
ExcelHandler --> DataFrame : uses
note for ExcelHandler "Replaces direct usage of ExcelWriter with upsert_sheet function"
Change | Details | Files |
---|---|---|
Introduced a new upsert_sheet function to handle Excel file operations |
|
src/f09_brick/pandas_tool.py |
Refactored Excel file operations across test files |
|
src/f10_world/test/test_world_etl1_zoo_otx_group.py src/f10_world/test/test_world_etl1_zoo_otx_node.py src/f10_world/test/test_world_etl1_zoo_otx_nub.py src/f10_world/test/test_world_etl1_zoo_otx_road.py src/f09_brick/test_brick_config/test_pandas_tool_.py src/f10_world/test/test_world_etl0_jungle_to_zoo.py src/f10_world/test/test__world_tool_.py src/f10_world/test/test_world_etl1_zoo_otx_appt.py src/f10_world/test/test_world_z_examples.py |
Updated WorldUnit class implementation to use new Excel handling |
|
src/f10_world/world.py |
Added new dependency in GitHub Actions workflow |
|
.github/workflows/run-tests-on-push.yml |
Summary by Sourcery
Refactor the codebase to use the upsert_sheet function for handling Excel sheet operations, replacing the previous ExcelWriter approach. Update the CI workflow to include xlsxwriter as a dependency. Add tests to ensure the new function works correctly for various scenarios.
Enhancements:
CI:
Tests: