pothenon
pothenon is a dependency parser for Python functions and classes. Given a callable or class, it inspects the
object's source code and resolves each external symbol it references to its originating
Python package, including the package's version where available.
Installation
pip install pothenon
Usage
from pothenon import dependency_parser
Resolving dependencies of a user-defined function
When a function calls another function that is defined in the same (local) scope, pothenon
reports that function together with its own dependencies:
import json
from math import sqrt
def add_one(x):
return x + 1
def get_sqrt(x):
return sqrt(x)
def my_operation(x):
y = add_one(x)
z = get_sqrt(y)
return z
def dump_operation(x):
y = my_operation(x)
return json.dumps(y)
print(dependency_parser.get_full_source(dump_operation))
"""
import json
from math import sqrt
def get_sqrt(x):
return sqrt(x)
def add_one(x):
return x + 1
def my_operation(x):
y = add_one(x)
z = get_sqrt(y)
return z
def dump_operation(x):
y = my_operation(x)
return json.dumps(y)
"""
API
dependency_parser.get_call_dependencies(func)
Analyses func and returns a CallDependencies dict mapping each external symbol name to a
PackageInfo named tuple with the following fields:
| Field | Description |
|---|---|
localname |
The name by which the symbol is referenced inside func |
info |
A VersionInfo with module, qualname, and version |
source_code |
Source code of the dependency (local callables only) |
dependency |
Recursively resolved dependencies of the dependency |
installation |
Conda/pip installation string for the package, if available |
Metadata
Release files for pothenon 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pothenon-0.0.4.tar.gz | 23.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pothenon-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.5 kB
Release files / pothenon-0.0.4.tar.gz
| Download URL | pothenon-0.0.4.tar.gz |
|---|---|
| Size | 23.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6a332f476b98a9b5442916647385837f456d3423e84b0d445be12aa826d5703a
|
|
BLAKE2b-256 checksum How to use checksums |
2bf5efa6fd64b6a3e8a937c348be5f0ec88f4429a3e72867c365ea158c1c35db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / pothenon-0.0.4-py3-none-any.whl
| Download URL | pothenon-0.0.4-py3-none-any.whl |
|---|---|
| Size | 17.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
44fc4ee6d5edfbe3f48251878ac02d72dadc5160293009197869ac61d9c0bf85
|
|
BLAKE2b-256 checksum How to use checksums |
f8bca4507c512394401042f356ec4db82e317e23d03bdeac95e23ce81453e27e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|