list python package dependencies without loading them?

后端 未结 3 1537
天涯浪人
天涯浪人 2020-11-28 09:45

Say that python package A requires B, C and D; is there a way to list A → B C D without loading them ?
Requires in the metadata (yolk -M A

3条回答
  •  旧巷少年郎
    2020-11-28 09:54

    Snakefood

    sfood -fuq package.py | sfood-target-files 
    

    will list the dependencies.

    `-f` tells sfood to follow dependencies recursively
    `-u` tells sfood to ignore unused imports
    `-q` tells sfood to be quiet about debugging information
    

    To filter out modules from the standard library, you could use

    sfood -fuq package.py | sfood-filter-stdlib | sfood-target-files 
    

    As you've already noted, if there are other directories you'd like ignored, you can also use the sfood -I flag.

提交回复
热议问题