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

feat(python): Standardize error message format #11598

Merged
merged 9 commits into from
Oct 10, 2023

Conversation

TheDataScientistNL
Copy link
Contributor

@TheDataScientistNL TheDataScientistNL commented Oct 8, 2023

Addresses #10421 for py-polars folder but not rust yet. Some unit tests had to be updated as well due to the new formatting.

All files in py-polars have been searched on raise and have been checked on the bullet points mentioned in #10421.

@TheDataScientistNL TheDataScientistNL changed the title style(python): standardize error message format #10421 style(python): standardize error message format Oct 8, 2023
Copy link
Member

@stinodego stinodego left a comment

Choose a reason for hiding this comment

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

A lot of improvements here!

I also spotted quite some examples which have become less clear. Please take a look at some of my comments and go through the changes again to double check. Then I'll do a final pass and we can merge this.

py-polars/polars/dataframe/frame.py Outdated Show resolved Hide resolved
py-polars/polars/dataframe/frame.py Outdated Show resolved Hide resolved
@@ -3436,14 +3436,15 @@ def write_database(
elif engine == "sqlalchemy":
if parse_version(pd.__version__) < parse_version("1.5"):
raise ModuleNotFoundError(
f"writing with engine 'sqlalchemy' requires pandas 1.5.x or higher, found pandas {pd.__version__!r}"
f"writing with engine `sqlalchemy` requires pandas 1.5.x or higher, found pandas {pd.__version__!r}"
Copy link
Member

Choose a reason for hiding this comment

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

sqlalchemy isn't a code snippet - it's a name of a package. It shouldn't get backticks.

Copy link
Contributor Author

@TheDataScientistNL TheDataScientistNL Oct 9, 2023

Choose a reason for hiding this comment

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

@stinodego Understood. Whilst editing I saw that packages are sometimes within single quotes, sometimes with CamelCase notation. Any standardization you would like there as well, e.g. always in single quotes and all lowercase?

py-polars/polars/datatypes/constructor.py Outdated Show resolved Hide resolved
py-polars/polars/dataframe/frame.py Outdated Show resolved Hide resolved
py-polars/polars/series/series.py Outdated Show resolved Hide resolved
@stinodego stinodego changed the title style(python): standardize error message format feat(python): Standardize error message format Oct 9, 2023
@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars labels Oct 9, 2023
@stinodego stinodego force-pushed the update_error_messages branch from cbd2a97 to 583343a Compare October 10, 2023 12:12
Copy link
Member

@stinodego stinodego left a comment

Choose a reason for hiding this comment

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

Thanks! I made an additional pass to clean up some things, and this can be merged.

@stinodego stinodego merged commit 7f1fec0 into pola-rs:main Oct 10, 2023
12 checks passed
@TheDataScientistNL TheDataScientistNL deleted the update_error_messages branch October 13, 2023 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants