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

mypy fails due to "unused-ignore" #18578

Closed
2 tasks done
xaellison opened this issue Sep 5, 2024 · 2 comments
Closed
2 tasks done

mypy fails due to "unused-ignore" #18578

xaellison opened this issue Sep 5, 2024 · 2 comments
Labels
python Related to Python Polars

Comments

@xaellison
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

error occurs simply for:

import polars

Here's output from my terminal showing my virtual env, a trivial .py, and running mypy on that trivial file

(polars_mwe) alex@Alexs-MacBook-Pro ~ % pip freeze           
mypy==1.0.0
mypy-extensions==1.0.0
polars-lts-cpu==1.6.0
tomli==2.0.1
typing_extensions==4.12.2
(polars_mwe) alex@Alexs-MacBook-Pro ~ % cat mwe.py           
import polars
(polars_mwe) alex@Alexs-MacBook-Pro ~ % python -m mypy mwe.py
.pyenv/versions/polars_mwe/lib/python3.8/site-packages/polars/ml/torch.py:1: error: disable_error_code: Invalid error code(s): unused-ignore  [misc]
Found 1 error in 1 file (checked 1 source file)
(polars_mwe) alex@Alexs-MacBook-Pro ~ %

Log output

.pyenv/versions/polars_mwe/lib/python3.8/site-packages/polars/ml/torch.py:1: error: disable_error_code: Invalid error code(s): unused-ignore  [misc]

Issue description

mypy fails on any code that imports polars. I want to incorporate polars into an existing project that uses mypy, but cannot due to this issue.

Expected behavior

mypy does not fail for importing polars :)

Installed versions

(polars_mwe) alex@Alexs-MacBook-Pro ~ % python
Python 3.8.11 (default, Nov 10 2021, 09:24:20) 
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import polars as pl
>>> pl.show_versions()
--------Version info---------
Polars:              1.6.0
Index type:          UInt32
Platform:            macOS-14.6.1-arm64-arm-64bit
Python:              3.8.11 (default, Nov 10 2021, 09:24:20) 
[Clang 13.0.0 (clang-1300.0.29.3)]

----Optional dependencies----
adbc_driver_manager  <not installed>
altair               <not installed>
cloudpickle          <not installed>
connectorx           <not installed>
deltalake            <not installed>
fastexcel            <not installed>
fsspec               <not installed>
gevent               <not installed>
great_tables         <not installed>
matplotlib           <not installed>
nest_asyncio         <not installed>
numpy                <not installed>
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           <not installed>
>>> 

@xaellison xaellison added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Sep 5, 2024
@alexander-beedie
Copy link
Collaborator

alexander-beedie commented Sep 6, 2024

FYI: we run mypy on the codebase on every commit, and it doesn't fail ;)

image

I suspect you just need to update to a more recent mypy than 1.0.0 🤔

@alexander-beedie alexander-beedie removed bug Something isn't working needs triage Awaiting prioritization by a maintainer labels Sep 6, 2024
@ritchie46
Copy link
Member

You need to update your environment. We test against mypy. I will close this as there isn't any action here for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Related to Python Polars
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants