DetachHead / basedpyright

pyright fork with various type checking improvements, improved vscode support and pylance features built into the language server
http://docs.basedpyright.com/
Other
601 stars 12 forks source link

Feature: Enforce __all__ in all modules? #463

Open mgzenitech opened 2 days ago

mgzenitech commented 2 days ago

Not sure if it's scope of basedpyright, but maybe it would be possible to implement something like __all__ validation so that there wouldn't be any modules without explicit exports? :)

DetachHead commented 2 days ago

interesting idea. personally i never use __all__ and instead just rely on prefixing symbols with _ to mark them as private

i think both ways are pretty gross, i wish there was a cleaner way to do it, something like an @public or @private decorator. but since that's not a standardized typing feature it wouldn't be an ideal solution for some people.

mgzenitech commented 2 days ago

interesting idea. personally i never use __all__ and instead just rely on prefixing symbols with _ to mark them as private

i think both ways are pretty gross, i wish there was a cleaner way to do it, something like an @public or @private decorator. but since that's not a standardized typing feature it wouldn't be an ideal solution for some people.

agreed, but with __all__ at least it's possible to skip _ prefixes :) I personally use _ only in classes (would prefer @public, @private, @protected decorators though :D)