Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate pydoc.ispackage() #64020

Closed
ericsnowcurrently opened this issue Nov 28, 2013 · 4 comments
Closed

deprecate pydoc.ispackage() #64020

ericsnowcurrently opened this issue Nov 28, 2013 · 4 comments
Labels
3.13 new features, bugs and security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@ericsnowcurrently
Copy link
Member

BPO 19821
Nosy @PCManticore, @ericsnowcurrently, @wm75, @ZackerySpytz
PRs
  • gh-64020: Deprecate pydoc.ispackage() #20908
  • 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 2013-11-28.07:55:30.790>
    labels = ['type-feature', 'library', '3.11']
    title = 'deprecate pydoc.ispackage()'
    updated_at = <Date 2021-05-21.20:20:33.155>
    user = 'https://github.com/ericsnowcurrently'

    bugs.python.org fields:

    activity = <Date 2021-05-21.20:20:33.155>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2013-11-28.07:55:30.790>
    creator = 'eric.snow'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 19821
    keywords = ['patch']
    message_count = 3.0
    messages = ['204646', '204697', '221548']
    nosy_count = 4.0
    nosy_names = ['Claudiu.Popa', 'eric.snow', 'wolma', 'ZackerySpytz']
    pr_nums = ['20908']
    priority = 'low'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue19821'
    versions = ['Python 3.11']

    @ericsnowcurrently
    Copy link
    Member Author

    pydoc.ispackage() is a best-effort guess at whether or not a path is the location of a package. However, it uses hard-coded suffixes when matching file names, which can miss files (e.g. extension modules and sourceless packages on Windows). It should probably use suffixes defined in importlib.util, as they're used elsewhere in pydoc. The function also does not comprehend namespace packages, but I'm not sure that's worth worrying about.

    FWIW, it isn't clear to me what is using pydoc.ispackage(). It may not be used in the stdlib at all.

    @ericsnowcurrently ericsnowcurrently added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Nov 28, 2013
    @PCManticore
    Copy link
    Mannequin

    PCManticore mannequin commented Nov 28, 2013

    It was used by pydoc.py until 2006, when it was removed with this commit:

    Changeset:
    37821 (3135648026c4) Second phase of refactoring for runpy, pkgutil, pydoc, and setuptools.

    Is it worth to fix this?

    @PCManticore
    Copy link
    Mannequin

    PCManticore mannequin commented Jun 25, 2014

    I would go on the deprecation route with this and removing it in 3.6, just like the formatter module.

    @iritkatriel iritkatriel added the 3.11 only security fixes label May 21, 2021
    @iritkatriel iritkatriel changed the title pydoc.ispackage() could be more accurate deprecate pydoc.ispackage() May 21, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @hugovk
    Copy link
    Member

    hugovk commented May 5, 2023

    Searching the top 5k PyPI packages shows only a single use:

    python3 ~/github/misc/cpython/search_pypi_top.py -q . "pydoc.*ispackage"
    ./PyDispatcher-2.0.7.tar.gz: PyDispatcher-2.0.7/docs/pydoc/pydoc2.py: elif pydoc.ispackage(path):
    ./PyDispatcher-2.0.7.tar.gz: PyDispatcher-2.0.7/docs/pydoc/pydoc2.py: elif pydoc.ispackage(path):

    @hugovk hugovk added 3.12 bugs and security fixes and removed 3.11 only security fixes labels May 5, 2023
    serhiy-storchaka added a commit that referenced this issue Dec 27, 2023
    Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
    @serhiy-storchaka serhiy-storchaka added 3.13 new features, bugs and security fixes and removed 3.12 bugs and security fixes labels Dec 27, 2023
    kulikjak pushed a commit to kulikjak/cpython that referenced this issue Jan 22, 2024
    Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
    aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
    Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.13 new features, bugs and security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants