logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

poncho_package_analyze - command-line utility for analyzing Python script for library and interpreter

Description

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  python-script  ...  argument is the path(s) to the Python script(s) to be analyzed. The json-output-
       file 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.

Example

       An example Python script example.py contains 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  de‐
       pendencies.json, run the following command:

       $ poncho_package_analyze example.py dependencies.json

       Once  the command completes, the dependencies.json file within the current working directory will contain
       a Conda environment specification (suitable to use with conda env create).

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

Exit

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

Name

poncho_package_analyze  -  command-line  utility  for analyzing Python script for library and interpreter
       dependencies

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.

Synopsis

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

See Also