Move the "quick reference" to a dedicated page#1838
Conversation
A new page at `Getting Started > Quick Reference` is added to contain the (moved) content which was in the Quick Reference section of the index document for the site. The content is left almost entirely untouched, but the introductory text is slightly altered to de-emphasize use of the doc for new contributors. Intentionally, as described in python#1837, the page is placed in Getting Started but after the setup guide.
Documentation build overview
7 files changed ·
|
| Here are the basic steps needed to get set up and open a pull request. | ||
|
|
||
| This is meant as a checklist and cheat-sheet, not a comprehensive guide. | ||
| For complete instructions please see the :ref:`setup guide <setup>`. |
There was a problem hiding this comment.
I don't think this makes sense now, we redirect people back to the page they've just read?
There was a problem hiding this comment.
This doesn't go back to the home page. It goes to a detailed page about git etc.
There was a problem hiding this comment.
I was not referring to the home page. As @sirosen noted in the PR description:
the page is placed in Getting Started but after the setup guide.
We're sending them back to the page just before.
There was a problem hiding this comment.
I see, sorry. So we should move this up in the contents.
There was a problem hiding this comment.
I think we can rename it to "Overview," and make it an index for the overall quite long "Getting started" section. Additionally, we could merge it with the other Quick Guide, and add a link to the Where to get help at the end. Some of the steps could also use additional links to the more detailed sections.
There was a problem hiding this comment.
I would love to see this page be minimalist visually and cheatsheet-like. I think @StanFromIreland is on the right track though "Overview" feels too broad.
There was a problem hiding this comment.
Additionally, we could merge it with the other Quick Guide, and add a link to the Where to get help at the end.
Oh no! I didn't realize that there was another, other-other quick reference. 😂
My initial reaction is that I think these should be combined, still in the form of a new page.
I need to do some careful cross-comparison of the content and see if such a change is feasible in practice, without this PR growing too large in scope.
|
|
||
| PCbuild\build.bat -e -d | ||
|
|
||
| See also :ref:`more detailed instructions <compiling>`, |
There was a problem hiding this comment.
All of the above steps should have been completed by the time they reach this page, so we don't quite need them.
There was a problem hiding this comment.
I think all the "see also" items could go later in this document. Perhaps in a "Dive deeper" section.
|
|
||
| .\python.bat -m test -j3 | ||
|
|
||
| 5. Create a new branch where your work for the issue will go, for example:: |
There was a problem hiding this comment.
This section is duplicated by our other "Quick guide".
There was a problem hiding this comment.
Steps 5-7 could be their own section or their own page. Keep 1-4 as build from source and run tests.
| .. _quick-reference: | ||
|
|
||
| =============== | ||
| Quick Reference |
There was a problem hiding this comment.
Use sentence case for headers:
https://devguide.python.org/documentation/style-guide/#capitalization
| Quick Reference | |
| Quick reference |
There was a problem hiding this comment.
May make sense to be more specific on the title of this doc. Quick reference feels too broad. Something that evokes the original purpose checklist/cheatsheet would make more sense.
There was a problem hiding this comment.
We could put it at or near the end of Getting Started, under the name "Workflow cheatsheet".
It would read logically that way, and that name is harmonious with the element of this doc that I'm trying to preserve.
| .. _quick-reference: | ||
|
|
||
| =============== | ||
| Quick Reference |
There was a problem hiding this comment.
May make sense to be more specific on the title of this doc. Quick reference feels too broad. Something that evokes the original purpose checklist/cheatsheet would make more sense.
| Here are the basic steps needed to get set up and open a pull request. | ||
|
|
||
| This is meant as a checklist and cheat-sheet, not a comprehensive guide. | ||
| For complete instructions please see the :ref:`setup guide <setup>`. |
There was a problem hiding this comment.
I would love to see this page be minimalist visually and cheatsheet-like. I think @StanFromIreland is on the right track though "Overview" feels too broad.
|
|
||
| PCbuild\build.bat -e -d | ||
|
|
||
| See also :ref:`more detailed instructions <compiling>`, |
There was a problem hiding this comment.
I think all the "see also" items could go later in this document. Perhaps in a "Dive deeper" section.
|
|
||
| .\python.bat -m test -j3 | ||
|
|
||
| 5. Create a new branch where your work for the issue will go, for example:: |
There was a problem hiding this comment.
Steps 5-7 could be their own section or their own page. Keep 1-4 as build from source and run tests.
| Quick reference | ||
| --------------- | ||
|
|
||
| Here are the basic steps needed to get set up and open a pull request. |
There was a problem hiding this comment.
When moving these items to a new page, let's keep the Quick reference title and have an admonition of where the content has moved and why (for approx. 6 months).
There was a problem hiding this comment.
We can add a little deferred Javascript redirect for the anchor, e.g.:
function redirectAnchor() {
const anchor = window.location.hash.slice(1);
if (!anchor || document.getElementById(anchor)) {
return;
}
if (anchor !== "anchor") {
return;
}
window.location.replace(new URL("redirect", window.location.href).href);
}
redirectAnchor();There was a problem hiding this comment.
I like the idea, but have two reasons I don't want to pursue it at the moment.
-
Reusability. We probably don't want to do a bespoke bit of JS each time we do a redirect.
I'd like us to pack this idea up to be reusable. I think the redirector you recently proposed for CPython docs was similar -- but I did see that not everyone agreed on that.
-
Scope creep. This will already end up being a larger PR than I intended.
When I circle back on this, I'll be moving more pieces around and actually changing some content to address feedback. I worry that adding in new code for the site may make this harder to merge, so I'd like to stick strictly to content edits.
(I can definitely take feedback if there's broad agreement that everyone really wants us to add redirectAnchor() right here! But I'm hesitant to embrace the idea without more signal.)
There was a problem hiding this comment.
OK, let's do this. Let's remove and if folks get confused, we can always add this later. Thanks @sirosen.
There was a problem hiding this comment.
FWIW, I did include a "breadcrumb" per your other suggestion. It's now way at the bottom of this diff, but it's short-and-sweet:
.. note::
The quick reference documentation has been moved to serve as a cheat-sheet and overview
in :ref:`Getting started <getting-started>`.
Go to :ref:`the new quick reference <quick-reference>`.
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
The idea of making this section not be first is somewhat at odds with the fact that it needs to link to the first page under Getting Started. It would work to move it to the end, or to the beginning. The beginning seems to be the "least surprise" choice for doc readers and contributors.
Rather than trying to flatten the quick reference into a list (which is too compact!), reflow the doc with each list entry as a section or subsection. The steps are kept very similar to their prior content, but each now ends with a link to more detailed documentation, presented in a slightly more formulaic manner. Links out to GitHub are called out especially to ensure it's clear that they are not parts of the devguide.
Instead of a duplicate guide, we can now link to the canonical quick reference doc.
In the index, ensure that anyone going to the old quick-reference documentation will find a short explanatory note and a link to the new, rehomed quick-reference.
|
I've just pushed a few changes that attempt to address all of the outstanding review comments.
|
| git clone https://github.com/<your_username>/cpython | ||
| cd cpython | ||
|
|
||
| We recommend also setting up ``pre-commit``:: |
There was a problem hiding this comment.
@encukou, are you happy to do this now that we've hash-pinned all the third party hooks?
There was a problem hiding this comment.
What's the policy on updating those hash-pins?
(FWIW, you don't need to make me happy. Just Seth ;)
There was a problem hiding this comment.
None yet.
I'd like to automate with either:
-
https://pre-commit.ci to auto-update them weekly, monthly or quarterly (my pick is quarterly). This can also autofix formatting in PRs, often a tedious thing to ask contributors to do (we can also configure to disable that, my preference is to leave enabled).
-
Dependabot: we're already using this for bumping GitHub Actions and pip dependencies. Interval can be daily, weekly, monthly, quarterly, semiannually, yearly, or a custom cron. It won't autofix PRs. We can also configure cooldowns.
And we can manually update when we need a new feature or bugfix.
There was a problem hiding this comment.
I take it that there was some discussion about ensuring these are pinned for safety. 😁
I use pre-commit.ci for this in most of my projects, and the autofixing is quite nice.
If the autofixing isn't desirable, I'd tend towards Dependabot, since the infrastructure is provided by GitHub. (I think this is nicer in having fewer providers and putting less load on a smaller platform.)
There was a problem hiding this comment.
@encukou, are you happy to do this now
No, this doesn't spark joy here. It don't want to recommend this setup. But I won't block it, if it's not mandatory.
From pre-commit.ci problem statement:
Developers spend a fair chunk of time during their development flow on fixing relatively trivial problems in their code.
I see this differently. Developers spend a fair chunk of time looking at code while their fingers are engaged.
Auto-fixing style issues often gives code the superficial appearance of quality -- it looks like someone spent time polishing it, but without the deeper benefits.
If we want to avoid the tedium, let us simply tolerate the occasional lack of trailing comma or over-long line.
That said, I agree that there are automatic checks that are useful -- unused import, ReST single-backquotes, or security scans, but they seem to be in the minority -- and I don't think they're worth installing locally before you first build CPython.
|
|
||
| .. code-block:: shell | ||
|
|
||
| ./configure --config-cache --with-pydebug && make -j8 |
There was a problem hiding this comment.
Why are we limiting to 8?
There was a problem hiding this comment.
Some number is better than none, easy to adjust once you know a number goes there, and arbitrary selection based on market hardware: #1545
There was a problem hiding this comment.
If $(nproc) can fail then why not leave it up to make and pass -j (I'm not sure if that works over on macOS, I presume it would be the same as on Linux), it should use all available then.
There was a problem hiding this comment.
It depends on the make command. With GNU make:
-j [jobs], --jobs[=jobs]
Specifies the number of jobs (commands) to run simultaneously. If there is
more than one -j option, the last one is effective. If the -j option is
given without an argument, make will not limit the number of jobs that can
run simultaneously.
"Don't limit" isn't the same as "use all available".
There was a problem hiding this comment.
I see that Hugo 👍'ed the comment below about switching to -j0 for the test command.
I'm unclear, should I apply a change here as well?
I'm not familiar with the semantics of -j0 (I'm guessing that it means unlimited job slots?); I've always either used no argument or used a positive integer.
I have no strong opinion about this detail. -j 8 reads very reasonably to me. -j 0 feels a little more obscure, but I don't hate it.
There was a problem hiding this comment.
Unlike python -m test, make does not understand -j0.
The Mac/BSD equivalent for make -j$(nproc) is make -j $(sysctl -n hw.logicalcpu). Not something you'd want to type in, but perhaps people copy/paste from here?
There was a problem hiding this comment.
Let's use @encukou's suggestion make -j $(sysctl -n hw.logicalcpu) or make -j 8. My M2 on Tahoe returns 8. I slightly prefer Petr's suggestion since it will use the resources available on the user's system.
There was a problem hiding this comment.
| ./configure --config-cache --with-pydebug && make -j8 | |
| ./configure --config-cache --with-pydebug && make -j$(sysctl -n hw.logicalcpu) |
I don't have a Mac or Mac-knowledge to test, but I think using all available is better then picking numbers we'll have to update in the future.
| `repository <https://github.com/python/blurb>`__. | ||
|
|
||
| For more information on writing news entries, | ||
| see :ref:`"Updating NEWS and What's New in Python" <news-entry>`. |
There was a problem hiding this comment.
This should be higher, we don't want unnecessary news entries (it explains when you should(n't) add one).
There was a problem hiding this comment.
Perhaps move this to line 124. Then, start a new paragraph for blurb-it.
There was a problem hiding this comment.
I'd like to keep a link to the detailed reference at the end of this subsection if we can manage it. Keeping the ordering of the content consistent section to section makes the doc more navigable.
(If we can't maintain this ordering, that's okay, but I want to try.)
I can definitely edit the perhaps-too-pithy "many changes deserve a NEWS entry" up above.
Here's what's written in the linked doc:
Most changes made to the codebase deserve an entry in Misc/NEWS.d, except for the following:
- documentation changes
- test changes
- strictly internal changes with no user-visible effects
- changes that already have a NEWS entry
- reverts that have not yet been included in any formal release (including alpha and beta releases)
If I reproduce this whole list, the quick-reference begins to wander into being a not-so-quick-reference.
Would this update be satisfactory?
-Many changes deserve a NEWS entry which documents what changed.
+Most user-visible changes, other than documentation changes,
+deserve a NEWS entry which documents what changed.There was a problem hiding this comment.
Concurrent comments!
I'm considering that Carol's suggestion maybe works for what I want, in that we maintain "Short Version, Deep Link, Short Version, Deep Link, ..." alternating structure.
So the possibility with that approach is something like...
Many changes deserve a NEWS entry which documents what changed.
For more information on how and when to write news entries,
see :ref:"Updating NEWS and What's New in Python" <news-entry>.To add a NEWS entry, add a new file in the
Misc/NEWS.d/directory.
The news entry can be created by using
blurb-it <https://blurb-it.herokuapp.com/>__,
or the :pypi:blurbtool and itsblurb addcommand... tip::
You can read more about
blurbin its
repository <https://github.com/python/blurb>__.For more information about how to create news entries, see
:ref:"How to add a NEWS entry" <crossref-I-need-to-add>.
There was a problem hiding this comment.
I like this suggestion @sirosen. Thoughts @StanFromIreland?
There was a problem hiding this comment.
That seems good, but we can drop the tip (and move it to the other section if it's not already there), "quick references" should ideally be succinct :-)
Additionally, I'd reword the second paragraph a little, like so:
A news entry can be created locally with the :pypi:`blurb` tool
and its ``blurb add`` command or online after a pull request has
been opened with blurb-it <https://blurb-it.herokuapp.com/>__.We've generally discouraged manual creation as it complicates things for new contributors. Users who want to do so can see the instructions in the How to add a news entry section.
|
|
||
| .. code-block:: shell | ||
|
|
||
| ./python.exe -m test -j8 |
There was a problem hiding this comment.
Similarly here, why the difference? We can pass -j0 here.
There was a problem hiding this comment.
Let's be consistent with the number. We could add a note that for most recent macs 8 would be fine.
There was a problem hiding this comment.
| ./python.exe -m test -j8 | |
| ./python.exe -m test -j0 |
|
|
||
| .. code-block:: shell | ||
|
|
||
| ./configure --config-cache --with-pydebug && make -j8 |
There was a problem hiding this comment.
It depends on the make command. With GNU make:
-j [jobs], --jobs[=jobs]
Specifies the number of jobs (commands) to run simultaneously. If there is
more than one -j option, the last one is effective. If the -j option is
given without an argument, make will not limit the number of jobs that can
run simultaneously.
"Don't limit" isn't the same as "use all available".
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
|
|
||
| .. code-block:: shell | ||
|
|
||
| ./python.exe -m test -j8 |
There was a problem hiding this comment.
Let's be consistent with the number. We could add a note that for most recent macs 8 would be fine.
| `repository <https://github.com/python/blurb>`__. | ||
|
|
||
| For more information on writing news entries, | ||
| see :ref:`"Updating NEWS and What's New in Python" <news-entry>`. |
There was a problem hiding this comment.
Perhaps move this to line 124. Then, start a new paragraph for blurb-it.
| Quick reference | ||
| --------------- | ||
|
|
||
| Here are the basic steps needed to get set up and open a pull request. |
There was a problem hiding this comment.
OK, let's do this. Let's remove and if folks get confused, we can always add this later. Thanks @sirosen.
|
|
||
| .. code-block:: shell | ||
|
|
||
| ./python -m test -j3 |
There was a problem hiding this comment.
| ./python -m test -j3 | |
| ./python -m test -j0 |
|
|
||
| .. code-block:: shell | ||
|
|
||
| ./python.exe -m test -j8 |
There was a problem hiding this comment.
| ./python.exe -m test -j8 | |
| ./python.exe -m test -j0 |
|
|
||
| .. code-block:: dosbatch | ||
|
|
||
| .\python.bat -m test -j3 |
There was a problem hiding this comment.
| .\python.bat -m test -j3 | |
| .\python.bat -m test -j0 |
| .. note:: | ||
| :ref:`Most <mac-python.exe>` macOS systems use | ||
| :file:`./python.exe` in order to avoid filename conflicts with | ||
| the ``Python`` directory. |
There was a problem hiding this comment.
| .. note:: | |
| :ref:`Most <mac-python.exe>` macOS systems use | |
| :file:`./python.exe` in order to avoid filename conflicts with | |
| the ``Python`` directory. |
Seeing as this is a quick reference, we can skip such things where it's "on macOS by default."
| `repository <https://github.com/python/blurb>`__. | ||
|
|
||
| For more information on writing news entries, | ||
| see :ref:`"Updating NEWS and What's New in Python" <news-entry>`. |
There was a problem hiding this comment.
That seems good, but we can drop the tip (and move it to the other section if it's not already there), "quick references" should ideally be succinct :-)
Additionally, I'd reword the second paragraph a little, like so:
A news entry can be created locally with the :pypi:`blurb` tool
and its ``blurb add`` command or online after a pull request has
been opened with blurb-it <https://blurb-it.herokuapp.com/>__.We've generally discouraged manual creation as it complicates things for new contributors. Users who want to do so can see the instructions in the How to add a news entry section.
| Make sure the | ||
| :ref:`continuous integration checks on your Pull Request are green <keeping-ci-green>` (successful). |
There was a problem hiding this comment.
| Make sure the | |
| :ref:`continuous integration checks on your Pull Request are green <keeping-ci-green>` (successful). | |
| Make sure the :ref:`continuous integration checks on your Pull | |
| Request are green <keeping-ci-green>` (successful). |
(FYI you can wrap inside a :ref:)
A new page at
Getting Started > Quick Referenceis added to contain the(moved) content which was in the Quick Reference section of the index
document for the site.
The content is left almost entirely untouched, but the introductory text
is slightly altered to de-emphasize use of the doc for new contributors.
Intentionally, as described in #1837, the page is placed in Getting
Started but after the setup guide.
closes #1837