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

Automatically Convert name Argument and registry Argument to Lowercase in ImageSpec #1881

Merged

Conversation

Future-Outlier
Copy link
Member

@Future-Outlier Future-Outlier commented Oct 8, 2023

TL;DR

I recently started using "ImageSpec" and encountered an issue when I provided a name argument that wasn't in lowercase. Currently, the "ImageSpec" requires the name argument to be in lowercase, and it doesn't handle cases where users provide uppercase or mixed-case strings.

To enhance user experience and reduce potential errors, I propose that we automatically convert the name argument to lowercase within the "ImageSpec". This minor adjustment will make the library more user-friendly and save users' time by preventing them from repeating this common mistake.

Please consider this improvement for a future release. Looking forward to your feedback!

Screenshot

image

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Tracking Issue

#1555

Copy link
Member

@pingsutw pingsutw left a comment

Choose a reason for hiding this comment

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

could you use post_init instead?

class ImageSpec():
    ...
    ...

    def __post_init__(self):
        self.name = self.name.lower()
        self.registry = self.registry.lower()

@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (d89cb21) 55.06% compared to head (99a342d) 55.05%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1881      +/-   ##
==========================================
- Coverage   55.06%   55.05%   -0.01%     
==========================================
  Files         296      296              
  Lines       22250    22254       +4     
  Branches     3357     3358       +1     
==========================================
+ Hits        12252    12253       +1     
- Misses       9835     9838       +3     
  Partials      163      163              
Files Coverage Δ
flytekit/image_spec/image_spec.py 41.66% <25.00%> (-0.58%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Future-Outlier
Copy link
Member Author

could you use post_init instead?

class ImageSpec():
    ...
    ...

    def __post_init__(self):
        self.name = self.name.lower()
        self.registry = self.registry.lower()

Amazing advice, thanks a lot!

Signed-off-by: Future Outlier <[email protected]>
@Future-Outlier
Copy link
Member Author

Due to this error, I will check if name and registry is None or not.
image

Signed-off-by: Future Outlier <[email protected]>
@pingsutw pingsutw merged commit c62ca7a into flyteorg:master Oct 10, 2023
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.

2 participants