top | item 42420967

(no title)

stcg | 1 year ago

One of the biggest usability problems with Python dependencies is that the name you import might be different from the name that you use to install the package.

So if you find some script on the web that has an `import foo` at the top, you cannot just `pip install foo`. Instead, you'll have to do some research into which package was originally used. Maybe it's named `pyfoo` or `foolib`.

Compare that to for example Java, which does not have that problem, thanks to Reverse Domain Name Notation. That is a much better system.

discuss

order

zahlman|1 year ago

"install name == import name" cannot work in Python, because when you `pip install foo`, you may get more than one top-level package. Or you may get a single-file module. Or you may, validly per the spec, get no Python code whatsoever. (For example, you could publish large datasets separately from your data science library, as separate wheels which could be listed as optional dependencies.)

The lack of good namespacing practice is a problem. Part of the reason for it, in my estimation, is that developers have cargo-culted around a mistaken understanding of `__init__.py`.