pypa / pipenv

Python Development Workflow for Humans.
https://pipenv.pypa.io
MIT License
24.92k stars 1.87k forks source link

Add typing annotations #6113

Open Kroppeb opened 8 months ago

Kroppeb commented 8 months ago

Hi

I'm looking into helping out with solving some issues in pipenv, and was diving through some of the code.

I noticed that there a lot of code doesn't have type annotations or docs with type information. Is this an intentional choice, or more a lack of necessity and time?

Having typing information would make navigating the code quite a bit more pleasant :)

Ps. Is there a place where the pipenv team discusses development things outside of github issues?

matteius commented 8 months ago

Hey @Kroppeb -- sorry I've been away for a bit the start of this year, but I am getting back into pipenv issues now. There isn't a real reason we are lacking type annotations other than the pile of technical debt we are chipping away at -- not so long ago pip-shims and requirementslib/vistir were all part of the equation too but not anymore. We would welcome any community driven PR enhancements that solve problems and/or further help cleanup the codebase. You can find me hanging out in the Python Developers slack group, I am not sure if this invite will work but you can definitely find it or email me -- its on my github profile. https://join.slack.com/t/pythondev/shared_invite/zt-2fcjlo1yc-NisCSxAbN7BT~cP9PKpD6w

Kroppeb commented 7 months ago

@matteius Do you want the types as type annotations, or do you think it's better to specify the types in the docstrings to avoid circular imports?

matteius commented 7 months ago

I'd prefer type annotations over docstrings -- its more modern and useful in general. I think circular imports can be avoided because you can do you can string quote types we provide that would be a circular import. Like -> "PipFile" (probably not a real example, but for clarity). Also, if we are returning types in a way that create a circular import, longer term we should try refactoring how that code is organized better.

Kroppeb commented 7 months ago

Good to know, I'll probably make a pr then one of the next few days

FlavioAmurrioCS commented 2 months ago

@Kroppeb @matteius if work on this hasn't been started, I can try to give it shot. Let me know!