Little confused as to the best way add additional behavior (modules) to an existing distribution. Don't use namespace packages and don't use the old method of updating __init__.py because it is slow. So exactly what should be done?
The old method of explicit namespace might also have returned the module 2, you had that same pkgutil typo in that file so that init code probably didn't run correctly.
Would you have suggestions on how to properly maintain a namespace package? Excluding name squatting, mypy, Pytest issues, I have an use case where customers would like to install parts of features my library provides independently - I found limited info on the maintenance aspect as you pointed out
imo a namespace package is just always a bad idea -- you're better to use a plugin system -- here's an example of how to set one up: th-cam.com/video/fY3Y_xPKWNA/w-d-xo.html
with PEP 420, could you potentially override library behavior by namespacing within your own package to another library's namespace or even standard namespace, like if you just plop down an `os` file in your root (or even an `os` directory) could you override existing behavior from an existing namespace just for your code? I suppose that would've potentially always been possible?
I see what you did here. Very clever. PEP 420 in video #420 on 4/20.
took a bit of planning to make it line up this way lol
nice
Everytime I watch one of your videos I realize how much I don't know lol.
Thank you for the amazing videos as always !!
thanks for explaining the namespace packages
Little confused as to the best way add additional behavior (modules) to an existing distribution. Don't use namespace packages and don't use the old method of updating __init__.py because it is slow. So exactly what should be done?
typically you'd do this with a plugin system -- try searching "anthonywritescode plugin system entrypoints" to find my video about that!
The old method of explicit namespace might also have returned the module 2, you had that same pkgutil typo in that file so that init code probably didn't run correctly.
lol oops
Would you have suggestions on how to properly maintain a namespace package?
Excluding name squatting, mypy,
Pytest issues, I have an use case where customers would like to install parts of features my library provides independently - I found limited info on the maintenance aspect as you pointed out
imo a namespace package is just always a bad idea -- you're better to use a plugin system -- here's an example of how to set one up: th-cam.com/video/fY3Y_xPKWNA/w-d-xo.html
with PEP 420, could you potentially override library behavior by namespacing within your own package to another library's namespace or even standard namespace, like if you just plop down an `os` file in your root (or even an `os` directory) could you override existing behavior from an existing namespace just for your code? I suppose that would've potentially always been possible?
it's possible to _add_ modules, but not really override them (though you can "override" modules by putting files earlier in sys.path)
I've watched this video 9 times already. I don't know why, but I keep forgetting #420.
lmao
Thanks! Clear explination and solved my problem.
What exactly is the difference between a "normal" package and a namespace package?
`__init__.py`
Thanks.
Nice vid!
Nice