packageurl-python
packageurl-python copied to clipboard
Adding type hints
hey 😄
Thanks for the great project 🚀 We are using both your project and CycloneDX to create SBOMs.
I would like to know, if you are interested in adding type hints to your project? I'm a big supporter of improving Python projects by adding type hints to them and reduce the amount of errors, which come from passing the wrong types to a functions or expecting a different result to come back.
I'm willing to do the change, just need to know if you prefer stub files or inline type hints, I usually prefer the latter one? I would also add mypy
to your CI to check, if the added type hints make sense or not 🙂
i support the request. @madpah FYI
this request might be a duplicate to https://github.com/package-url/packageurl-python/issues/65
@pombredanne how do you feel about the topic?
i mean, we do have 3 options:
- adding typing here in the project in code -- generally preferred
- adding typing here in the project as stubs -- okay-ish
- adding typing for PURLs in the python/typeshed as stubs -- if yo do not like type hints but the community wants them anyway.
@jkowalleck yeah you are right, it is a duplicate. Shame on me 🙈
I'm currently creating the stubs files. So worst case I will create a PR in typeshed
and best case I will change them to type annotation directly in the project.
I thank you so much for your effort, @gruebel
@gruebel @jkowalleck Adding typing is fine and likely best done here rather than elsewhere in separate stubs. PR welcomed!
@pombredanne I created an initial PR #101 would be great to get some feedback. Don't be surprised about me changing variable names. I had to do it, because of type changes in the code. If you have any questions, just add some comments, then I will try to explain, why I had to do it like that.
Implemented in https://github.com/package-url/packageurl-python/pull/101, thanks @gruebel !