poncho_package_analyze(1)
π poncho_package_analyze(1) π
okay bestie, welcome to the Cooperative Computing Tools manual, section 1, and today's main character is poncho_package_analyze β a whole command-line utility for sniffing out the library and interpreter deps hiding inside your Python script. it's giving detective energy fr fr π΅οΈβοΈβ¨
β¨ NAME β¨
poncho_package_analyze β a command-line utility for analyzing a Python script for library and interpreter dependencies ππ
πΈ SYNOPSIS πΈ
poncho_package_analyze [options] <python-script ...> <json-output-file>
π¦ DESCRIPTION π¦
so basically, poncho_package_analyze is a cute lil command line utility that analyzes your Python scripts and figures out which external dependencies they actually need. then it spits out an output file you can hand straight to python_package_create to build a self-contained Conda environment for your Python app. no cap, it's iconic. π
the python-script ... argument is the path (or paths, plural, she's flexible) to the Python script(s) you want analyzed. the json-output-file argument is the path to the output JSON file that this command is gonna generate for you.
and here's the fun part β if you specify - for either one of those, it'll use stdin/stdout instead of a file. stream queen behavior. π
π OPTIONS π
-h,--helpβ show this help message. classic. β¨--toplevelβ only include imports that live at the top level of the script. no digging into functions, we stay surface level. π--function=<<fn>>β only include the imports inside the given function. hyper-specific, we love a targeted vibe. π―--pkg-mapping=<<import=name>>β tell it that the module imported as<import>in your code is actually provided by the pip/conda package<name>. naming drama resolved. π«Ά--extra-pkg=<pkg>β also include the pip/conda package<pkg>, even if it doesn't show up anywhere in the sources. super useful for scripts that execute other (possibly non-Python) components that also need to be included. come through, bonus package. π¦
π EXIT π
on success, it returns zero. on failure, it returns non-zero. simple as that, bestie.
π EXAMPLE π
say we have an example Python script called example.py containing the following code:
import os
import sys
import pickle
import antigravity
import matplotlib
if __name__ == "__main__":
print("example")
to analyze the example.py script for its dependencies and generate the output JSON dependencies file dependencies.json, you run the following command:
$ poncho_package_analyze example.py dependencies.json
once the command completes, the dependencies.json file sitting in the current working directory will contain a Conda environment specification (suitable to use with conda env create). slay. π
okay important notes, pay attention bestie π β system-level modules are considered part of the Python package installed into the Conda environment. also, imports that aren't managed by Pip or Conda are not allowed. that includes other modules within the CWD, and modules in user-written packages. so don't try it. π
π COPYRIGHT π
the Cooperative Computing Tools are Copyright (C) 2022 The University of Notre Dame. this software is distributed under the GNU General Public License. see the file COPYING for details. β
and that's a wrap on the poncho_package_analyze(1) page from CCTools 7.15.9 FINAL β go analyze something, bestie, you got this π§π
π¦ where this page comes from
- ubuntu resolute: coop-computing-tools 1:7.15.9-1build1 Β· GPL-2.0-only
- ubuntu stonking: coop-computing-tools 1:7.15.9-2build1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms