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 — Add function `ispackage` to stdlib `inspect` · Issue #125633 · python/cpython

Add function ispackage to stdlib inspect #125633

New issue
Copy link
New issue
Copy link
Closed
Closed
Add function ispackage to stdlib inspect#125633
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement

Description

@Xiaokang2022
Xiaokang2022
opened on Oct 17, 2024
Issue body actions

Feature or enhancement

Proposal:

Currently, the built-in module inspect lacks a function to determine whether an object is a package or not. This is a small but useful feature.

According to the documentation, this feature should not be difficult to implement, and we should add it to the standard library:

  1. Definition of a package
  2. module.__package__
  3. module.__name__
  4. module.__spec__

I've tried to implement this feature and will make a PR later.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

  • gh-125633: Add function ispackage to stdlib inspect #125634
Reacted by Kirill Podoprigora, Peter Bierma, Zhikang Yan and Wulian233

Activity

  1. Xiaokang2022
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Oct 17, 2024
  2. Xiaokang2022 commented on Oct 17, 2024

    @Xiaokang2022
    Xiaokang2022
    on Oct 17, 2024
    ContributorAuthor
    More actions

    My idea for implementing this feature is:

    flowchart LR
        1(obj)
        2{is module?}
        3{hasattr 
        __ path __?}
        4(pkg)
    
        1 --> 2 --Y--> 3 --Y--> 4
    
    Loading
  3. Xiaokang2022
    changed the title [-]Adding function `ispackage` to stdlib `inspect`[/-] [+]Add function `ispackage` to stdlib `inspect`[/+] on Oct 17, 2024
  4. picnixz
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Oct 21, 2024
  5. ncoghlan
    added a commit that references this issue on Oct 27, 2024

    gh-125633: Add function `ispackage` to stdlib `inspect` (#125634)

    dad3453
  6. ncoghlan commented on Oct 27, 2024

    @ncoghlan
    ncoghlan
    on Oct 27, 2024
    Contributor
    More actions

    PR has been merged for inclusion in Python 3.14.0a2.

    Reacted by Zhikang Yan
  7. ncoghlan
    closed this as completedon Oct 27, 2024
  8. ebonnal
    added a commit that references this issue on Jan 12, 2025

    pythongh-125633: Add function `ispackage` to stdlib `inspect` (python…

    6ed9518
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-featureA feature request or enhancementA feature request or enhancement

    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.