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 — Remove `ByteString` from `typing` and `collections.abc` · Issue #118803 · python/cpython

Remove ByteString from typing and collections.abc #118803

New issue
Copy link
New issue
Copy link
Closed
Closed
Remove ByteString from typing and collections.abc#118803
Copy link
Assignees
sobolevnAlexWaygood
Labels
3.14bugs and security fixesbugs and security fixestopic-typingtype-featureA feature request or enhancementA feature request or enhancement

Description

@sobolevn
sobolevn
opened on May 8, 2024
Issue body actions

Feature or enhancement

It was deprecated and scheduled for removal in 3.14

Original issue: #91896
Ref: 09b7695

Linked PRs

  • gh-118803: Remove ByteString from typing and collections.abc #118804
  • Revert "gh-118803: Remove ByteString from typing and collections.abc (#118804)" #138990
  • [3.14] Revert "gh-118803: Remove ByteString from typing and collections.abc (GH-118804)" (GH-138990) #138995
  • gh-118803: Improve documentation around ByteString deprecation #139115
  • gh-118803: Make ByteString deprecations louder; remove ByteString from typing.__all__ and collections.abc.__all__ #139127
  • [3.14] gh-118803: Improve documentation around ByteString deprecation (GH-139115) #139136
  • [3.13] gh-118803: Improve documentation around ByteString deprecation (#139115) #139137
  • [3.13] gh-118803: Fixup a few references in the 3.13 branch to the intended removal date for ByteString #139171
Reacted by Jelle Zijlstra

Activity

Next
  1. sobolevn
    added
    type-featureA feature request or enhancementA feature request or enhancement
    topic-typing
    3.14bugs and security fixesbugs and security fixes
    on May 8, 2024
  2. sobolevn
    self-assigned this
    on May 8, 2024
  3. sobolevn
    added a commit that references this issue on May 8, 2024

    pythongh-118803: Remove `ByteString` from `typing` and `collections.abc`

    7cf1579
  4. AlexWaygood
    added a commit that references this issue on May 8, 2024

    gh-118803: Remove `ByteString` from `typing` and `collections.abc` (#…

    2f4db5a
  5. AlexWaygood
    closed this as completedon May 8, 2024
  6. cdce8p commented on May 26, 2025

    @cdce8p
    cdce8p
    on May 26, 2025
    Contributor
    More actions

    Tbh I was a bit surprised that it didn't raise any DeprecationWarning on 3.13. Looking at #118804 it seems that was only emitted on isinstance checks. Most examples I've seen while testing 3.14 just import it at runtime to use as annotation.

    It's a bit unfortunate to not have gotten a warning for it earlier as a few packages will now require immediate fixes for 3.14. Not sure if it would be worth it to revert the removal and add a proper DeprecationWarning on import (i.e. in typing.__getattr__)?

    Reacted by Joao S. O. Bueno
    Reacted by vivodi
    Reacted by vivodi
  7. JelleZijlstra commented on May 26, 2025

    @JelleZijlstra
    JelleZijlstra
    on May 26, 2025
    Member
    More actions

    I'd be OK with that. This sort of removal can be pretty disruptive since libraries using it will usually be using a from import, so users who need those libraries will be completely unable to even import the library on 3.14.

    What are some examples of libraries still using this?

    Reacted by vivodi
    Reacted by vivodi
  8. AlexWaygood commented on May 28, 2025

    @AlexWaygood
    AlexWaygood
    on May 28, 2025
    Member
    More actions

    I'm also fine with doing a longer deprecation period here. The reason we didn't emit deprecation warnings when it was imported/accessed from typing.py initially was that it's included in typing.__all__, which means that from typing import * would have led to a deprecation warning being emitted. We realised that doing that is actually fairly common, and we couldn't remove it from __all__ because that itself was a breaking change.

    Now that we've had deprecation warnings in the docs for 2 years, though (and some deprecation warnings at runtime), I think it would be fine to remove ByteString from typing.__all__, remove ByteString from collections.abc.__all__, and emit more aggressive deprecation warnings that trigger when you import it from typing or access it as an attribute from the module. It's still breaking (people will get NameErrors if they were relying on from typing import * to import ByteString for them), but it's much less breaking than what we have now, which is ByteString no longer existing at all.

    Reacted by vivodi
    Reacted by vivodi
  9. AlexWaygood commented on May 28, 2025

    @AlexWaygood
    AlexWaygood
    on May 28, 2025
    Member
    More actions

    What are some examples of libraries still using this?

    It was a while back (and they obviously no longer use it following my PR), but I was pretty concerned when aiohttp said that they hadn't seen any deprecation warnings about this in aio-libs/aiohttp#8408 (comment). I meant to propose extending the deprecation period, but lost track of it :-(

    Reacted by vivodi
    Reacted by vivodi
  10. cdce8p commented on May 28, 2025

    @cdce8p
    cdce8p
    on May 28, 2025
    Contributor
    More actions

    What are some examples of libraries still using this?

    I've only seen it a couple of times so far. Most cases have already been fixed for some time now:

    • crc -> Fixed in 5.0 (Nicoretti/crc@2ae4871). For Home Assistant we have a dependency which still (unnecessarily) pins the version to <5. Will work to update that instead.
    • pynacl -> Fixed last year in Fix compatibility with Python 3.14.0a1 pyca/pynacl#848 but no new release yet.
    Reacted by vivodi
    Reacted by vivodi
  11. JelleZijlstra commented on May 28, 2025

    @JelleZijlstra
    JelleZijlstra
    on May 28, 2025
    Member
    More actions

    Anyone interested in sending a PR to restore it for 3.14?

    Reacted by vivodi
    Reacted by vivodi
  12. JelleZijlstra
    reopened this on May 28, 2025
  13. sobolevn commented on May 29, 2025

    @sobolevn
    sobolevn
    on May 29, 2025
    MemberAuthor
    More actions

    I think that we should check top 10000 packages for its usages. If there are many existing ones - it might be a good idea to restore it. But, if there are just several - then we should probably move forward, it was deprecated for 5 versions already, there was a lot of time to change the code .. deprecated-removed:: 3.9 3.14. It is not hard to fix in the library code as ByteString = bytes | bytearray.

  14. 18 remaining items

  15. AlexWaygood
    added a commit that references this issue on Sep 16, 2025

    Revert "gh-118803: Remove `ByteString` from `typing` and `collections…

    530ddd3
  16. miss-islington
    added a commit that references this issue on Sep 16, 2025

    Revert "pythongh-118803: Remove `ByteString` from `typing` and `colle…

    997a9b9
  17. hugovk
    added a commit that references this issue on Sep 17, 2025

    [3.14] Revert "gh-118803: Remove `ByteString` from `typing` and `coll…

    7bba99c
  18. hugovk
    removed
    release-blocker
    on Sep 17, 2025
  19. AlexWaygood
    added 3 commits that reference this issue on Sep 18, 2025

    pythongh-118803: Improve documentation around `ByteString` deprecation

    45fbbc6

    pythongh-118803: Make `ByteString` deprecations louder; remove `ByteS…

    b508dd0

    gh-118803: Improve documentation around `ByteString` deprecation (#13…

    4305cc3
  20. miss-islington
    added a commit that references this issue on Sep 18, 2025

    pythongh-118803: Improve documentation around `ByteString` deprecation (

    9835841
  21. hugovk
    added a commit that references this issue on Sep 18, 2025

    [3.14] gh-118803: Improve documentation around `ByteString` deprecati…

    665a349
  22. AlexWaygood
    added 2 commits that reference this issue on Sep 18, 2025

    [3.13] gh-118803: Improve documentation around `ByteString` deprecati…

    8246e25

    gh-118803: Make `ByteString` deprecations louder; remove `ByteString`…

    293b05c
  23. AlexWaygood commented on Sep 18, 2025

    @AlexWaygood
    AlexWaygood
    on Sep 18, 2025
    Member
    More actions

    We've now done everything we plan to do here until 3.17

    Reacted by Hugo van Kemenade
  24. AlexWaygood
    closed this as completedon Sep 18, 2025
  25. github-project-automation
    moved this from Todo to Done in Release and Deferred blockers 🚫on Sep 18, 2025
  26. AlexWaygood
    added a commit that references this issue on Sep 19, 2025

    [3.13] gh-118803: Fixup a few references in the 3.13 branch to the in…

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

Metadata

Metadata

Assignees

  • @AlexWaygood
    AlexWaygood
  • @sobolevn
    sobolevn

Labels

3.14bugs and security fixesbugs and security fixestopic-typingtype-featureA feature request or enhancementA feature request or enhancement

Projects

  • Release and Deferred blockers 🚫
    Status
    Done
    Show more project fields

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

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.