r/Python Oct 07 '24

News Python 3.13 released

https://www.python.org/downloads/release/python-3130/

This is the stable release of Python 3.13.0

Python 3.13.0 is the newest major release of the Python programming language, and it contains many new features and optimizations compared to Python 3.12. (Compared to the last release candidate, 3.13.0rc3, 3.13.0 contains two small bug and some documentation and testing changes.)

Major new features of the 3.13 series, compared to 3.12

Some of the new major new features and changes in Python 3.13 are:

New features

  • A new and improved interactive interpreter, based on PyPy's, featuring multi-line editing and color support, as well as colorized exception tracebacks.
  • An experimental free-threaded build mode, which disables the Global Interpreter Lock, allowing threads to run more concurrently. The build mode is available as an experimental feature in the Windows and macOS installers as well.
  • A preliminary, experimental JIT, providing the ground work for significant performance improvements.
  • The locals() builtin function (and its C equivalent) now has well-defined semantics when mutating the returned mapping, which allows debuggers to operate more consistently.
  • A modified version of mimalloc is now included, optional but enabled by default if supported by the platform, and required for the free-threaded build mode.
  • Docstrings now have their leading indentation stripped, reducing memory use and the size of .pyc files. (Most tools handling docstrings already strip leading indentation.)
  • The dbm module has a new dbm.sqlite3 backend that is used by default when creating new files.
  • The minimum supported macOS version was changed from 10.9 to 10.13 (High Sierra). Older macOS versions will not be supported going forward.
  • WASI is now a Tier 2 supported platform. Emscripten is no longer an officially supported platform (but Pyodide continues to support Emscripten).
  • iOS is now a Tier 3 supported platform.
  • Android is now a Tier 3 supported platform.

Typing

  • Support for type defaults in type parameters.
  • A new type narrowing annotation, typing.TypeIs.
  • A new annotation for read-only items in TypeDicts.
  • A new annotation for marking deprecations in the type system.

Removals and new deprecations

  • PEP 594 (Removing dead batteries from the standard library) scheduled removals of many deprecated modules: aifc, audioop, chunk, cgi, cgitb, crypt, imghdr, mailcap, msilib, nis, nntplib, ossaudiodev, pipes, sndhdr, spwd, sunau, telnetlib, uu, xdrlib, lib2to3.
  • Many other removals of deprecated classes, functions and methods in various standard library modules.
  • C API removals and deprecations. (Some removals present in alpha 1 were reverted in alpha 2, as the removals were deemed too disruptive at this time.)
  • New deprecations, most of which are scheduled for removal from Python 3.15 or 3.16.

More details at https://docs.python.org/3.13/whatsnew/3.13.html

624 Upvotes

97 comments sorted by

View all comments

5

u/k_z_m_r Oct 07 '24

Does anybody have a recommendation for a library to replace telnetlib? We use this one regularly. Unfortunately, the async nature of telnetlib3 doesn’t fit in our architecture.

7

u/nicholashairs Oct 07 '24

I don't have a replacement, however, assuming that the library is pure python, you'd be able to vendorise it based on the last version in the source tree.

3

u/k_z_m_r Oct 08 '24

Yeah, it's written primarily with socket. Cannibalizing the code seems very possible.

4

u/cdrt Oct 08 '24

Why not just pull the library out of an old release and vendor it? It’s only one extra file in your codebase

Or you could try this: https://pypi.org/project/standard-telnetlib/

3

u/k_z_m_r Oct 08 '24

It’s just company policy when it boils down to it. But I appreciate this link! Thanks!

1

u/sblinn Oct 12 '24

Might be better imho to wrap telnetlib3 than vendorize telnetlib. Plus you’ll learn how to deal with asyncio from your code base. (This is basically what I did to embed a telnet server in a Pygame app.)