liormizr / s3path

s3path is a pathlib extension for AWS S3 Service
Apache License 2.0
206 stars 39 forks source link

Fix type hints for classmethod factories #148

Closed mgab closed 7 months ago

mgab commented 9 months ago

This fixes #147

The approach introduced in PEP-637 to annotate methods that return an instance of their class is only available from python 3.11. As I understand s3paths is intended to maintain compatibility with older versions of python, I used the workaround discussed in the same PEP document

liormizr commented 7 months ago

Hi guys

Thanks for the thought

Personally I prefer to add type hints only where it helps and not fully adding them in every place. In this case every editor know how to automatically do verification when you returning a instance of a object from a classmethod, so I prefer to remove it and not start specify the class and creating new types accordingly. Thats why I decided not to use this PR in the end. It's not saying it's not good, it's just my personal opinion.

Thanks you very much for the contribution

For now if it's OK with you I'm closing this PR