apify / apify-client-python

Apify API client for Python
https://docs.apify.com/api/client/python/
Apache License 2.0
44 stars 11 forks source link

Remove `__all__` from all `__init__.py` #165

Closed vdusek closed 1 week ago

vdusek commented 9 months ago

Utilizing star imports, such as from apify_client import *, is generally considered as a bad practice in Python. This is because it can lead to namespace conflicts. While there may be specific scenarios where star imports could be useful, I don't see the case in the context of our packages.

I suggest removing them from our codebase so that we don't incentivize users to adopt this practice. Also, we won't have to maintain these lists anymore.

fnesveda commented 9 months ago

Yeah, good idea. When I added those, I thought they behave a bit differently, that they limit what can be imported even through named imports (sort of like module.exports in Node.js).

Unfortunately, this is a breaking change, so let's wait with this until we have to do a major release because of something else. (We should start collecting these breaking issues into some 2.0 milestone or something, so that we don't forget about them).

vdusek commented 1 week ago

Closing, as it turns out the __all__ variable is used by Pylance to recognize the public interface of the package.