Skip to content

Warn users if we can't find config.yaml but found config.yml#2284

Open
khamidou wants to merge 2 commits intomainfrom
khamidou/warn-if-yml
Open

Warn users if we can't find config.yaml but found config.yml#2284
khamidou wants to merge 2 commits intomainfrom
khamidou/warn-if-yml

Conversation

@khamidou
Copy link

🚀 What

Got kind of confused trying to create a model locally because I created a config.yml instead of config.yaml.

💻 How

This PR should be pretty low-impact as the code only runs when we can't find config.yaml and it just checks for config.yml and prints a warning if it finds it.

🔬 Testing

Added unit tests

Copy link
Contributor

@ndeepak-baseten ndeepak-baseten left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for the tests as well!

resolved_path = path.resolve()
stem = resolved_path.stem
alternative_path = resolved_path.parent / f'{stem}.yml'
if os.path.isfile(alternative_path):
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks good and we can merge now, but maybe we can be more lenient, and actually accept config.yml as well. Right now, we tell the user "hey can you rename", while we could equally just be more accepting. Maybe a follow-up, will likely need alignment!

Copy link
Author

Choose a reason for hiding this comment

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

That's what I wanted to do originally but I decided against it because it could get confusing if somehow you end up with both a config.yml and a config.yaml in the same directory. In that case we'd always default to config.yaml which could cause much bigger headaches down the line

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, good thinking thanks! But then we could throw a warning! "Warning: Found config.yaml and config.yml, using config.yaml"

i.e. if there's only one file, err towards automation. But if two files, show a warning and have a precedence order (or raise ValueError in that case, give control back to user).

Copy link
Author

Choose a reason for hiding this comment

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

(Chatted in person but basically changing this would mean modifying a couple dozens mentions of config.yml that are hardcoded throughout the codebase. Seems like the juice isn't worth the squeeze)

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, yeah this would be easier if it was a property, for example. Thank you for the research!

@armishra
Copy link
Contributor

Q: Did the docs.baseten.co docs not mention .yaml is required?

@khamidou
Copy link
Author

Q: Did the docs.baseten.co docs not mention .yaml is required?

they mention that but nowadays people don't really read docs 😅

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.

3 participants