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

Fix import of Worksheet from xlsxwriter #18450

Closed
2 tasks done
harrymconner opened this issue Aug 29, 2024 · 1 comment · Fixed by #18452
Closed
2 tasks done

Fix import of Worksheet from xlsxwriter #18450

harrymconner opened this issue Aug 29, 2024 · 1 comment · Fixed by #18452
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@harrymconner
Copy link

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

# polars/dataframe/frame.py

from xlsxwriter import Workbook, Worksheet # Worksheet isn't exposed in xlsxwriter's __init__.py

from xlsxwriter.worksheet import Worksheet # Worksheet just needs to be imported from the worksheet module instead

Log output

N/A

Issue description

I noticed that pyright was complaining about all occurrences of df.write_excel() because the type of "Worksheet" was unknown. Looks like the Worksheet import in the frame.py module just needs to be imported from xlxswriter's worksheet module instead of the top level xlsxwriter namespace. Also, I'm happy to contribute this fix if needed!

Expected behavior

No pyright errors because it is able to resolve the import.

Installed versions

--------Version info---------
Polars:              1.6.0
Index type:          UInt32
Platform:            Windows-11-10.0.22631-SP0
Python:              3.12.5 (tags/v3.12.5:ff3bc82, Aug  6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)]

----Optional dependencies----
adbc_driver_manager  <not installed>
altair               <not installed>
cloudpickle          <not installed>
connectorx           0.3.3
deltalake            <not installed>
fastexcel            <not installed>
fsspec               <not installed>
gevent               <not installed>
great_tables         <not installed>
matplotlib           <not installed>
nest_asyncio         <not installed>
numpy                2.1.0
openpyxl             <not installed>
pandas               <not installed>
pyarrow              <not installed>
pydantic             <not installed>
pyiceberg            <not installed>
sqlalchemy           <not installed>
torch                <not installed>
xlsx2csv             <not installed>
xlsxwriter           3.2.0
@harrymconner harrymconner added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Aug 29, 2024
@alexander-beedie
Copy link
Collaborator

"Oops..."
Thanks for the eagle-eyes on that one ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@alexander-beedie @harrymconner and others