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

[BUG] Missing types #1240

Open
marcospgp opened this issue Jun 28, 2024 · 9 comments
Open

[BUG] Missing types #1240

marcospgp opened this issue Jun 28, 2024 · 9 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@marcospgp
Copy link

There are many missing types in the library, with many functions having Unknown parameter or return types:

image image

I think it would be a great improvement to have full typing information across the MLX API.

@awni
Copy link
Member

awni commented Jun 28, 2024

I will make this a feature and leave it open. I think it's a good idea to have useful type hints for the stable Python API.

@awni awni added enhancement New feature or request good first issue Good for newcomers labels Jun 28, 2024
@AbhinavMir
Copy link

I ran a quick Python script to see which files are missing type annotations, does this look right?

Report: https://pastebin.com/raw/PepZW2jM

@awni
Copy link
Member

awni commented Jun 28, 2024

I would only consider files in the subdirectory python/mlx for now. We don't need to add strict type hints to benchmarks and tests.

@AbhinavMir
Copy link

AbhinavMir commented Jun 28, 2024

That makes sense - I've modified this here. I was just crawling .py files, changed that around.

https://github.com/AbhinavMir/mlx/blob/typeAnno/type_annotation_report.md

@ManishAradwad
Copy link
Contributor

I have added some type hints for few functions given in above file by @AbhinavMir

Please let me know if they're right

@AbhinavMir
Copy link

One of my friends @catplotlib wants to try Open Source, tagging her here so she can pick up a few type hints!

@Jonathan-Dobson
Copy link

I second the motion to add typings.
The pip dist of mlx.core does not appear to offer type hints.

@jbcoe
Copy link

jbcoe commented Aug 22, 2024

I added #1345 for missing type hints in pip.

@Saanidhyavats
Copy link
Contributor

The issue is partially solved through #1243. Since the PR is inactive for more than a month, I will be continuing the work and create a new pr for updated changes.

Saanidhyavats added a commit to Saanidhyavats/mlx that referenced this issue Aug 27, 2024
awni added a commit that referenced this issue Aug 28, 2024
* Solves issue #1240

* Correction

* Update python/mlx/utils.py

* Update python/mlx/utils.py

---------

Co-authored-by: Awni Hannun <[email protected]>
Co-authored-by: Awni Hannun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

7 participants