Skip to main content
Documentation Status https://github.com/MacHu-GWU/picage-project/actions/workflows/main.yml/badge.svg https://codecov.io/gh/MacHu-GWU/picage-project/branch/main/graph/badge.svg https://img.shields.io/pypi/v/picage.svg https://img.shields.io/pypi/l/picage.svg https://img.shields.io/pypi/pyversions/picage.svg https://img.shields.io/badge/✍️_Release_History!--None.svg?style=social&logo=github https://img.shields.io/badge/⭐_Star_me_on_GitHub!--None.svg?style=social&logo=github
https://img.shields.io/badge/Link-API-blue.svg https://img.shields.io/badge/Link-Install-blue.svg https://img.shields.io/badge/Link-GitHub-blue.svg https://img.shields.io/badge/Link-Submit_Issue-blue.svg https://img.shields.io/badge/Link-Request_Feature-blue.svg https://img.shields.io/badge/Link-Download-blue.svg

Welcome to picage Documentation

https://picage.readthedocs.io/en/latest/_static/picage-logo.png

picage is a lightweight utility library that provides an object-oriented interface for inspecting Python package and module structure. Given any installed package name, it automatically locates the source code on the current Python import path and lets you explore its structure. You can access:

  • fully qualified name and short name of any package or module

  • parent package, sub-packages, and sub-modules

  • recursively walk through all sub-packages and sub-modules

  • pretty-print the entire package tree

picage supports all common installation formats including flat dist-info/wheel installs, legacy egg-link editable installs, PEP 660 editable installs (both path-insertion and custom-finder strategies), and legacy egg-directory installs.

Usage

>>> from picage.api import Package

>>> pkg = Package("requests")
>>> pkg
Package(name='requests', path='/.../site-packages/requests')

>>> print(pkg)
Package(
    name='requests',
    path='/.../site-packages/requests',
    sub_packages=[...],
    sub_modules=['adapters', 'api', 'auth', ...],
)

# Access sub-packages and sub-modules
>>> for name, sub_pkg in pkg.sub_packages.items():
...     print(name, sub_pkg.fullname)

>>> for name, mod in pkg.sub_modules.items():
...     print(name, mod.fullname)

# Use dot notation to access nested children
>>> mod = pkg["api"]              # direct child module
>>> deep = pkg["commands.install"]  # dot notation for deeper access

# Walk through the entire package tree
>>> for node, parent, sub_pkgs, sub_mods in pkg.walk():
...     print(node.fullname)

# Include leaf modules in the walk
>>> for node, parent, sub_pkgs, sub_mods in pkg.walk(pkg_only=False):
...     print(node.fullname)

# Navigate the parent chain
>>> child = pkg["utils"]
>>> child.parent is pkg
True
>>> pkg.parent is None
True

# Pretty-print the package tree
>>> pkg.pprint()
/.../site-packages
|-- requests (requests)
    |-- ...

Install

picage is released on PyPI, so all you need is:

$ pip install picage

To upgrade to latest version:

$ pip install --upgrade picage

Release files for picage 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for picage 1.0.0
File Size Uploaded
picage-1.0.0.tar.gz 20.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for picage 1.0.0
File Interpreter ABI Platform
picage-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 34.6 kB

Release files / picage-1.0.0.tar.gz

Download URL picage-1.0.0.tar.gz
Size 20.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d4a0eb369e036872e48f09f119eedecb50299e9b18ff15c44383967cc9a5e0b1
BLAKE2b-256 checksum
How to use checksums
fecf321fa1a4824384f76975a5913f43b0a63601204d14b48556ff432dcc02f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / picage-1.0.0-py3-none-any.whl

Download URL picage-1.0.0-py3-none-any.whl
Size 14.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b8d1f5182ec33e2b5faf644b882acf3c98c3baf7e38362aeb380d191f7203a0
BLAKE2b-256 checksum
How to use checksums
e0613af343f15f96dd71f9bdadff94868be3ebf622453607efd01319ec7375a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.1.0

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page