python

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package python implements the Python import extractor.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DepKey

func DepKey(raw string) string

DepKey normalizes a Python module path to its top-level package name (the PyPI dep key, in most cases).

"requests"            -> "requests"
"requests.adapters"   -> "requests"
"flask.helpers"       -> "flask"
".local"              -> ""    (relative)
"..pkg.x"             -> ""    (relative)
""                    -> ""

Limitation: namespace packages where the top-level differs from the PyPI distribution (e.g. `google.cloud.storage` from `google-cloud-storage`) need consumer-side mapping. depusage emits the dotted top-level only.

func Extract

func Extract(body []byte, opts extract.Options) (extract.Result, error)

Extract runs the Python import pass over body.

func IsRelative

func IsRelative(raw string) bool

IsRelative reports whether the module path uses leading-dot relative notation (e.g. `.x`, `..y.z`, `.`).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL