Skip to main content

Thoth pre-commit hook

Get Thoth advise on your dependencies with the Thoth pre-commit hook.

Usage

Example usage in .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"]

The list of arguments that can be specified can be found by running Thamos, the command line interface to communicate with Thoth's backend:

 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 recommendation type for the dependency resolution. Recommendation types available are:

    security stable latest performance testing

See the documentation on recommendation types for more details.

  • runtime-environment: Runtime environment used for dependency analysis. Thoth can analyze your dependencies against different runtime environments:

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

To be able to run this pre-commit hook, the repository must be configured with a .thoth.yaml file as specified in the Thamos CLI documentation. The Thoth pre-commit hook generates a .thoth_last_analysis_id file in the dependency requirements file directory after the resolution. To avoid committing it, add it to your repository .gitignore file.

Release files for thoth-pre-commit-hook 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for thoth-pre-commit-hook 0.1.3
File Size Uploaded
thoth_pre_commit_hook-0.1.3.tar.gz 16.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for thoth-pre-commit-hook 0.1.3
File Interpreter ABI Platform
thoth_pre_commit_hook-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 33.1 kB

Release files / thoth_pre_commit_hook-0.1.3.tar.gz

Download URL thoth_pre_commit_hook-0.1.3.tar.gz
Size 16.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ee314aa72bf692b4ef1e8b042ff9028e3e7777df17be098668a36022fb27967f
BLAKE2b-256 checksum
How to use checksums
98ffb1ab3abc829726357f4a2015ac0fefd69b234baf95bfe986b62c86ec2236
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.8

Release files / thoth_pre_commit_hook-0.1.3-py3-none-any.whl

Download URL thoth_pre_commit_hook-0.1.3-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c6ba27eae2ecabab424946ab275e023d703af16fe36dc46889ef2567ae6287be
BLAKE2b-256 checksum
How to use checksums
7a31d6d78f3858787b87051671488eeecc662cf62c4820ce443f1b981fce45e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.8

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page