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

Better type hints #927

Open
Ipuch opened this issue Feb 24, 2025 · 7 comments
Open

Better type hints #927

Ipuch opened this issue Feb 24, 2025 · 7 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Ipuch
Copy link
Collaborator

Ipuch commented Feb 24, 2025

With @pariterre, we think that we should migrate to global type hints:

currently we have such hints:

def function(entry: list[int] | tuple[int]):
      return None

Instead, we would like:

ListLikeInt = list[int] | tuple[int]
def function(entry: ListLikeInt):
      return None
@Ipuch Ipuch added enhancement New feature or request good first issue Good for newcomers labels Feb 24, 2025
@EastWest14
Copy link

@Ipuch I got this. You want to change in every python file?

@pariterre
Copy link
Member

@EastWest14
With great pleasure 🙂

Could you first create a PR for a single file with the proposed naming for the all (or most of) the list/tuple (and other typing names that you can think of)? Once we agreed with the naming with @Ipuch , you could change it everywhere. This new file should be misc/types.py

Thanks a lot!

@EastWest14
Copy link

EastWest14 commented Feb 24, 2025

@pariterre @Ipuch Here is a draft for one tiny file:
link(https://github.com/pyomeca/bioptim/pull/928/files)

Where should I put the file with all the type names?

@EastWest14
Copy link

@pariterre @Ipuch Do you want me to continue with PRs for other modules? Happy to keep working on this

@pariterre
Copy link
Member

Definitely :)

@Ipuch
Copy link
Collaborator Author

Ipuch commented Feb 28, 2025

That's a great idea ! Great work by the way ;)
TBH, I'm curious, how did you find the repo and the issue ?

@EastWest14
Copy link

Ok, there are about 6 big modules - I'll be going one by one. Will take about 2-3 days per module.
Will post PRs as they come up and tag you here.

I found it in Github search for open issue and "good first issue".

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

3 participants