Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add Title Property to select and select_multiple Inputs #76

Merged
merged 14 commits into from
Sep 27, 2023
Merged

Feature: Add Title Property to select and select_multiple Inputs #76

merged 14 commits into from
Sep 27, 2023

Conversation

yfernandes-uturn
Copy link

This PR introduces a new title property for both select and select_multiple input types.

Changes:

  • Added title property to select and select_multiple inputs.
  • Updated examples in README.md.

Motivation:

The prompt input in beaupy offers an interactive way for users to input data, where the question disappears upon confirmation. This PR brings the select and select_multiple inputs in line with this behavior, making the user experience more consistent and intuitive.


Please review the changes and provide feedback. Looking forward to integrating this enhancement to improve the user interaction in beaupy.

@yfernandes-uturn
Copy link
Author

@petereon This is the PR for the selects title feature we mentioned earlier in #74

@yfernandes-uturn
Copy link
Author

Working on the tests

@yfernandes-uturn
Copy link
Author

@petereon tests and lint running successfully now.

Changes:

  • Title explicitly optional
  • Title enclosed in parenthesis inside rendered string
  • Added ignore comments for line break before binary operator (W503)
  • Remove redundant _update_rendered on select function, previously added in this same PR

@petereon
Copy link
Owner

@yfernandes-uturn thank you very much and apologies for the delay, I've been busy with work. I am going to review now.

@petereon petereon self-requested a review September 27, 2023 16:16
@petereon petereon self-assigned this Sep 27, 2023
@petereon petereon added the enhancement New feature or request label Sep 27, 2023
@yfernandes-uturn
Copy link
Author

Don't worry @petereon! Just want to make it as smooth as possible for you to review and incorporate this into your awesome lib :)

@@ -231,6 +231,7 @@ def prompt(

def select(
options: List[Union[Tuple[int, ...], str]],
title: Optional[str] = None,
Copy link
Owner

@petereon petereon Sep 27, 2023

Choose a reason for hiding this comment

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

As is, this constitutes a breaking change as anyone using beaupy without named parameters and relying on argument order would encounter issues.

We could avoid a breaking change if the title was made the last parameter, but that's a not very natural place for it to be. I am not sure if it is worth a breaking change and associated major-version bump. Wdyt?

Copy link
Owner

Choose a reason for hiding this comment

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

To clarify, I am not against breaking changes and I think this one might be worthwhile. If you agree, I am going to branch out master into a new branch for the 4.0.0 version, as there are more things I want to wiggle around in the API and we should make the pull request against said new branch.

Copy link
Author

@yfernandes-uturn yfernandes-uturn Sep 27, 2023

Choose a reason for hiding this comment

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

Got it. I definitely agree that although essential, it's a too small feature for a major bump, and that the natural place for it would be one of the first args. I'd say it could stay on hold in a "staging" branch, and be released along with other changes on a next major bump. I can help by working on the original purpose of #74 and other issues too.

Copy link
Author

Choose a reason for hiding this comment

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

Or it could maybe be released as b0 of next major version

Copy link
Owner

Choose a reason for hiding this comment

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

Sounds great! I've made a staging branch for eventual v4, staging/v4.0. Could you please move this pull request to that branch?

As for the other issues, I will gladly accept contributions!

Copy link
Author

Choose a reason for hiding this comment

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

Awesome! Just moved it. And count on me for further contributions 👍

Copy link
Author

Choose a reason for hiding this comment

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

Just noticed the type of title is wrong in the comments, will update it quickly

Copy link
Author

Choose a reason for hiding this comment

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

Done ✅

@yfernandes-uturn yfernandes-uturn changed the base branch from master to staging/v4.0 September 27, 2023 16:50
@petereon petereon merged commit 6104582 into petereon:staging/v4.0 Sep 27, 2023
@petereon
Copy link
Owner

Thanks, merged!

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.

2 participants