Repository navigation
Description
Regarding page: https://packaging.python.org/en/latest/tutorial.html
[Edit: Preview isn't working, and I can't figure out how to either use or suppress github's auto-numbering... grrr]
ONE. the word "package" appears in the narrative over 30 times (and many more times in the source code). In a significant proportion of cases, it's difficult to tell (particularly given that this is a tutorial) which meaning of package is intended, and indeed the article intermingles mentions of both. Similar fuzziness with the relationship between "package" and "project".
I suggest that every instance of "package" be replaced with a term which explicitly disambiguates between the two meanings. Possibly "distribution package" and "module package". (I see that the glossary has two clearly distinct entries, but doesn't recommend distinct terms by which clear discussion might be enabled.)
TWO. In section "Creating your own Project", there's a subhead "Layout":
TWO-A. It's not clear what, in the subsequent narrative, is talking about "layout". "Layout" could mean directory organization, but directories are not mentioned.
TWO-B. However "a single top-level package" is mentioned: package meaning#1 or package meaning#2? Top-level of what? Can there be multiple or nested packages? Etc.
TWO-C. The 'single top-level package' link points to a sample on github in which the __init__.py file which contains the program main() function. Will a tutorial reader really understand what this is about, coming from virtually any other book or tutorial in which their entry function is in myprogram.py? This may be a way to go about things, or possibly a really good way, but it needs significantly more intro to explain why this obtuseness is a good idea, what's the downstream impact and so on, I think.
THREE. Glossary entry for Package Meaning #1 needs revision since PEP 420 does away with the requirement to mark module packages with __init__.py.
Activity
qwcode commentedon Aug 29, 2014
hey @gwideman , you're back : )
do you do PRs?
qwcode commentedon Aug 29, 2014
I'll take a crack at most of the things you're concerned about. coming up later....
gwideman commentedon Aug 29, 2014
Hi Marcus -- "back" <-- yes. Previously I ran out of time to get to the bottom of how to really work with packaging and distribution tools, rather than working against them, or reinventing them. Now I'm revisiting it to see what's changed, given PyPA activities, Python 3.4 and so on. And prompted by discussions with local Python group. Also, no, I'm not currently up-to-speed on doing PR's for this, and in any case, don't consider my views authoritative. Thanks for taking a look.
qwcode commentedon Aug 29, 2014
I don't want to create more combo words that we'll have to define.
But I do think it's reasonable to replace "package" with "distribution", when we actually mean that, and link to the glossary entry for it.
using "distribution" may actually be foreign for many who happily carry around the double meaning of "package", but considering the tutorial is for new users, I think they carry more weight.
it points to a directory on github, which is the package, but I agree that whole "Layout" section needs some work. I'll open a 2nd PR for that.
As for PEP420, I'm not sure about that. @ncoghlan ?
dstufft commentedon Aug 29, 2014
Do we need to use the word package at all? PEP426 has:
qwcode commentedon Aug 29, 2014
yes, for the "collection of modules" meaning.
The glossary covers the 3 terms you mention in the same way as PEP426
In addition, it gives 2 meanings of "package":
qwcode commentedon Aug 29, 2014
I'm working on a PR now to at least scrub the tutorial of the #2 use of "package"
pfmoore commentedon Aug 29, 2014
Way back when, PEP426 tried to distinguish between "distribution" (thing on PyPI) and "package" (importable thing). The glossary reflects this. But in practice, no matter how hard we tried, people didn't get used to "distribution" as a term. It's more common now to use it, but there are contexts where it just sounds unnatural.
Summary - worth trying to be consistent with the terms in the docs, but people will still confuse and misuse them ;-)
ncoghlan commentedon Aug 29, 2014
The distribution:package correlation is also so close to being 1:1 that stopping people from using "package" for both is basically impossible.
+1 for Marcus's plan of at least being consistent in only using package in the "module with a
__path__attribute" sense in the packaging docs.gwideman commentedon Aug 29, 2014
Hi all: Thanks for thinking about this, and sorry that this is a much-beaten-horse kind of topic.
I, too, feel that people are unlikely to stop using "package" for "distribution", and of course the collection-of-modules meaning of "package" is wired into the language.
At this juncture in the game, trying to establish one-word terms (such as "distribution" and "package") is a losing battle because whatever one-word terms are ordained they don't actively raise awareness that there are two meanings of "package" in common use to watch out for.
If, instead, we create an expectation that "package" can appear in either sense, but to be clear should appear as part of a two-word term, then where it appears alone the reader can sense a risk of misinterpretation. Hence: "distribution package" and "module package" (or maybe slightly more evocative: "modules package").
So I guess I'm advocating that effort not be wasted trying to get people to use (one-word) "package" exclusively one way or the other, but instead have the glossary prescribe a distinct two-word "xxx package" term for each of the two cases. Anyone seeking to write/speak unambiguously could just follow that advice, and turn their attention to more important matters.
ncoghlan commentedon Aug 29, 2014
"distribution package" does have the virtue of also being distinct from the "Linux distribution" sense of "distribution" (even if it's part of the PEP 426 terminology recommendations to shorten the latter as "distro"). I'd be OK with the following setup for the official packaging docs (and would be prepared to update PEP 426 accordingly):
distribution package: the kind of package you find on the Python Package Index
import package: the kind of package you can import
self-contained (import) package: an import package with an init.py file
namespace (import) package: an import package without an init.py file, or one that uses the pkg_resources or pkgutil namespace package tools to produce the same behaviour
An unqualified "package" would still be permitted when unambiguous, as would an unqualified "distribution".
pfmoore commentedon Aug 29, 2014
@ncoghlan +1 to that
@gwideman thanks for re-flogging the horse, it looks like we may have come up with a much improved approach as a result :-)
qwcode commentedon Aug 29, 2014
Well, to be fair, attempts to properly distinguish go back further than that.
Ian Bicking blogged about it way back in 2008 (alghough somewhat differently)
http://www.ianbicking.org/blog/2008/12/a-few-corrections-to-on-packaging.html
And the Old Hitchhiker's guide made the "package"/"Distribution" distinction the same as PEP426 back in 2009? or 2010?
I'm tempted to go along with this, but I honestly think we'd end up regretting it later. "distribution package" is an odd concoction that only makes sense given our odd history of using the word "package". I don't want to create new words based on that.
I think we should be able to freely use a general word like "distribution", and not fear confusion with linux distribtions. PyPI contains "distributions" of software. Linux shouldn't own that word.
I'm more inclined to stay the course of trying to gently move over to the "package" / "distribution" distinction. (i.e. away from the double use of "package")
Here's what I'd like to do:
ncoghlan commentedon Aug 29, 2014
I think Marcus makes a good case. As far as PyPI naming goes, perhaps
"Python Platform Index"? That would tweak the name to mean "the central
distribution index for the Python platform", rather than "an index of
Python packages".
dstufft commentedon Aug 30, 2014
I think renaming PyPI is going to require a distutils thread :) Let's name it PyPR :D (Python Project Repository!) to stop the confusion with PyPy (I'm only half joking). I honestly don't personally care much what PyPI is called as long as people don't use what it's name says as a justification for bad things.
Warehouse will be using the definitions from PEP 426 wherever it can except where it doesn't have a choice due to compatibility concerns (e.g. one of the legacy URLs is /packages/) so it won't use the word "package".
Retrofitting onto PyPI can be done, not sure if I'll get around to it but it shouldn't be a big deal.
gwideman commentedon Aug 30, 2014
Hi all:
@nick: "distribution package / import package / self-contained / namespace"
Personally I like this set of explicitly spelled-out distinctions, because, in my background, ambiguity is more costly than slightly longer names.
@qwcode (Marcus, for onlookers): "I'm tempted to go along with this, but I honestly think we'd end up regretting it later. "distribution package" is an odd concoction that only makes sense given our odd history of using the word "package". I don't want to create new words based on that."
I wasn't clear about this, but my suggestion of "distribution package" doesn't preclude "distribution", as that one-word term is unambiguous (at least within the python realm). So the glossary could advise something like: "use 'distribution' or 'distribution package' but not 'package' by itself".
And I might say that it's precisely because of the history that "distribution package" makes sense -- to help move the community from its current, history-caused terminology, to a clearer terminology.
That said, I think all participants would be happy with a world in which "package" disappeared as a term "distribution"; the debate is about whether that's likely to happen, how long it might take, and how it might be brought about.
If participants want that world, then it would take some leadership to use the desired terms and forgo the deprecated terms, starting with some pretty prominent names and docs:
Python Packaging Authority, Python Package Index, Python Packaging User Guide, references in pip docs to "package" and "package management", and so on.
I'm not convinced that's sufficient, but pretty convinced it's necessary.
@dstufft: PyPI vs PyPy confusion -- more than once I've seen talks where that confusion arose. Not to mention that sans serif "PyPI" looks like the last letter is lower case "L".
ncoghlan commentedon Aug 31, 2014
Ah, I think @gwideman just hit on the most suitable rebranding of PyPI: the Python Packaging Index, as that is just a matter of bringing it into line with PyPA and PyPUG :)
It's also a valid point that the broader context means we can't unilaterally get rid of the "package" term in this context, and that's not just due to the use of the "packaging" term. This entire field is called software packaging and distribution, since those are the two major components, and the concerns they address are genuinely different. You can sort of solve packaging without solving distribution (cf Windows), you can sort of solve distribution without solving packaging (cf Java), and you can pick various combinations of the two that make different trade-offs.
So my proposal would be that we add a separate "Terminology Usage and Pronunciation Guide", distinct from the existing glossary, as it's primarily useful to folks writing documentation and creating presentations, rather than being necessary for folks reading or watching them.
Writing that would be where I agree the more explicit "distribution package" and "import package" terms can help:
As far as disambiguation when speaking goes, perhaps we should include a pronunciation guide in the tutorial or glossary, and explicitly give the reason why the pronunciation matters? I always say pie-pee-eye myself, specifically due to pie-pie being a homonym with PyPy. (I'm also a fan of any extra subtle advertising we can give PyPy, since that's a highly valuable project that's genuinely advancing the state of the art in dynamic language interpreters)
So that would be something like:
distutils-sig(which refers to the distutils standard library module, created in 1998 as the initial iteration of a standardised source based packaging and distribution system for Python).packaging.python.org.If this sounds acceptable to folks, @cjrh suggested I run a "how you can help improve Python packaging" session at the September Brisbane Python User Group session, and (assuming that happens) this could be a good thing for us to work on contributing.
And now for something completely different: PyPUG + Cheese Shop
PyPA currently has no mascot animal. Python itself has the snake (even though Guido doesn't like it), Django has the pony (even though Adrian - IIUC - doesn't like it), the testing-in-python list has the testing goat. Given the name of the PyPUG, and the image search above, I think the most appropriate choice for PyPA is becoming clear :)
dstufft commentedon Aug 31, 2014
HONEYBADGER
(Honeybadger don't care - https://www.youtube.com/watch?v=4r7wHMg5Yjg)
gwideman commentedon Aug 31, 2014
@ncoghlan I'm a little confused. I was arguing that trying to prevent "package" being used for "distribution" would require renaming PyPI, PyPA and PyPUG to names that didn't include "packaging". If I read you right, you seem to be promoting the current names -- should we infer that you are arguing for keeping "package" as a word for both its python meanings , so long as it's qualified? I do favor that position, as I think it's more practical than stamping out one of the usages -- just wanted to be clear on your preference.
Also: "Ah, I think @gwideman just hit on the most suitable rebranding of PyPI"... well, I'm delighted someone thinks I hit on something... but I'm not sure what it was :-) Isn't Python Packaging Index already called "Python Packaging Index"? Or is this some sly Pythonesque humo(u)r that I'm missing?
ncoghlan commentedon Aug 31, 2014
@gwideman: the distinction I think you hit on is that between "packaging" (as in the general field of study and development that is "software packaging") and "package" (as in units of software that we can do things with). PyPI is currently the "Python Package Index", which puts it squarely in the latter domain, and is why people talk about renaming it.
By contrast, PyPA and PyPUG both use "Packaging", in reference to the whole area of work, rather than any specific piece of software within it. Switching PyPI to that same naming scheme makes a whole lot of sense, as all three are closely related, and the umbrella term "packaging" is a much better fit for PyPI's role than the more specific term "package".
qwcode commentedon Sep 4, 2014
I'm ok with that.
I was confused too. But regardless, I agree with @ncoghlan that our uses of "Packaging" can stay.
sounds reasonable.... I think I'll carve out another issue for that, seperate from this, and paste your thoughts in there. (#89)
ncoghlan commentedon Oct 5, 2014
Also see issue #106