Skip to content

Conversation

@Sagmedjo
Copy link

@Sagmedjo Sagmedjo commented Nov 15, 2025

Fixes: #153

This pull request primarily cleans up the Python interop type definition files by removing all calls to __pydantic_model__.update_forward_refs() and fixes the structure of the objectives field in the Problem class.

Codebase cleanup and simplification:

  • Removed all calls to __pydantic_model__.update_forward_refs() from config_types.py and pragmatic_types.py, to comply with pydantic 2 and above

Type definition update:

  • Changed the type of the objectives field in the Problem class from Optional[List[List[Objective]]] to Optional[List[Objective]], fixing the data structure for objectives to work with the vrp_cli.solve_pragmatic method.

Updated the 'objectives' field in the 'Problem' class to accept a list of 'Objective' instead of a list of lists. Removed unnecessary calls to update_forward_refs for various classes.
Removed unnecessary calls to update_forward_refs for Pydantic models.
Copilot AI review requested due to automatic review settings November 15, 2025 14:34
Copilot finished reviewing on behalf of Sagmedjo November 15, 2025 14:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the Python interop type definitions to be compatible with Pydantic 2 and fixes the data structure for the objectives field in the Problem class.

  • Removed all deprecated __pydantic_model__.update_forward_refs() calls for Pydantic 2 compatibility
  • Fixed the objectives field type from nested list to flat list structure
  • Changes align with the flattening of objectives that occurred in version 1.24.0

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
examples/python-interop/pragmatic_types.py Removed Pydantic 1 forward reference updates and corrected objectives field type from Optional[List[List[Objective]]] to Optional[List[Objective]] to match the flattened format
examples/python-interop/config_types.py Removed Pydantic 1 forward reference updates for all dataclass definitions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sagmedjo and others added 8 commits November 15, 2025 23:27
- Introduced `minShifts` property in vehicle type schema to enforce minimum shift usage.
- Updated fleet generation logic to accommodate minimum shift requirements.
- Implemented a new feature to validate minimum shift usage during route planning.
- Enhanced goal context creation to include minimum shift features.
- Added tests to ensure correct enforcement of minimum shift constraints and their integration with existing features.
…low for breaks with offsets with departure rescheduling
Implement simple way of changing break time windows for offsets to al…
…cles

Add even distribution across vehicles
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.

Pydantic Model Issue

1 participant