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

docs(python): Annotate Config kwarg options #18988

Merged
merged 6 commits into from
Oct 7, 2024

Conversation

etrotta
Copy link
Contributor

@etrotta etrotta commented Sep 27, 2024

Adds a TypedDict listing all valid options you can pass directly to Config()

Closes #18987

@github-actions github-actions bot added documentation Improvements or additions to documentation python Related to Python Polars labels Sep 27, 2024
@etrotta
Copy link
Contributor Author

etrotta commented Sep 27, 2024

Regarding the mypy error,

Run mypy 
tests/unit/test_config.py:742: error: Unexpected keyword argument "i_do_not_exist" for "Config"  [call-arg]
polars/config.py:175: note: "Config" defined here
Found 1 error in 1 file (checked 535 source files)
Error: Process completed with exit code 1.

Is the usual approach just # type: ignore or there's something more appropriate for that? maybe something that asserts mypy should error?

Copy link

codecov bot commented Sep 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.87%. Comparing base (901b243) to head (0d352df).
Report is 66 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18988      +/-   ##
==========================================
- Coverage   79.88%   79.87%   -0.02%     
==========================================
  Files        1524     1524              
  Lines      207634   207833     +199     
  Branches     2904     2908       +4     
==========================================
+ Hits       165873   166005     +132     
- Misses      41214    41279      +65     
- Partials      547      549       +2     

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

@alexander-beedie
Copy link
Collaborator

Is the usual approach just # type: ignore or there's something more appropriate for that? maybe something that asserts mypy should error?

It's in tests; just type-ignore it and I'll approve/merge ;)

@etrotta
Copy link
Contributor Author

etrotta commented Sep 30, 2024

Is the usual approach just # type: ignore or there's something more appropriate for that? maybe something that asserts mypy should error?

It's in tests; just type-ignore it and I'll approve/merge ;)

Thanks!

I also asked elsewhere and got the same recommendation, apparently the standard way of doing "something that asserts mypy should error" is just using --warn-unused-ignores

@alexander-beedie alexander-beedie merged commit 1f48036 into pola-rs:main Oct 7, 2024
13 checks passed
@alexander-beedie
Copy link
Collaborator

Nice one; thanks for the PR 👍

@etrotta etrotta deleted the typing/config-parameters branch October 8, 2024 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Config type hints
2 participants