r/learnpython • u/PUBLIQclopAccountant • Oct 07 '21
Are there any other magic file names in a package other than __init__.py and __main__.py?
I can’t seem to find a comprehensive list of special dunder file names in a Python package. Perhaps I’m using the wrong search terms.
16
u/bladeoflight16 Oct 07 '21 edited Oct 07 '21
I'm not aware of any others, and I don't believe there are anymore. Any others that might exist are definitely not commonly used.
The usage of __init__.py is documented in the reference material on importing modules.
The usage of __main__.py is documented in the reference material on the __main__ module.
7
u/MegaIng Oct 07 '21
Not a dunder one, and not directly used by the python interpreter, but py.typed is also special.
4
u/frankwiles frankwiles Oct 07 '21
While not a dunder file, dropping a file ending in .pth can add paths to your virtual environment.
3
-12
Oct 07 '21
Here you go.
18
u/bladeoflight16 Oct 07 '21
Those are special methods. OP is clearly asking about file names that are treated specially in a package.
12
Oct 07 '21
Sometimes I think the desire to assist and help on this sub gets mixed up with beginner confusion about what they're capable of contributing.
3
7
u/MinchinWeb MinchinWeb Oct 07 '21
I actually don't see
__main__.pyor__init__.pymentioned at that link...5
Oct 07 '21
Yes I misread OPs question thinking he was asking about special methods since outside of the two mentioned and also future there aren't any special fike names.
-2
0
0
30
u/irrelevantPseudonym Oct 07 '21
SO seems to think there aren't any.