跳转到主要内容

在预提交钩子中获得Thoth推荐。

项目描述

Thoth预提交钩子

使用Thoth预提交钩子获取对您的依赖项的Thoth建议。

用法

.pre-commit-config.yaml中的示例用法

---
repos:
  - repo: https://github.com/thoth-station/thoth-pre-commit-hook
    rev: v0.1.2
    hooks:
      - id: thoth-pre-commit-hook
        args: ["--recommendation-type", "security"]

可以通过运行Thamos(与Thoth后端通信的命令行界面)来找到可以指定的参数列表

 Usage: thamos advise [OPTIONS]

 Ask Thoth for recommendations on the application stack.
 Ask the remote Thoth service for advise on the application stack used. The command collects information stated in the .thoth.yaml file for the given runtime
 environment, static source code analysis and requirements for the application and sends them to the remote service. Optionally, install packages resolved by Thoth.
 Examples:
 thamos advise --runtime-environment testing --labels 'foo=bar,qux=baz'
 thamos advise --dev
 thamos advise --install
 thamos advise --no-static-analysis --no-user-stack

╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│  --debug                                                        Run analysis in debug mode on Thoth.                                                               │
│  --no-write                        -W                           Do not write results to files, just print them.                                                    │
│  --recommendation-type             -t  RECOMMENDATION_TYPE      Use selected recommendation type, do not load it from Thoth's config file.                         │
│  --no-wait                                                      Do not wait for analysis to finish, just submit it.                                                │
│  --no-user-stack                                                Do not submit lock file with the request, this lock file is normally used as a base for            │
│                                                                 comparision to recommend a better stack than the one used.                                         │
│  --no-static-analysis                                           Do not perform static analysis of source code files.                                               │
│  --json                            -j                           Print output in JSON format.                                                                       │
│  --force                                                        Force analysis run bypassing server-side cache.                                                    │
│  --runtime-environment             -r  NAME                     Specify explicitly runtime environment to get recommendations for; defaults to the first entry in  │
│                                                                 the configuration file.                                                                            │
│  --dev                                                          Consider or do not consider development dependencies during the resolution. [default: no-dev]      │
│  --install                                                      Install dependencies once the advise is done. [default: False]                                     │
│  --write-advised-manifest-changes      FILE                     Write advised manifest changes to a file.                                                          │
│  --labels                          -l  KEY1=VALUE1,KEY2=VALUE2  Labels used to label the request.                                                                  │
│  --help                                                         Show this message and exit.                                                                        │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

 Check Thamos documentation: https://thoth-station.ninja/docs/developers/thamos
  • recommendation-type:用于依赖项解决的Thoth建议类型。可用的建议类型包括

    security stable latest performance testing

有关更多详细信息,请参阅建议类型文档

  • runtime-environment:用于依赖项分析的运行时环境。Thoth可以对不同的运行时环境分析您的依赖项

    ubi-8-py-3.8 rhel-8-py-3.8 fedora-35-py-3.10 fedora-34-py-3.9

要运行此预提交钩子,必须按照Thamos CLI文档中指定的方式配置仓库,并包含一个.thoth.yaml文件。Thoth预提交钩子在解决后会在依赖项要求文件目录中生成一个.thoth_last_analysis_id文件。为了避免提交它,请将其添加到您的仓库.gitignore文件中。

项目详情


下载文件

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

源分发

thoth_pre_commit_hook-0.1.3.tar.gz (16.1 kB 查看哈希值)

上传时间

构建分发

thoth_pre_commit_hook-0.1.3-py3-none-any.whl (17.1 kB 查看哈希值)

上传时间 Python 3

由以下提供支持