Skip to content

refac: replace print calls with str-returning format_* methods#621

Open
FBumann wants to merge 5 commits intomasterfrom
format-labels-deprecate-print
Open

refac: replace print calls with str-returning format_* methods#621
FBumann wants to merge 5 commits intomasterfrom
format-labels-deprecate-print

Conversation

@FBumann
Copy link
Collaborator

@FBumann FBumann commented Mar 14, 2026

Summary

  • Add format_labels() on Constraints and Variables that return strings instead of printing to stdout
  • Add format_infeasibilities() on Model that returns a string representation of infeasible constraints
  • Deprecate print_labels() and print_infeasibilities() with DeprecationWarning pointing to the new methods

Closes #476

Test plan

  • Existing tests pass (387 passed)
  • Linting passes (ruff check)
  • Pre-commit hooks pass

🤖 Generated with Claude Code

FBumann and others added 3 commits March 14, 2026 22:38
Add format_labels (Constraints, Variables) and format_infeasibilities
(Model) that return strings instead of printing to stdout. Deprecate
the old print_labels and print_infeasibilities methods with warnings
pointing callers to the new alternatives.

Closes #476

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@FBumann FBumann requested a review from lkstrp March 14, 2026 21:44
@FBumann FBumann added the enhancement New feature or request label Mar 18, 2026
Copy link
Collaborator

@FabianHofmann FabianHofmann left a comment

Choose a reason for hiding this comment

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

makes sense, would you mind to also align rename the function print_single_constraint accordingly?

FBumann and others added 2 commits March 20, 2026 12:50
Align internal helper naming with the format_* convention introduced
for the public API methods.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rename print_coord, print_single_variable, print_single_expression,
and print_line to use the format_* naming convention consistently.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@FBumann
Copy link
Collaborator Author

FBumann commented Mar 20, 2026

@FabianHofmann Done. ALso aligned other purely internal methods to the naming scheme (format_* instead of print_*)

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better logging of print calls

2 participants