A CLI tool and library for interacting with Thoth
Project description
A CLI tool and library for communicating with Thoth backend.
Using Thamos as a CLI tool
Thamos is released on PyPI. See installation instructions bellow to setup Thoth/Thamos for your repository:
# Install Thamos CLI tool:
$ pip3 install thamos # keep in mind: requires Python 3.6!!
# Go to repository that should be managed by Thoth:
$ cd ~/git/repo/
# Setup Thamos configuration:
$ thamos config
# Ask Thoth for software stack recommendations:
$ thamos advise
Adjusting configuration based on environment variables
You can adjust content of configuration file each time Thamos CLI or Thamos library loads it by expanding entries with environment variables. This can be handy if you would like to parameterize some of the options at runtime (e.g. in deployment).
This behaviour is (due to security reasons) explicitly turned off by default. However you can turn it on by setting THAMOS_CONFIG_EXPAND_ENV environment variable to 1 (0 explicitly turns this behaviour off, default value):
THOTH_HOST=test.thoth-station.ninja THAMOS_CONFIG_EXPAND_ENV=1 thamos advise
2019-03-13 11:22:59,562 [18639] INFO thamos.config: Expanding configuration file based on environment variables
Entries which should be expanded have environment variables in curly braces like the following example:
host: {THOTH_HOST}
Note the expansion is done by replacing these values directly with values of environment variable, this means types need to be taken into account (environment variable with value “true” is put into configuration file as true).
Using Thamos as a library
from thamos.lib import image_analysis
from thamos.config import config
# Set global context.
# Host to Thoth's User API. API discovery will be done
# transparently and the most appropriate API version will be used.
config.explicit_host = "thoth-user-api.redhat.com"
# TLS verification when communicating with Thoth API.
config.tls_verify = True
image_analysis(
image="registry.redhat.com/fedora:29",
registry_user="fridex",
registry_password="secret!",
# TLS verification when communicating with registry.
verify_tls=True,
nowait=False
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file thamos-0.4.2.tar.gz
.
File metadata
- Download URL: thamos-0.4.2.tar.gz
- Upload date:
- Size: 41.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b068470d5c8c54d398a90354bc2a12d8df52d40907fe072b712982a8520c6a47 |
|
MD5 | fac32536ad28e6d83a7f98de40b1ea21 |
|
BLAKE2b-256 | fb832498416c1e84b307153c9003370d686820ba4ca2625133e8dbff7c2f68ec |