poncho_package_analyze(1)

poncho_package_analyze1

Command-line utility for analyzing python script for library and interpreter dependencies

Usage

FCponcho_package_analyze [options] <python-script ... > <json-output-file>FT

Overview

poncho_package_analyze is a simple command line utility for analyzing Python scripts for the necessary external dependencies. It generates an output file that can be used with python_package_create to build a self-contained Conda environment for the Python application.

The FCpython-script ...FT argument is the path(s) to the Python script(s) to be analyzed. The FCjson-output-fileFT argument is the path to the output JSON file that will be generated by the command. Specifying - for either will use stdin/stdout instead of a file.

Options

-h,--help

Show this help message

--toplevel

Only include imports at the top level of the script.

--function=<<fn>>

Only include imports in the given function.

--pkg-mapping=<<import=name>>

Specify that the module imported as <import> in the code is provided by the pip/conda package <name>.

--extra-pkg=<pkg>

Also include the pip/conda package <pkg>, even if it does not appear in the sources. May be useful for scripts that execute other (possibly non-Python) components that must also be included.

Exit

On success, returns zero. On failure, returns non-zero.

Examples

An example Python script FCexample.pyFT contains the following code:


    

    
        

import os import sys import pickle

import antigravity import matplotlib

if __name__ == "__main__":
print("example")

To analyze the FCexample.pyFT script for its dependencies and generate the output JSON dependencies file FCdependencies.jsonFT, run the following command:

FC$ poncho_package_analyze example.py dependencies.jsonFT

Once the command completes, the FCdependencies.jsonFT file within the current working directory will contain a Conda environment specification (suitable to use with FCconda env createFT).

Note that system-level modules are considered part of the Python package installed into the Conda environment. Additionally, imports not managed by Pip or Conda are not allowed. This includes other modules within the CWD or in user-written packages.

From coop-computing-tools 1:7.14.5-1+b2 in Debian 13 (Trixie). Parsed by carta from the page's man source.