跳转到主要内容

Python包的元静态分析工具

项目描述

shouldi

shouldi

什么是ShouldI?

shouldi是一个工具,它运行静态分析工具,让您了解您打算安装的任何Python包中是否存在任何问题。

shouldi类似于Go Report Card

shouldi处于非常早期阶段。预期会有所变化。

安装

$ python3 -m pip install -U shouldi

用法

shoudli有几个不同的子命令

  • 安装
    • 类似于pip install,但会进行检查以告知您是否应该安装
  • 使用
    • 将此命令指向任何Git URL或目录,它将为此语言运行适当的静态分析工具
  • 项目
    • 自动发现目录中的项目和这些项目的依赖关系

安装命令

运行bandit和safety。如果这两个工具中的任何一个发现了问题,则告诉运行命令的人不要安装Python包。

$ shouldi install insecure-package bandit
bandit is okay to install
Do not install insecure-package! {'safety_check_number_of_issues': 1}

使用命令

给定一个Git URL或目录,确定代码库的语言,并运行该语言的适当静态分析工具。

每种语言的工具如下。

您必须在系统上安装以下工具

$ shouldi use https://github.com/trekhleb/javascript-algorithms
{'static_analysis': SAResultsSpec(critical=1, high=2941, medium=16, low=41049, report={'npm_audit_output': {'info': 0, 'low': 41049, 'moderate': 16, 'high': 2941, 'critical': 1}})}

项目命令

给定一个目录,输出一个描述该目录内找到的依赖项的JSON。

目前,它会自动发现setup.pyinstall_requires部分或requirements.txt中列出的Python依赖项。

无法自动识别的依赖项可以指定在YAML文件中。

dependencies:
  python:
    name: Python
    url: https://pythonlang.cn
    license: Python License 2.0

以下是一个示例,在shouldi代码库上运行项目命令,使用上述deps.yaml添加无法自动发现的依赖项。

$ shouldi project create -add deps.yaml -- .
{
    "dependencies": [
        {
            "extra": {
                "pypi": {
                    "euuid": "7bd67f47-9972-57fd-8da1-233783b35321",
                    "license": "Apache 2",
                    "name": "aiohttp",
                    "url": "https://pypi.ac.cn/pypi/aiohttp",
                    "uuid": null
                }
            },
            "license": "Apache 2",
            "name": "aiohttp",
            "url": "https://github.com/aio-libs/aiohttp",
            "uuid": "a6172a74-11ca-5624-bbf4-2e064084ee95"
        },
        {
            "extra": {
                "pypi": {
                    "euuid": "8ce644e4-20ef-5a24-85bb-0449fb8e2c94",
                    "license": "",
                    "name": "bandit",
                    "url": "https://pypi.ac.cn/pypi/bandit",
                    "uuid": null
                }
            },
            "license": null,
            "name": "bandit",
            "url": "https://bandit.readthedocs.io/en/latest/",
            "uuid": "1fa385fc-91ae-59c5-8d4c-220b9820f173"
        },
        {
            "extra": {
                "pypi": {
                    "euuid": "c09eaab1-7676-55b8-96fd-cb50f5dc125c",
                    "license": "MIT license",
                    "name": "safety",
                    "url": "https://pypi.ac.cn/pypi/safety",
                    "uuid": null
                }
            },
            "license": "MIT license",
            "name": "safety",
            "url": "https://github.com/pyupio/safety",
            "uuid": "f2cc3711-8652-584d-8d46-7e060398eff4"
        },
        {
            "extra": {
                "pypi": {
                    "euuid": "5143b2bf-be54-5688-8077-efbd038fbdc5",
                    "license": "MIT",
                    "name": "PyYAML",
                    "url": "https://pypi.ac.cn/pypi/PyYAML",
                    "uuid": null
                }
            },
            "license": "MIT",
            "name": "PyYAML",
            "url": "https://github.com/yaml/pyyaml",
            "uuid": "406495d7-1ba9-5a7e-bec9-f2a1119d3913"
        },
        {
            "extra": {},
            "license": "Python License 2.0",
            "name": "Python",
            "url": "https://pythonlang.cn",
            "uuid": "807b7876-01ec-5fef-ad5a-4cc588b97719"
        },
    ]
}

许可协议

shouldi遵循MIT许可证

这到底是什么名字

这个包的真正名称是“DFFML Evaluator for PyPi Packages”。shouldi仅仅是命令行调用,我们声称shouldi(PyPi上的包名),以避免供应链攻击。

项目详情


下载文件

下载适用于您的平台文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源代码分发

shouldi-0.1.0.post0.tar.gz (23.2 kB 查看哈希值)

上传时间 源代码

构建分发

shouldi-0.1.0.post0-py3-none-any.whl (32.3 kB 查看哈希值)

上传时间 Python 3

由以下机构支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面