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 — Misleading __version__ attribute of modules in standard library · Issue #76007 · python/cpython

Misleading __version__ attribute of modules in standard library #76007

New issue
Copy link
New issue
Copy link
Closed
#142898
Closed
Misleading __version__ attribute of modules in standard library#76007
#142898
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

abukaj
mannequin
opened on Oct 20, 2017
Issue body actions
BPO 31826
Nosy @warsaw, @rhettinger, @ncoghlan, @pitrou, @merwok, @encukou, @serhiy-storchaka, @abukaj, @cryvate
PRs
  • bpo-31826: remove unused __version__ from mock.py #17977
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2017-10-20.13:21:04.010>
    labels = ['3.7', 'type-bug', 'library']
    title = 'Misleading __version__ attribute of modules in standard library'
    updated_at = <Date 2020-02-04.10:54:36.743>
    user = 'https://github.com/abukaj'

    bugs.python.org fields:

    activity = <Date 2020-02-04.10:54:36.743>
    actor = 'cryvate'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2017-10-20.13:21:04.010>
    creator = 'abukaj'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31826
    keywords = ['patch']
    message_count = 7.0
    messages = ['304654', '304763', '304765', '304779', '304780', '304823', '361340']
    nosy_count = 9.0
    nosy_names = ['barry', 'rhettinger', 'ncoghlan', 'pitrou', 'eric.araujo', 'petr.viktorin', 'serhiy.storchaka', 'abukaj', 'cryvate']
    pr_nums = ['17977']
    priority = 'normal'
    resolution = None
    stage = 'needs patch'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue31826'
    versions = ['Python 3.7']

    Linked PRs

    • gh-76007: Deprecate __version__ attribute #138675
    • gh-76007: pydoc: Catch DeprecationWarning for stdlib module __version__ attributes #139997
    • gh-76007: Deprecate zlib.__version__ attribute #140130
    • gh-76007: Deprecate __version__ attribute in imaplib #140299
    • gh-76007: Deprecate __version__ attribute in decimal #140302
    • gh-76007: remove curses.__version__ doc #141052
    • [3.14] gh-76007: remove curses.__version__ doc (GH-141052) #141076
    • [3.13] gh-76007: remove curses.__version__ doc (GH-141052) #141077
    • gh-76007: Deprecate __version__ attribute in http.server #142658
    • gh-76007: Deprecate __version__ attribute in wsgiref.simple_server #142675
    • gh-76007: Deprecate __version__ attribute in ctypes #142679
    • gh-76007: Deprecate VERSION in xml.etree.ElementTree & version in xml.sax.expatreader & xml.sax.handler #142898
    • gh-76007: Deprecate tarfile.version #145326

    Activity

    Next
    1. abukaj commented on Oct 20, 2017

      @abukaj
      abukajmannequin
      on Oct 20, 2017
      MannequinAuthor
      More actions

      Several modules of the standard library (at least re and csv) have __version__ strings.

      The string is the same for Python 2.7-3.6:

          >>> import re, csv; print(re.__version__, csv.__version__)
          2.2.1 1.0

      while documentation indicates changes in the modules.

      Semantic versioning (recommended by PEP-440) suggests that at least minor version should change in such case.

      I suspect it to be a "code fossil" which may be removed according to PEP-396.

    2. abukaj
      added
      stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
      on Oct 20, 2017
    3. terryjreedy
      added
      3.7 (EOL)end of lifeend of life
      on Oct 20, 2017
    4. rhettinger commented on Oct 22, 2017

      @rhettinger
      rhettinger
      on Oct 22, 2017
      Contributor
      More actions

      I would support just removing the version attributes for csv and re.

    5. pitrou commented on Oct 22, 2017

      @pitrou
      pitrou
      on Oct 22, 2017
      Member
      More actions

      +1 for removing __version__ on all stdlib modules which are not externally maintained.

    6. ncoghlan commented on Oct 23, 2017

      @ncoghlan
      ncoghlan
      on Oct 23, 2017
      Contributor
      More actions

      +1 from me for dropping these, and noting which modules were affected in the Porting section of the 3.7 What's New (I'd be surprised if anyone was depending on them existing, but it doesn't hurt to mention it, and may help if someone is trying to figure out what changed)

    7. rhettinger commented on Oct 23, 2017

      @rhettinger
      rhettinger
      on Oct 23, 2017
      Contributor
      More actions

      Please do leave version in the decimal module where it has a precise meaning, tracking a particular version of the spec that was implemented and tested.

    8. merwok commented on Oct 23, 2017

      @merwok
      merwok
      on Oct 23, 2017
      Member
      More actions

      The version in distutils is derived from sys.version and should be left as is too. Thanks!

    9. encukou commented on Feb 4, 2020

      @encukou
      encukou
      on Feb 4, 2020
      Member
      More actions

      PR for removing __version__ from mock: #17977

    10. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    11. furkanonder commented on May 13, 2023

      @furkanonder
      furkanonder
      on May 13, 2023
      Contributor
      More actions

      @encukou The issue seems to have been resolved. Can we close the issue?

    12. encukou commented on May 15, 2023

      @encukou
      encukou
      on May 15, 2023
      Member
      More actions

      There are still a lot of modules with __version__
      IMO, to resolve it properly:

      • There should be a test, similar to test___all__, to avoid regressions
      • For modules where __version__ has a meaning, that fact should be documented -- either we want users to use it, or there's no point exposing it

      Note that nowadays, the proper way to remove an attribute is with a deprecation period using module __getattr__.

      Reacted by Erlend E. Aasland and Hugo van Kemenade
    13. smontanaro commented on Jan 17, 2024

      @smontanaro
      smontanaro
      on Jan 17, 2024
      Contributor
      More actions

      I just migrated __version__ from _csv.c to csv.py. I was unaware of this discussion. I'm happy to remove it altogether. Can someone explain to me how this trend came about? I was a bit surprised to see it at all w.r.t. the csv module.

    14. erlend-aasland commented on Jan 17, 2024

      @erlend-aasland
      erlend-aasland
      on Jan 17, 2024
      Contributor
      More actions

      Note that nowadays, the proper way to remove an attribute is with a deprecation period using module __getattr__.

      Related issue:

      • Deprecate sqlite3.version and sqlite3.version_info #93370
    15. 35 remaining items

    16. StanFromIreland
      added a commit that references this issue on Dec 6, 2025

      pythongh-76007: remove curses.__version__ doc (python#141052)

      cb65ea4
    17. hugovk
      added 2 commits that reference this issue on Dec 13, 2025

      gh-76007: Deprecate `__version__` attribute in `http.server` (#142658)

      170dac2

      gh-76007: `pydoc`: Catch `DeprecationWarning` for stdlib module `__ve…

      78a50ee
    18. hugovk commented on Dec 14, 2025

      @hugovk
      hugovk
      on Dec 14, 2025
      Member
      More actions

      I think we're done with __version__ once #142675 and #142679 are merged, or are there any more to do?

      There's also a VERSION and a couple of versions we could deprecate:

      cpython/Lib/xml/etree/ElementTree.py

      Line 93 in 04da416

      VERSION = "1.3.0"

      cpython/Lib/xml/sax/expatreader.py

      Line 6 in 04da416

      version = "0.20"

      cpython/Lib/xml/sax/handler.py

      Line 12 in 04da416

      version = '2.0beta'

      Thoughts?

      Reacted by Victor Stinner
    19. hugovk
      added a commit that references this issue on Dec 15, 2025

      gh-76007: Deprecate `__version__` attribute in `ctypes` (#142679)

      38ad651
    20. fatelei
      added 2 commits that reference this issue on Dec 16, 2025

      pythongh-76007: `pydoc`: Catch `DeprecationWarning` for stdlib module…

      91f5dfe

      pythongh-76007: Deprecate `__version__` attribute in `ctypes` (python…

      c9229be
    21. hugovk
      added a commit that references this issue on Dec 16, 2025

      gh-76007: Deprecate `__version__` attribute in `wsgiref.simple_server` (

      c10ec48
    22. hugovk commented on Dec 17, 2025

      @hugovk
      hugovk
      on Dec 17, 2025
      Member
      More actions

      There's also a VERSION and a couple of versions we could deprecate:

      PR #142898 for that, to close this issue.

      Reacted by Cody Maloney
    23. hugovk
      added a commit that references this issue on Dec 18, 2025

      gh-76007: Deprecate `VERSION` in `xml.etree.ElementTree` & `version` …

      d2abd57
    24. hugovk
      closed this as completedin #142898on Dec 18, 2025
    25. cocolato
      added a commit that references this issue on Dec 18, 2025

      pythongh-76007: Deprecate `VERSION` in `xml.etree.ElementTree` & `ver…

      1101fb4
    26. hugovk
      added a commit that references this issue on Feb 27, 2026

      gh-76007: Deprecate `tarfile.version` (#145326)

      4d89056
    27. brijkapadia
      added a commit that references this issue on Feb 28, 2026

      pythongh-76007: Deprecate `tarfile.version` (python#145326)

      a1ecfd1
    28. ljfp
      added a commit that references this issue on Apr 25, 2026

      pythongh-76007: Deprecate `tarfile.version` (python#145326)

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

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

      Projects

      No projects

        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.