apify-client-python icon indicating copy to clipboard operation
apify-client-python copied to clipboard

Remove `__all__` from all `__init__.py`

Open vdusek opened this issue 2 years ago • 1 comments

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.

vdusek avatar Nov 20 '23 10:11 vdusek

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).

fnesveda avatar Nov 27 '23 05:11 fnesveda

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

vdusek avatar Aug 30 '24 09:08 vdusek