panoptisch
0.1.7
PANOPTISCH扫描您的Python文件或模块以找到其导入(又称依赖项),并递归地对所有依赖性和亚依赖性。然后,它在JSON中生成一个依赖树,以供您解析和执行导入策略。通过模仿Python的进口系统来解决进口。除了导入模块以查找其源文件的位置外,它完全是静态的。 Panoptisch还具有最小的沙箱,以防止导入依赖关系时副作用。请注意,沙箱不是万无一失的!
此阶段存在已知的局限性和问题。在使用Panoptisch之前,请阅读此内容。
请参阅: LIMITATIONS.md链接。
我找不到Python的适当依赖扫描仪。 Panoptisch诞生了,需要准确验证整个项目的依赖用法。
它的目的是生成一个可以解析和评估以主张进口政策的JSON报告。
例如,您可能需要将os , socket , sys和importlib导入到选定的软件包中。
Panoptisch ,这很重要! pip install panoptisch
usage: panoptisch <module>
positional arguments:
module Name of module or file you wish to scan.
options:
-h, --help show this help message and exit.
--show-stdlib-dir Prints the automatically resolved stdlib directory.
--max-depth MAX_DEPTH
Maximum dependency depth.
--out OUT File to output report.
--auto-stdlib-dir Ignore stdlib modules by automatically resolving their path. MAY BE BUGGY. Try running panoptisch <module_name> --show-stdlib-dir to see the directory before using this.
--stdlib-dir STDLIB_DIR Ignore stdlib modules by providing their path.
--omit-not-found Do not include modules that could not be resolved in report.
--no-sandbox Ignore the minimal sandbox implementation.
典型的运行可能是
$ panoptisch <module or file> --max-depth 5 --omit-not-found
$ more out.json
--show-stdlib-dir争论来查看Panoptisch是否可以自动解决您的标准库目录,通常是/usr/local/lib/python3.x Linux安装上。那么您可以使用 $ panoptisch <module or file> --auto-stdlib-dir
如果PANOPTISCH无法自动解决您的标准库目录,则可以自己找到它,并作为stdlib-dir的参数提供
$ panoptisch <module or file> --stdlib-dir /the/path/to/your/standardlibrary/
所有工作均根据GNU通用公共许可证3版获得许可。
反馈,贡献和问题欢迎。