◐ Shell
reader mode source ↗
Skip to content

gh-124370: Add "howto" for free-threaded Python#124371

Merged
nedbat merged 13 commits into
python:mainfrom
colesbury:gh-124370-python-free-threaded-howto
Sep 25, 2024
Merged

gh-124370: Add "howto" for free-threaded Python#124371
nedbat merged 13 commits into
python:mainfrom
colesbury:gh-124370-python-free-threaded-howto

Conversation

@colesbury

@colesbury colesbury commented Sep 23, 2024

Copy link
Copy Markdown
Contributor

This is a guide aimed at people writing Python code, as oppposed to the existing guide for C API extension authors.


📚 Documentation preview 📚: https://cpython-previews--124371.org.readthedocs.build/en/124371/howto/free-threading-python.html

This is a guide aimed at people writing Python code, as oppposed to the
existing guide for C API extension authors.
@colesbury colesbury marked this pull request as ready for review September 23, 2024 20:33
@colesbury colesbury requested a review from willingc as a code owner September 23, 2024 20:33
colesbury and others added 2 commits September 23, 2024 13:42
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
@colesbury colesbury requested review from DinoV and mpage September 23, 2024 23:23

@gpshead gpshead 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.

Hide comment

High level comments:

  • Overall, great! I'm not reading it with an eye for what has been left out. But its a doc, I consider those "living" and future updates would deal with that.
  • Perhaps include the word "experimental" in the top level title to help temper expectations?
  • Consider adding a reference to PEP 703 to the doc for context for those interested in how this came to be and what the initial long term plan and expectations are.
  • In the final Single-threaded performance section, I predict someone not aware of larger long term plans and PEP 703 and the earlier proof of concept work you built on top of a couple releases to freak out at the thought of a 40% slower interpreter. I'd go beyond the "This overhead is expected to be reduced in the Python 3.14." statement and indicate what level of free-threaded build performance delta we're ultimately aiming for in the future (without promising which version it happens in).

@mpage

mpage commented Sep 24, 2024

Copy link
Copy Markdown
Contributor

LGTM. +1 for @gpshead's comment about including some detail about what single-threaded performance delta we're ultimately shooting for.

@vstinner vstinner 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.

Hide comment

LGTM. This HOWTO can be adjusted/elaborated later if needed.

@nedbat nedbat 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.

Hide comment

Thanks for doing this! I love that we are putting out information aimed at the users.

20 hidden items Load more…
@bedevere-app

bedevere-app Bot commented Sep 24, 2024

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

colesbury and others added 2 commits September 24, 2024 09:31
Co-authored-by: mpage <mpage@cs.stanford.edu>

@willingc willingc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hide comment

Looking good @colesbury. I made some wording suggestions that should add clarity for Ned and others.

@willingc willingc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hide comment

Love the updates @colesbury. This how to is a nice addition 😄

@willingc

Copy link
Copy Markdown
Contributor

@nedbat If you are good with today's change, please approve and merge. Nice work by @colesbury and everyone who gave feedback. Let's get this out in the wild and we can fine tune if/when needed. 🎉

@nedbat nedbat merged commit 68e384c into python:main Sep 25, 2024
emilyemorehouse added a commit to lysnikolaou/cpython that referenced this pull request Sep 26, 2024
* main: (69 commits)
  Add "annotate" SET_FUNCTION_ATTRIBUTE bit to dis. (python#124566)
  pythongh-124412: Add helpers for converting annotations to source format (python#124551)
  pythongh-119180: Disallow instantiation of ConstEvaluator objects (python#124561)
  For-else deserves its own section in the tutorial (python#123946)
  Add 3.13 as a version option to the crash issue template (python#124560)
  pythongh-123242: Note that type.__annotations__ may not exist (python#124557)
  pythongh-119180: Make FORWARDREF format look at __annotations__ first (python#124479)
  pythonGH-58058: Add quick reference for `ArgumentParser` to argparse docs (pythongh-124227)
  pythongh-41431: Add `datetime.time.strptime()` and `datetime.date.strptime()` (python#120752)
  pythongh-102450: Add ISO-8601 alternative for midnight to `fromisoformat()` calls. (python#105856)
  pythongh-124370: Add "howto" for free-threaded Python (python#124371)
  pythongh-121277: Allow `.. versionadded:: next` in docs (pythonGH-121278)
  pythongh-119400:  make_ssl_certs: update reference test data automatically, pass in expiration dates as parameters python#119400  (pythonGH-119401)
  pythongh-119180: Avoid going through AST and eval() when possible in annotationlib (python#124337)
  pythongh-124448: Update Windows builds to use Tcl/Tk 8.6.15 (pythonGH-124449)
  pythongh-123884 Tee of tee was not producing n independent iterators (pythongh-124490)
  pythongh-124378: Update test_ttk for Tcl/Tk 8.6.15 (pythonGH-124542)
  pythongh-124513: Check args in framelocalsproxy_new() (python#124515)
  pythongh-101100: Add a table of class attributes to the "Custom classes" section of the data model docs (python#124480)
  Doc: Use ``major.minor`` for documentation distribution archive filenames (python#124489)
  ...
@vstinner

Copy link
Copy Markdown
Member

This is a guide aimed at people writing Python code, as oppposed to the existing guide for C API extension authors.

Thanks for writing down this guide @colesbury! It will be very valuable :-)

@colesbury colesbury deleted the gh-124370-python-free-threaded-howto branch October 1, 2024 17:10
@colesbury colesbury added the needs backport to 3.13 bugs and security fixes label Oct 1, 2024
@miss-islington-app

Copy link
Copy Markdown

Thanks @colesbury for the PR, and @nedbat for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 1, 2024
* pythongh-124370: Add "howto" for free-threaded Python

This is a guide aimed at people writing Python code, as oppposed to the
existing guide for C API extension authors.

* Add missing new line

* Update Doc/howto/free-threading-python.rst

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

* interned -> immortalized

* Apply suggestions from code review

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>

* Update Doc/howto/free-threading-python.rst

Co-authored-by: mpage <mpage@cs.stanford.edu>

* Update docs

* Apply suggestions from code review

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>

* A few more updates

* Additional comment on immortal objects

* Mention specializing adaptive interpreter

* Remove trailing whitespace

* Remove mention of C macro

---------

(cherry picked from commit 68e384c)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: mpage <mpage@cs.stanford.edu>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
@bedevere-app

bedevere-app Bot commented Oct 1, 2024

Copy link
Copy Markdown

GH-124860 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Oct 1, 2024
Yhg1s pushed a commit that referenced this pull request Oct 3, 2024
…124860)

gh-124370: Add "howto" for free-threaded Python (GH-124371)
(cherry picked from commit 68e384c)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: mpage <mpage@cs.stanford.edu>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news topic-free-threading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants