-
Notifications
You must be signed in to change notification settings - Fork 138
Missing library stubs MYPY #327
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
Comments
Hi , I would like to take up on the issue. |
Is this issue still being considered ? If you are interested, I can work on a pull request. |
@Lenormju Hey, how are you doing? As I mentioned, we overlook missing imports, and we currently run in this manner. However, I am open to helping you if you need assistance. I'm not sure if it's still an issue, but since I've seen this issue is still open, I will determine if it's still active. |
The issue still exists. $ uv run --frozen mypy src/ tests/
src/something.py:4: error: Skipping analyzing "h3": module is installed, but missing library stubs or py.typed marker [import-untyped]
import h3
^
src/something.py:4: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 13 source files) The link explains that :
Because I wanted to have type checking immediately, I quickly wrote these typings for the subset of h3-py that I use : from typing import Literal
def latlng_to_cell(lat: float, lng: float, res: int) -> str: ...
LENGTH_UNITS = Literal["km"] | Literal["m"] | Literal["rads"]
def average_hexagon_edge_length(res: int, unit: str = 'km') -> float: ... But to solve the problem for everybody else automatically, it would be nice if h3-py had typings. Currently, the Python code is not typed at all (no type annotations). So there are 2 options :
But it's best not to duplicate the efforts, and because I'm not a maintainer of h3-py, I don't want to make the decision. After that, we'll establish a plan on how to do it, and we'll discuss how you can help me :) |
In the pursuit of using typing to improve error handling in Python, I use mypy to achieve this goal. However, this library poses issues as there is a lack of 'compatibility,' so to speak, and it gives me messages like this:
This shouldn't block anyone since in the mypy configuration, an exception can be made using the following line
ignore_missing_imports = True
in the mypy.ini file.With this, I could use the
Any
type for typing, which is bothersome because I would like to specify, for example, astr
in thelatlng_to_cell
function and atuple[float, float]
in theget_center_of_hexagon
function.I would like to know if this is being worked on, will be worked on, or what opinion there is regarding adding typing to this great Python library, especially with mypy.
The text was updated successfully, but these errors were encountered: