Skip to content

#1316 Update packaging-projects.rst with a tip on good module naming - #1424

Closed
LLyaudet wants to merge 33 commits into
pypa:mainfrom
LLyaudet:patch-1
Closed

LLyaudet wants to merge 33 commits into
pypa:mainfrom
LLyaudet:patch-1

Conversation

@LLyaudet

@LLyaudet LLyaudet commented Nov 30, 2023 •

Copy link
Copy Markdown
Contributor

@LLyaudet

Copy link
Copy Markdown
Contributor Author

#1316

@henryiii

henryiii commented Nov 30, 2023 •

Copy link
Copy Markdown
Contributor

IMO, this is a lot of information for a tutorial. Most users should be following the tutorial, which tells them what to name the files. This is more "guide-like" / advanced information. I think a simple 1-2 sentence warning about folder needing underscores to be importable is fine. (99.9% of users don't need to know about a workaround to import something with a dash in it). In fact, the design of stubs packages with -stubs is specifically to make them obviously not importable in normal Python!

@LLyaudet

Copy link
Copy Markdown
Contributor Author

Hello @henryiii :)

I agree there is a lot of informations but I placed it at the end of the tutorial so that it does not overwhelm a person that just wants to follow the tutorial.

Moreover, I think it is useful to have "hubs of links with a small dive on a topic" somewhere.
Somehow, I feel the informations I linked together should be linked together somewhere.
Maybe a better place would be a dedicated page like packaging-projects-advanced.rst or packaging-projects-"something".rst.
In that case, there could be a simple sentence at the end of packaging-projects.rst with a link to this more in-depth page.

Best regards,
Laurent Lyaudet

@jeanas

jeanas commented Nov 30, 2023

Copy link
Copy Markdown
Contributor

I completely agree with @henryiii. @LLyaudet Please refer to the Diataxis documentation process which we use:

https://diataxis.fr/tutorials/

Specifically:

"""
Offer only minimum, necessary, explanation

If the learner doesn’t need an explanation in order to complete the tutorial, don’t explain.
"""

Also see: https://devguide.python.org/documentation/style-guide/#audience

Moreover, having module names that are not valid Python identifiers is an extremely niche use case. I don't think it should be mentioned even in guides outside the tutorial. We should just make it clear that project names are not restricted to be Python identifiers, unlike module names.

@LLyaudet

LLyaudet commented Nov 30, 2023 •

Copy link
Copy Markdown
Contributor Author

Hello @jeanas :)

I don't know what kind of pedagogy study supports this:
"""
Offer only minimum, necessary, explanation

If the learner doesn’t need an explanation in order to complete the tutorial, don’t explain.
"""
When I learn, I always ask myself much more questions than what is required to just follow instructions in a tutorial.
And usually I try to "poke the system" by trying things that are slightly distinct from the tutorial.
And when I teach I always give more context information than the strict minimum.
I understand it may not always be welcome, but that's why I put this tip at the end as I said.
And that I suggested it may be in an "advanced tutorial".

Also see: https://devguide.python.org/documentation/style-guide/#audience

Please be specific. The tone of this link is contemptuous on some part.
Please write here what part of this link you think should apply in this situation.

Best regards,
Laurent Lyaudet

@jeanas

jeanas commented Nov 30, 2023

Copy link
Copy Markdown
Contributor

I don't know what kind of pedagogy study supports this:
"""
Offer only minimum, necessary, explanation

If the learner doesn’t need an explanation in order to complete the tutorial, don’t explain.
"""
When I learn, I always ask myself much more questions than what is required to just follow instructions in a tutorial.
And usually I try to "poke the system" by trying things that are slightly distinct from the tutorial.
And when I teach I always give more context information than the strict minimum.
I understand it may not always be welcome, but that's why I put this tip at the end as I said.
And that I suggested it may be in an "advanced tutorial".

The quote is not implying that documentation should only offer minimum explanation, only that the tutorial should remain minimal, as an entry point for absolute beginners, and all more advanced explanations should live in guides or discussions, with the TOC serving as your “hub of links”. This is merely a way to structure documentation, there are other ways but Diataxis happens to have been chosen for packaging.python.org.

I think that (a) the info you are proposing to add here should not live in the tutorial but in an explanation, following Diataxis, and (b) part of it (specifically, anything related to modules with names that aren't valid Python identifiers) should be stripped.

Also see: https://devguide.python.org/documentation/style-guide/#audience

Please be specific. The tone of this link is contemptuous on some part.
Please write here what part of this link you think should apply in this situation.

Second and third paragraphs. The second asks to “save details for the how-to guides and other sources”.

The third paragraph might sound contemptuous as phrased there, and it is not my intent to express contempt against you, but I do think this is a case of trying to improve the documentation in a way that would have helped you avoid some problem but where that problem isn't actually common. What you see is that you would have benefited from this note. What you may not see is that there are dozens and dozens of other notes of equal or greater importance that could be added to the tutorial, but adding them would make the tutorial difficult to use.

@jeanas

jeanas commented Dec 1, 2023

Copy link
Copy Markdown
Contributor

xref: #1425

@LLyaudet

LLyaudet commented Dec 1, 2023

Copy link
Copy Markdown
Contributor Author

Hello @jeanas ,

The quote is not implying that documentation should only offer minimum explanation, only that the tutorial should remain minimal, as an entry point for absolute beginners, and all more advanced explanations should live in guides or discussions, with the TOC serving as your “hub of links”. This is merely a way to structure documentation, there are other ways but Diataxis happens to have been chosen for packaging.python.org.

I think that (a) the info you are proposing to add here should not live in the tutorial but in an explanation, following Diataxis, and (b) part of it (specifically, anything related to modules with names that aren't valid Python identifiers) should be stripped.

Ok, as I commented I was open to have my redaction submitted in this PR moved to a discussion/advanced tutorial, so point (a) is ok with me, if there is at least a small warning with link like "See here for an advanced discussion on package names" in source/tutorials/packaging-projects.rst. But I have see that you somehow decreased the need for that with #1425 and #1426.

But I do not see any valid reason for your point (b).
What is wrong with explaining the possibilities of Python importlib in a more in-depth discussion ?

Let's cite the third paragraph so that navigating is not needed:

Be careful accepting requests for documentation changes from the rare but vocal category of reader who is looking for vindication for one of their programming errors (“I made a mistake, therefore the docs must be wrong …”). Typically, the documentation wasn’t consulted until after the error was made. It is unfortunate, but typically no documentation edit would have saved the user from making false assumptions about the language (“I was surprised by …”).

And your answer :

The third paragraph might sound contemptuous as phrased there, and it is not my intent to express contempt against you, but I do think this is a case of trying to improve the documentation in a way that would have helped you avoid some problem but where that problem isn't actually common. What you see is that you would have benefited from this note. What you may not see is that there are dozens and dozens of other notes of equal or greater importance that could be added to the tutorial, but adding them would make the tutorial difficult to use.

Sorry but I cannot accept this is the right way to see the problem and I still have doubts about your intent.
What I proposed to improve the documentation goes beyond what would have been needed to avoid my problem.
It is an improvement after search of various bits of informations.
Please give examples of other notes of equal or greater importance that could be added to the tutorial, but adding them would make the tutorial difficult to use.
And give examples where adding a F.A.Q. at the end of the tutorial with such notes would make the tutorial difficult to use.
I see no way something at the end of something else can prevent someone from reading the beginning or add complexity to the reading of the beginning.
You see the cathedral in its entirety already ? Or you construct the documentation as a bazaar ?
I think we all know that the current process is bazaar.
It is funny because today this blog post was on HN:
https://olano.dev/2023-11-30-code-is-run-more-than-read/.
The "user" is the person who reads the tutorial with or without mistakes from its part.
Hence listening should be the norm, as improving with the returns of the users.
What is the frequency of improvements that comes from learning from mistakes ?
And what is the frequency of improvements that comes without any mistakes ?
How many projects are less good that they would have been if the dev/biz/whatever just listened with an open mind.
Third paragraph could have been wrote by a spy agency as in :
http://svn.cacert.org/CAcert/CAcert_Inc/Board/oss/oss_sabotage.html
(Thanks HN again for the reference.)
Clearly this paragraph is golden for (11)(a)(7).
And I think that what you say is also in line with (11)(a)(7).
With a lot of bad faith, you can respond that (11)(a)(4) or (12)(d) applies to what I say.
But in the end, I still see an improvement in the content of this PR, even if it needs to be moved to another file.

Best regards,
Laurent Lyaudet

@LLyaudet

LLyaudet commented Dec 1, 2023 •

Copy link
Copy Markdown
Contributor Author

who is looking for vindication

Moreover, there was no vindication when I opened #1316.
Third paragraph makes a free trial of intent to anyone who makes a mistake.

@jeanas

jeanas commented Dec 1, 2023

Copy link
Copy Markdown
Contributor

I'm sorry but it would simply take me more time than I have to formulate a thoughtful response (esp. given the "doubt about my intent"). I'm going to just let people with commit access decide what to do with this PR.

@webknjaz webknjaz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the attempt to improve this tutorial! We can't accept this change as is, though.

This change is made to a tutorial document, but this document type is expected to include simple instructions exclusively, exactly as is, without any deviations. It probably fits guides or discussions better. Frankly, #1425 is probably what the guide needs instead.
I'm also concerned that this mostly duplicates the explanation of how Python itself works, which isn't directly related to packaging.

Like many other projects over at least half a decade, we're doing our best to follow the Diátaxis framework for writing technical documentation. I witnessed it gaining a rising popularity since at least 2018, since it's formalized and preached by a respected member of the Python community. Some projects/organizations have their own variants of techwriting guidelines that mostly resemble Diátaxis or are direct derivatives of it.
In PyPUG, we also aspire to follow it. Please, refer to https://diataxis.fr which has a lot of information about the different aspects of using it.
Moreover, you can find the author on the Write The Docs Slack instance where there's a corresponding channel: https://www.writethedocs.org/slack/. Daniele is quite responsive there, and this place has a very high concentration of experienced techwriters, exchanging ideas and discussing practical applications of this framework and other things (in separate channels).

I'm afraid, this issue is not a place for debating what Diátaxis got right and wrong. What's important here is that the maintainers and frequent contributors agree that this is the way to go and everybody is expected to respect the convention.

Comment thread source/tutorials/packaging-projects.rst Resolved
Comment thread source/tutorials/packaging-projects.rst Resolved
@willingc willingc added diataxis: tutorial Learning oriented lesson (https://diataxis.fr/tutorials/) diataxis: explanation Understanding oriented discussion (https://diataxis.fr/explanation/) labels Dec 1, 2023
@LLyaudet
LLyaudet requested a review from webknjaz December 1, 2023 23:56
@LLyaudet

LLyaudet commented Dec 1, 2023

Copy link
Copy Markdown
Contributor Author

Hello,
I corrected the points given in the review.
Best regards,
Laurent Lyaudet

@webknjaz

webknjaz commented Dec 2, 2023

Copy link
Copy Markdown
Member

I corrected the points given in the review.

I wouldn't say so. The references are invalid (they must be identifiers Sphinx understands, not filenames). The location of the changes hasn't changed either. Both are hard blockers.

@LLyaudet

LLyaudet commented Dec 2, 2023

Copy link
Copy Markdown
Contributor Author

Hello,

I corrected the points given in the review.

I wouldn't say so. The references are invalid (they must be identifiers Sphinx understands, not filenames). The location of the changes hasn't changed either. Both are hard blockers.

Sorry, I corrected the references. It should be ok now.
I switched the content in a new discussion Choosing a Module Name.
And linked between it and Packaging Python Projects.
Let me know if you see anything else to improve :).

Best regards,
Laurent Lyaudet

@LLyaudet

LLyaudet commented Dec 6, 2023

Copy link
Copy Markdown
Contributor Author

Hello :),

I finished analyzing the build results in testpypa.

The following applies to my test but may differ in other contexts.
The archive tar.gz suffix is always -1.0.0.tar.gz.
The wheel whl suffix is always -1.0.0-py3-none-any.whl.
The dist-info suffix is always -1.0.0.dist-info.
The egg-info suffix is always -1.0.0.egg-info for setup-tools.
All suffixes are kebab-case.

When the correct import package is found, it is always leaved as is (no normalisation): no lowercase, no underscore instead of dash.
whl, dist-info, and egg-info prefixes are always normalized.
Thus, a mismatch between import package name and dist-info after install is the norm if import package name is not normalized.
tar.gz prefix is normalized by Flit, Hatchling, PDM, but not by setup-tools.

  • with kebab-case:
    • Flit: Fail;
    • Hatchling: no error but the wheel is broken with src as importable;
    • PDM: success;
    • setuptools: , success;
  • with snake_case: success for Flit, Hatchling, PDM, and setuptools

I tried to be synthetic and group similar results.
Not sure what would be interesting for the documentation,
maybe just two sentences:
"If your import package name is not a valid identifier, Flit will crash at build, Hatchling will create a not working wheel with src as import package, both PDM and setuptools will build correctly.
If your import package name is not a normalized valid identifier or if you have many import packages in your project, there will also be a mismatch between .dist-info file and import package(s) name(s)."

It can replace "Hatch will recognize that the module corresponding to the package is abcd_1234 instead of defaulting to src and building a not working wheel."

I'll try to improve the PR tomorrow :).

Best regards,
Laurent Lyaudet

github-merge-queue Bot pushed a commit that referenced this pull request Dec 7, 2023
Correction of two code-blocks python -> pycon after suggestion from #1424
@LLyaudet

Copy link
Copy Markdown
Contributor Author

Hello :),

Sorry for the delay.
I modified the contents with most of the suggestions.
I merged your 2 last suggestions @sinoroc but I switched order and wrote it slightly differently.

I have reopened a conversation where I applied your commit suggestion, since I have a question for best practices regarding term references (only one per document or for each occurrence).
It would be nice if that best practice could be explicit in contribute.rst.

Apart from that, I included the results of my testing of the 4 build backends covered in the tutorial.
I am quite happy that it supports and illustrates further the importance of good naming.
I hope you will see this interest also :).

I build the doc with nox and everything is ok.

If you do not mind, I would like to know if it is ok to move again the document as is from discussions/ to guides/.
Or if it is not in a shape that can be considered a guide by now.
I anticipate that you will probably make more corrections and improvements.
I would feel more comfortable to put the document at the right place,
and then let other authors directly commit on the PR or after the PR is merged.
The document as is conveys the informations I wanted to see in it.
I fear that at the end the document will not look like what I wrote and it is time consuming and painful to just validate others modifications.
Sometimes I see them as improvements and sometimes I just see them as rewording which is not pleasant.
I prefer that each person authors its modifications.

Best regards,
Laurent Lyaudet

@jeanas

jeanas commented Dec 17, 2023

Copy link
Copy Markdown
Contributor

Sorry, this got auto-closed because I wrote "Fixes #1424" in #1426 while I meant "Supersedes #1424". Reopening.

I do think that the info added in #1426 (now here) is sufficient, but I will leave it to committers to choose whether to continue this, or to re-close it and also close the associated issue #1316.

@jeanas jeanas reopened this Dec 17, 2023
@LLyaudet

Copy link
Copy Markdown
Contributor Author

Hello :),
Thanks for reopening it.
I do not think it should be closed, since it provides information that are not covered in #1426.
I'm still opened to suggestions to the correct way of giving this information in the final documentation.
At last iteration, we wanted to put it in a guide.
But I had no feedback on my last comment.
Best regards,
Laurent Lyaudet

@rgommers rgommers added type: enhancement A self-contained enhancement or new feature component: discussions labels Nov 10, 2026
@rgommers

Copy link
Copy Markdown
Contributor

I do think that the info added in #1426 (now here) is sufficient, but I will leave it to committers to choose whether to continue this, or to re-close it and also close the associated issue #1316.

We have three reviewers here who repeatedly indicated that this isn't worth it. I agree with that. The current form of this PR is not useful and contains too much overlap with what was added in #1426. And it's not worth another whole page even if that was addressed - at most we can add a single sentence at the point in the tutorial where the confusion originally arise. I did just that in #2186.

@rgommers rgommers closed this Nov 12, 2026
@LLyaudet

Copy link
Copy Markdown
Contributor Author

Hello @rgommers ,

"gommer" means "erase" in French...
You quote message n-1 of @jeanas .
But I answered it.
Why you didn't quote my last message?

I do not think it should be closed, since it provides information that are not covered in #1426.
I'm still opened to suggestions to the correct way of giving this information in the final documentation.
At last iteration, we wanted to put it in a guide.
But I had no feedback on my last comment.

It was referencing another comment of mine:

If you do not mind, I would like to know if it is ok to move again the document as is from discussions/ to guides/.
Or if it is not in a shape that can be considered a guide by now.
I anticipate that you will probably make more corrections and improvements.
I would feel more comfortable to put the document at the right place,
and then let other authors directly commit on the PR or after the PR is merged.
The document as is conveys the informations I wanted to see in it.
I fear that at the end the document will not look like what I wrote and it is time consuming and painful to just validate others modifications.
Sometimes I see them as improvements and sometimes I just see them as rewording which is not pleasant.
I prefer that each person authors its modifications.

I'm quite fed up of people burying my work without tought, without respect, without consideration.
May I drop your life also?
When people have a mind they explain their decision.
When people have power they enforce their decision.
When people have no balls they wait for enough time that the decision may seem rational because of the time that passed since then, and they enforce their decision.
Buy yourself a mind, it's free, go to the church and listen to someone who is truly greater than you.

@rgommers

Copy link
Copy Markdown
Contributor

But I had no feedback on my last comment.

Look, you stopped getting answers and reviews because this wasn't really going anywhere, despite multiple reviewers (whose time is scarce!) helping you out repeatedly. I finally closed it to not leave it hanging forever.

Please refrain from insulting others, you are breaking the Code of Conduct with that kind of language. If multiple maintainers tell you that another PR is sufficient, please just accept that - that happens in open source (and in any kind of context where feedback is given really).

@LLyaudet

Copy link
Copy Markdown
Contributor Author

I stopped getting answers and reviews because they didn't disclose the reason why they didn't want my code but they decided to discriminate me anyway. When people have valid reason to reject something they can spell it out. Otherwise they're just playing spy games, and pissing me off. Please don't hide yourself or themselves behind Code of Conduct ; obviously you don't have any conduct anyway. Disrespect line is crossed way sooner than insults come in. You disrespected me first.

@merwok

merwok commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

No need for conspiracy theories. Your interaction style was too difficult to engage with, you dismissed people trying to help you understand the conventions here, so people stopped spending their free time talking to a wall. There was no disrespect until you starting writing insults.

@LLyaudet

Copy link
Copy Markdown
Contributor Author

Of course you know better and you give no factual points to validate all your defamatory accusations.

No need for conspiracy theories.

In my life there was a lot of mobbing and spies to bury my life, so don't talk without knowing for sure.
Because your pseudo-rational talk help the system not the big mouth citizen.

Your interaction style was too difficult to engage with

From which point onward?
Was it too difficult for people with good will or for people with bad will?
I see nothing that was too harsh and justifying to bury my PR after my message of 2023/12/11.
Quote something before that proving that the discussion was so tense that some pants were wet.

you dismissed people trying to help you understand the conventions here, so people stopped spending their free time talking to a wall.

I frankly don't read that before 2023/12/11.

There was no disrespect until you starting writing insults.

Thank you Bisounours/Care Bears.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: discussions diataxis: explanation Understanding oriented discussion (https://diataxis.fr/explanation/) diataxis: tutorial Learning oriented lesson (https://diataxis.fr/tutorials/) type: enhancement A self-contained enhancement or new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants