GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-36960: Make datetime docs more user-friendly by bsolomon1124 · Pull Request #13410 · python/cpython

Conversation

@bsolomon1124

@bsolomon1124 bsolomon1124 commented May 18, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

https://bugs.python.org/issue36960


Appreciate any core reviewer who can take the time to sit down to read through the updated version. While the diff is fairly large in terms of number of commits and lines changed, there are no drastic changes made here and I've made an effort to keep the commits modular and self-documenting.

Last rebased off master as of 2019-06-22.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

alessandrocucci and pganssle reacted with thumbs up emoji GPHemsley reacted with heart emoji
All reactions
  • 👍 2 reactions
  • ❤️ 1 reaction
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label May 18, 2019
@bedevere-bot bedevere-bot added docs Documentation in the Doc dir awaiting review labels May 18, 2019
@bsolomon1124 bsolomon1124 changed the title Make datetime docs more user-friendly bpo-36960: Make datetime docs more user-friendly May 18, 2019
@csabella
csabella requested a review from abalkin May 18, 2019 20:23
alessandrocucci
alessandrocucci reviewed May 18, 2019
View reviewed changes

@alessandrocucci alessandrocucci left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I found some double spaces here and there, but this are small things.
I really like your PR, hope it will be merged!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@pganssle

pganssle commented May 21, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

I can read this more thoroughly a bit later, but I almost wonder if, considering it's a re-organization, if it would be good to get one or more reviews from someone who is not a domain expert in the datetime module. I imagine that e.g. @abalkin and I are not typical users of the datetime module.

Maybe @willingc or someone else with expertise in education?

csabella reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@willingc
willingc self-requested a review May 21, 2019 11:40
Carreau
Carreau reviewed May 29, 2019
View reviewed changes
Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Carreau
Carreau reviewed May 29, 2019
View reviewed changes
Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Carreau
Carreau reviewed May 29, 2019
View reviewed changes
Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Carreau
Carreau reviewed May 29, 2019
View reviewed changes
Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Carreau
Carreau reviewed May 29, 2019
View reviewed changes
Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Carreau
Carreau reviewed May 29, 2019
View reviewed changes
Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Carreau
Carreau approved these changes May 29, 2019
View reviewed changes

@Carreau Carreau left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Major improvement in readability for me.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot added awaiting core review and removed awaiting review labels May 29, 2019
@Carreau

Carreau commented May 29, 2019

Copy link
Copy Markdown
Contributor

I can read this more thoroughly a bit later, but I almost wonder if, considering it's a re-organization, if it would be good to get one or more reviews from someone who is not a domain expert in the datetime module. I imagine that e.g. @abalkin and I are not typical users of the datetime module.

I don't think this is such a re-organisation, a couple of small paragraph have been placed in better suited location, but rarely too far from their original place. I think the impression is mostly due to git that can't really re-match some of the text with the original one.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bsolomon1124

bsolomon1124 commented May 29, 2019

Copy link
Copy Markdown
Contributor Author

Many thanks for looking over this @Carreau - will make updates based on your suggestions soon.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bsolomon1124
bsolomon1124 requested a review from pganssle as a code owner June 22, 2019 17:22
willingc
willingc reviewed Jun 23, 2019
View reviewed changes

@willingc willingc left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks for PR @bsolomon1124. It's a nice improvement. I've made a few suggestions to the changes. As an FYI for future large doc PRs, it makes the reviewer's task a bit easier when whitespace (one or two spaces after a period) is left as is. It's a bit quicker to skim through the content changes ☀️

Thanks also to the reviewers who have made comments too.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bsolomon1124

bsolomon1124 commented Jun 23, 2019

Copy link
Copy Markdown
Contributor Author

Thank you @willingc , I've incorporated all of your suggestions and will keep the whitespace tip in mind in future PRs.

willingc reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@willingc

willingc commented Jun 23, 2019

Copy link
Copy Markdown
Contributor

Thanks @bsolomon1124 😄

@pganssle This looks good to me. If you want to give it a technical review as a datetime expert, that would be great.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

willingc
willingc approved these changes Jun 23, 2019
View reviewed changes
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Jun 23, 2019
@pganssle

pganssle commented Jun 24, 2019

Copy link
Copy Markdown
Member

Thanks for the review @willingc. I've started looking at this but it's quite long. So far it's looking good (any problems with the documentation I've seen predate this PR), though that's to be expected given that it's mostly a restructuring / refactoring.

willingc reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pganssle
pganssle requested changes Jul 2, 2019
View reviewed changes

@pganssle pganssle left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I am still working through this PR (it's very large), but I have some comments on the portions up to the .. _datetime-time reference.

Overall, this looks very good, I like it a lot. These comments range from minor issues and nitpicks to just general comments that may not require any action. Once or twice I have asked for some actual improvements to the docs because I think they might be easy to do as part of this PR, but feel free to call those out of scope and I'll create a new BPO issue for them (like, for example, bpo-37488, which originally was a comment here but I pre-emptively "out of scoped" it).

Thank you for doing this. I will try to review the rest of the PR ASAP.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot added awaiting changes and removed awaiting merge labels Jul 2, 2019
@bedevere-bot

bedevere-bot commented Jul 2, 2019

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bsolomon1124

bsolomon1124 commented Jul 6, 2019

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again

willingc reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot added awaiting change review and removed awaiting changes labels Jul 6, 2019
@bedevere-bot

bedevere-bot commented Jul 6, 2019

Copy link
Copy Markdown

Thanks for making the requested changes!

@pganssle, @willingc: please review the changes made to this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bsolomon1124

bsolomon1124 commented Jul 29, 2019

Copy link
Copy Markdown
Contributor Author

Hey @pganssle, I know you've got plenty going on, but would love to have your eye on the remainder of this one. I think we are about 2/3 of the way through. Sorry to pester if you already had this on your radar.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pganssle

pganssle commented Aug 5, 2019

Copy link
Copy Markdown
Member

@bsolomon1124 Sorry, I will try to get to this as soon as I can. It was definitely on my radar as I'm very excited to get this merged, but Just reading a PR this large is very time-consuming, and I've got a pretty big backlog of things to review. Thanks for your patience.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pganssle
pganssle approved these changes Sep 10, 2019
View reviewed changes

@pganssle pganssle left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@bsolomon1124 Very nice work here, I have finished the review and I rebased your branch against master, cleaned up some of the merge conflicts and then pushed some new commits of my own.

  1. I was able to use NORMALIZE_WHITESPACE to fix the linebreak issue: 85531ebd9f7c2ea8a3ba57a0fdd02a6616343d17
  2. I did some minor rewording (I think this is just additional fixes, not anything related to your changes): 8ea5b4f70520b8ee26471de338f1e6ce58c9a907
  3. I noticed that the paragraph about which formatting codes are supported was duplicated in two places, but neither of them seemed as good as putting it under the "Formatting codes" section, so I moved it there: 1c2803fca0914e24cea538fb60f7f7cae14a5c8c

Please let me know if you have any problems with my changes.

Note that because I did a rebase against the current master, you will need to do a force pull (or do a hard reset to the current head) before making additional changes. I think changes in the github interface will work fine, though.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Misc/NEWS.d/next/Documentation/2019-05-18-16-25-44.bpo-36960.xEKHXj.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot added awaiting merge and removed awaiting change review labels Sep 10, 2019
@bsolomon1124

bsolomon1124 commented Sep 10, 2019

Copy link
Copy Markdown
Contributor Author

Looks awesome, thanks for rebasing and adding in your own changes @pganssle . I force pulled this branch from origin, made the html and did one more read-through, and I don't have any further edits at this point, good to go from my end.

Seriously appreciate your persistence here and have learned my lesson about making PRs more tightly-scoped in the future.

willingc reacted with laugh emoji
All reactions
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bsolomon1124 @pganssle
Overhaul datetime documentation
aad82c7
This is a restructuring of the datetime documentation to hopefully make
them more user-friendly and approachable to new users without losing any
of the detail.

Changes include:
 - Creating dedicated subsections for some concepts such as:
    - "Constants"
    - "Naive vs Aware"
    - "Determining if an Object is Aware"
 - Give 'naive vs aware' its own subsection
 - Give 'constants' their own subsection
 - Overhauling the strftime-strptime section by:
    - Breaking it into logical, linkable, and digestable parts
    - Adding a high-level comparison table
    - Moving the technical detail to bottom: readers come to this
      section primarily to remind themselves to things:
      - How do I write the format code for X?
      - strptime/strftime: which one is which again?
 - Touching up fromisoformat + isoformat sections by:
    - Revising fromisoformat + isoformat for date, time, and
      datetime
    - Adding basic examples
    - Enforcing consistency about putting formats (i.e. ``HH:MM``)
      in double backticks.  This was previously done in some places
      but not all
    - Putting long 'supported formats', on their own line to improve
      readability
 - Moving the 'seealso' section to the top and add a link to dateutil
    Rationale: This doesn't really belong nested under the
    'constants' section.  Let readers know right away that
    datetime is one of several related tools.
 - Moving common features of several types into one place:
    Previously, each type went out of its way to note separately
    that it was hashable and picklable.  These can be brought
    into one single place that is more prominent.
 - Reducing some verbose explanations to improve readability
 - Breaking up long paragraphs into digestable chunks
 - Displaying longer "equivalent to" examples, as short code blocks
 - Using the dot notation for datetime/time classes:
    Use :class:`.time` and :class:`.datetime` rather than :class:`time` and
    :class:`datetime`; otherwise, the generated links will route to the
    respective modules, not classes.
 - Rewording the tzinfo class description
    The top paragraph should get straight to the point of telling the reader
    what subclasses of tzinfo _do_.  Previously, that was hidden in a later
    paragraph.
 - Adding a note on .today() versus .now()
 - Rearranging and expanding example blocks, including:
    - Moved long, multiline inline examples to standalone examples
    - Simplified the example block for timedelta arithmetic:
        - Broke the example into two logical sections:
          1. normalization/parameter 'merging'
          2. timedelta arithmetic
        - Reduced the complexity of the some of the examples.  Show
          reasonable, real-world uses cases that are easy to follow
          along with and progres in difficult slightly.
    - Broke up the example sections for date and datetime sections by putting
      the easy examples first, progressing to more esoteric situations and
      breaking it up into logical sections based on what the methods are
      doing at a high level.
    - Simplified the KabulTz example:
        - Put the class definition itself into a non-REPL block since there is
          no interactive output involved there
        - Briefly explained what's happening before launching into the code
        - Broke the example section into visually separate chunks
 - Various whitespace, formatting, style and grammar fixes including:
    - Consistently using backctics for 'date_string' formats
    - Consistently using one space after periods.
    - Consistently using bold for vocab terms
    - Consistently using italics when referring to params:
      See https://devguide.python.org/documenting/#id4
    - Using '::' to lead into code blocks
        Per https://devguide.python.org/documenting/#source-code, this will
        let the reader use the 'expand/collapse' top-right button for REPL
        blocks to hide or show the prompt.
    - Using consistent captialization schemes
    - Removing use of the default role
    - Put 'example' blocks in Markdown subsections

This is a combination of 66 commits.

See bpo-36960: https://bugs.python.org/issue36960
@pganssle
pganssle removed the request for review from abalkin September 11, 2019 09:16
@pganssle
pganssle merged commit 3fb1363 into python:master Sep 11, 2019
@bedevere-bot bedevere-bot removed the awaiting merge label Sep 11, 2019
@pganssle

pganssle commented Sep 11, 2019

Copy link
Copy Markdown
Member

Got this all squashed down and hopefully captured your excellently worded atomic commit messages in the combined commit message. This was one of those situations where I was pretty sad that we can only do squash merges for CPython, because it wouldn't have been too much work to do an interactive rebase and make this about 45 individual atomic commits.

🎉 Beautiful work, @bsolomon1124! 🎉

By the way, with regards to this:

Seriously appreciate your persistence here and have learned my lesson about making PRs more tightly-scoped in the future.

Please do not let the long delay in review prevent you from making ambitious changes in the future if they are warranted. This PR could have probably been broken up into a number of smaller PRs that would have been easier to merge, but this didn't have nearly the scope creep that some PRs get. Thank you for taking the time to do such a great job on this, I hope it will make things much easier for new users of datetime.

bsolomon1124 reacted with laugh emoji
All reactions
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pganssle pganssle mentioned this pull request Sep 11, 2019
bpo-37488 : Document a warning for datetime.utcnow() and utcfromtimestamp() #15773
Merged
@bsolomon1124
bsolomon1124 deleted the datetime-user-friendly-docs branch September 11, 2019 11:12
@pganssle pganssle added the needs backport to 3.8 label Sep 12, 2019
@miss-islington

miss-islington commented Sep 12, 2019

Copy link
Copy Markdown
Contributor

Thanks @bsolomon1124 for the PR, and @pganssle for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 12, 2019
@bsolomon1124 @miss-islington
Overhaul datetime documentation (pythonGH-13410)
6998a70
This is a restructuring of the datetime documentation to hopefully make
them more user-friendly and approachable to new users without losing any
of the detail.

Changes include:
 - Creating dedicated subsections for some concepts such as:
    - "Constants"
    - "Naive vs Aware"
    - "Determining if an Object is Aware"
 - Give 'naive vs aware' its own subsection
 - Give 'constants' their own subsection
 - Overhauling the strftime-strptime section by:
    - Breaking it into logical, linkable, and digestable parts
    - Adding a high-level comparison table
    - Moving the technical detail to bottom: readers come to this
      section primarily to remind themselves to things:
      - How do I write the format code for X?
      - strptime/strftime: which one is which again?
 - Touching up fromisoformat + isoformat sections by:
    - Revising fromisoformat + isoformat for date, time, and
      datetime
    - Adding basic examples
    - Enforcing consistency about putting formats (i.e. ``HH:MM``)
      in double backticks.  This was previously done in some places
      but not all
    - Putting long 'supported formats', on their own line to improve
      readability
 - Moving the 'seealso' section to the top and add a link to dateutil
    Rationale: This doesn't really belong nested under the
    'constants' section.  Let readers know right away that
    datetime is one of several related tools.
 - Moving common features of several types into one place:
    Previously, each type went out of its way to note separately
    that it was hashable and picklable.  These can be brought
    into one single place that is more prominent.
 - Reducing some verbose explanations to improve readability
 - Breaking up long paragraphs into digestable chunks
 - Displaying longer "equivalent to" examples, as short code blocks
 - Using the dot notation for datetime/time classes:
    Use :class:`.time` and :class:`.datetime` rather than :class:`time` and
    :class:`datetime`; otherwise, the generated links will route to the
    respective modules, not classes.
 - Rewording the tzinfo class description
    The top paragraph should get straight to the point of telling the reader
    what subclasses of tzinfo _do_.  Previously, that was hidden in a later
    paragraph.
 - Adding a note on .today() versus .now()
 - Rearranging and expanding example blocks, including:
    - Moved long, multiline inline examples to standalone examples
    - Simplified the example block for timedelta arithmetic:
        - Broke the example into two logical sections:
          1. normalization/parameter 'merging'
          2. timedelta arithmetic
        - Reduced the complexity of the some of the examples.  Show
          reasonable, real-world uses cases that are easy to follow
          along with and progres in difficult slightly.
    - Broke up the example sections for date and datetime sections by putting
      the easy examples first, progressing to more esoteric situations and
      breaking it up into logical sections based on what the methods are
      doing at a high level.
    - Simplified the KabulTz example:
        - Put the class definition itself into a non-REPL block since there is
          no interactive output involved there
        - Briefly explained what's happening before launching into the code
        - Broke the example section into visually separate chunks
 - Various whitespace, formatting, style and grammar fixes including:
    - Consistently using backctics for 'date_string' formats
    - Consistently using one space after periods.
    - Consistently using bold for vocab terms
    - Consistently using italics when referring to params:
      See https://devguide.python.org/documenting/GH-id4
    - Using '::' to lead into code blocks
        Per https://devguide.python.org/documenting/GH-source-code, this will
        let the reader use the 'expand/collapse' top-right button for REPL
        blocks to hide or show the prompt.
    - Using consistent captialization schemes
    - Removing use of the default role
    - Put 'example' blocks in Markdown subsections

This is a combination of 66 commits.

See bpo-36960: https://bugs.python.org/issue36960
(cherry picked from commit 3fb1363)

Co-authored-by: Brad <[email protected]>
@bedevere-bot

bedevere-bot commented Sep 12, 2019

Copy link
Copy Markdown

GH-16056 is a backport of this pull request to the 3.8 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the needs backport to 3.8 label Sep 12, 2019
@pganssle

pganssle commented Sep 12, 2019

Copy link
Copy Markdown
Member

I'm going to go ahead and backport this to 3.8, partially because it would be nice to get the changes in for the upcoming version and partially because it will make backporting all documentation fixes a total pain if it doesn't get backported 😛

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

miss-islington added a commit that referenced this pull request Sep 12, 2019
@miss-islington @bsolomon1124
Overhaul datetime documentation (GH-13410)
8976359
This is a restructuring of the datetime documentation to hopefully make
them more user-friendly and approachable to new users without losing any
of the detail.

Changes include:
 - Creating dedicated subsections for some concepts such as:
    - "Constants"
    - "Naive vs Aware"
    - "Determining if an Object is Aware"
 - Give 'naive vs aware' its own subsection
 - Give 'constants' their own subsection
 - Overhauling the strftime-strptime section by:
    - Breaking it into logical, linkable, and digestable parts
    - Adding a high-level comparison table
    - Moving the technical detail to bottom: readers come to this
      section primarily to remind themselves to things:
      - How do I write the format code for X?
      - strptime/strftime: which one is which again?
 - Touching up fromisoformat + isoformat sections by:
    - Revising fromisoformat + isoformat for date, time, and
      datetime
    - Adding basic examples
    - Enforcing consistency about putting formats (i.e. ``HH:MM``)
      in double backticks.  This was previously done in some places
      but not all
    - Putting long 'supported formats', on their own line to improve
      readability
 - Moving the 'seealso' section to the top and add a link to dateutil
    Rationale: This doesn't really belong nested under the
    'constants' section.  Let readers know right away that
    datetime is one of several related tools.
 - Moving common features of several types into one place:
    Previously, each type went out of its way to note separately
    that it was hashable and picklable.  These can be brought
    into one single place that is more prominent.
 - Reducing some verbose explanations to improve readability
 - Breaking up long paragraphs into digestable chunks
 - Displaying longer "equivalent to" examples, as short code blocks
 - Using the dot notation for datetime/time classes:
    Use :class:`.time` and :class:`.datetime` rather than :class:`time` and
    :class:`datetime`; otherwise, the generated links will route to the
    respective modules, not classes.
 - Rewording the tzinfo class description
    The top paragraph should get straight to the point of telling the reader
    what subclasses of tzinfo _do_.  Previously, that was hidden in a later
    paragraph.
 - Adding a note on .today() versus .now()
 - Rearranging and expanding example blocks, including:
    - Moved long, multiline inline examples to standalone examples
    - Simplified the example block for timedelta arithmetic:
        - Broke the example into two logical sections:
          1. normalization/parameter 'merging'
          2. timedelta arithmetic
        - Reduced the complexity of the some of the examples.  Show
          reasonable, real-world uses cases that are easy to follow
          along with and progres in difficult slightly.
    - Broke up the example sections for date and datetime sections by putting
      the easy examples first, progressing to more esoteric situations and
      breaking it up into logical sections based on what the methods are
      doing at a high level.
    - Simplified the KabulTz example:
        - Put the class definition itself into a non-REPL block since there is
          no interactive output involved there
        - Briefly explained what's happening before launching into the code
        - Broke the example section into visually separate chunks
 - Various whitespace, formatting, style and grammar fixes including:
    - Consistently using backctics for 'date_string' formats
    - Consistently using one space after periods.
    - Consistently using bold for vocab terms
    - Consistently using italics when referring to params:
      See https://devguide.python.org/documenting/GH-id4
    - Using '::' to lead into code blocks
        Per https://devguide.python.org/documenting/GH-source-code, this will
        let the reader use the 'expand/collapse' top-right button for REPL
        blocks to hide or show the prompt.
    - Using consistent captialization schemes
    - Removing use of the default role
    - Put 'example' blocks in Markdown subsections

This is a combination of 66 commits.

See bpo-36960: https://bugs.python.org/issue36960
(cherry picked from commit 3fb1363)

Co-authored-by: Brad <[email protected]>
websurfer5 pushed a commit to websurfer5/cpython that referenced this pull request Jul 20, 2020
@bsolomon1124 @websurfer5
Overhaul datetime documentation (pythonGH-13410)
369d623
This is a restructuring of the datetime documentation to hopefully make
them more user-friendly and approachable to new users without losing any
of the detail.

Changes include:
 - Creating dedicated subsections for some concepts such as:
    - "Constants"
    - "Naive vs Aware"
    - "Determining if an Object is Aware"
 - Give 'naive vs aware' its own subsection
 - Give 'constants' their own subsection
 - Overhauling the strftime-strptime section by:
    - Breaking it into logical, linkable, and digestable parts
    - Adding a high-level comparison table
    - Moving the technical detail to bottom: readers come to this
      section primarily to remind themselves to things:
      - How do I write the format code for X?
      - strptime/strftime: which one is which again?
 - Touching up fromisoformat + isoformat sections by:
    - Revising fromisoformat + isoformat for date, time, and
      datetime
    - Adding basic examples
    - Enforcing consistency about putting formats (i.e. ``HH:MM``)
      in double backticks.  This was previously done in some places
      but not all
    - Putting long 'supported formats', on their own line to improve
      readability
 - Moving the 'seealso' section to the top and add a link to dateutil
    Rationale: This doesn't really belong nested under the
    'constants' section.  Let readers know right away that
    datetime is one of several related tools.
 - Moving common features of several types into one place:
    Previously, each type went out of its way to note separately
    that it was hashable and picklable.  These can be brought
    into one single place that is more prominent.
 - Reducing some verbose explanations to improve readability
 - Breaking up long paragraphs into digestable chunks
 - Displaying longer "equivalent to" examples, as short code blocks
 - Using the dot notation for datetime/time classes:
    Use :class:`.time` and :class:`.datetime` rather than :class:`time` and
    :class:`datetime`; otherwise, the generated links will route to the
    respective modules, not classes.
 - Rewording the tzinfo class description
    The top paragraph should get straight to the point of telling the reader
    what subclasses of tzinfo _do_.  Previously, that was hidden in a later
    paragraph.
 - Adding a note on .today() versus .now()
 - Rearranging and expanding example blocks, including:
    - Moved long, multiline inline examples to standalone examples
    - Simplified the example block for timedelta arithmetic:
        - Broke the example into two logical sections:
          1. normalization/parameter 'merging'
          2. timedelta arithmetic
        - Reduced the complexity of the some of the examples.  Show
          reasonable, real-world uses cases that are easy to follow
          along with and progres in difficult slightly.
    - Broke up the example sections for date and datetime sections by putting
      the easy examples first, progressing to more esoteric situations and
      breaking it up into logical sections based on what the methods are
      doing at a high level.
    - Simplified the KabulTz example:
        - Put the class definition itself into a non-REPL block since there is
          no interactive output involved there
        - Briefly explained what's happening before launching into the code
        - Broke the example section into visually separate chunks
 - Various whitespace, formatting, style and grammar fixes including:
    - Consistently using backctics for 'date_string' formats
    - Consistently using one space after periods.
    - Consistently using bold for vocab terms
    - Consistently using italics when referring to params:
      See https://devguide.python.org/documenting/#id4
    - Using '::' to lead into code blocks
        Per https://devguide.python.org/documenting/#source-code, this will
        let the reader use the 'expand/collapse' top-right button for REPL
        blocks to hide or show the prompt.
    - Using consistent captialization schemes
    - Removing use of the default role
    - Put 'example' blocks in Markdown subsections

This is a combination of 66 commits.

See bpo-36960: https://bugs.python.org/issue36960
@encukou encukou mentioned this pull request Mar 14, 2025
Missing valid directive %D in datetime.strftime() documentation #88950
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pganssle pganssle pganssle approved these changes
@willingc willingc willingc approved these changes
+2 more reviewers
@alessandrocucci alessandrocucci alessandrocucci left review comments
@Carreau Carreau Carreau approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

docs Documentation in the Doc dir

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

8 participants

@bsolomon1124 @pganssle @Carreau @willingc @bedevere-bot @miss-islington @alessandrocucci @the-knights-who-say-ni
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.