python-betterproto icon indicating copy to clipboard operation
python-betterproto copied to clipboard

Define __all__

Open AdrienVannson opened this issue 1 year ago • 6 comments

Summary

Define __all__ in the generated files, as suggested by https://github.com/danielgtaylor/python-betterproto/issues/486

Checklist

  • [X] If code changes were made then they have been tested.
  • [X] This PR fixes an issue.
  • [X] This PR adds something new (e.g. new method or parameters).

AdrienVannson avatar Oct 15 '24 15:10 AdrienVannson

Please move this to the end of the file, because honestly it's not something I want to see

Gobot1234 avatar Oct 15 '24 15:10 Gobot1234

Also please can you change this to a tuple not a list

Gobot1234 avatar Oct 15 '24 15:10 Gobot1234

It is defined at the top of the file on purpose, as suggested by PEP-8: https://peps.python.org/pep-0008/#module-level-dunder-names

AdrienVannson avatar Oct 15 '24 16:10 AdrienVannson

Please can you add a test that this exists and avoids importing dataclasses etc?

Gobot1234 avatar Oct 16 '24 01:10 Gobot1234

It is defined at the top of the file on purpose, as suggested by PEP-8: peps.python.org/pep-0008#module-level-dunder-names

I have never seen it go before module imports hmm.

Gobot1234 avatar Oct 16 '24 01:10 Gobot1234

Please can you add a test that this exists and avoids importing dataclasses etc?

I added a test that check that __all__ is correctly defined. However, I'm not sure what you mean by importing dataclasses

AdrienVannson avatar Oct 16 '24 14:10 AdrienVannson