Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

dt-cli — Dynatrace developer's toolbox

Dynatrace CLI is a command line utility that assists in developing, signing, and building extensions for Dynatrace Extension Framework 2.0.

PyPI PyPI - Python Version GitHub Workflow Status (main branch)

dt-cli is currently in ALPHA. But it's evolving quickly with new features for extension development and cluster management to be added soon.

Features

  • Build and sign extensions from source
  • Generate development certificates for extension signing
  • Generate CA certificates for development

Installation

pip install dt-cli

Usage

Currently there are three basic commands available for working with extensions. Extension subcommand has two aliases for convenience: dt ext or dt extensions.

  • dt extension genca

    generates CA root certificate and key, required to generate developer certificates and for extension validation. The file containing the certificate (ca.cert is the deafult name) needs to be placed on ActiveGates and monitored hosts that will be executing extensions.

    Usage: dt extension genca [OPTIONS]
    
      creates CA key and certificate, needed to create developer certificate
      used for extension signing
    
      Options:
      --ca-cert TEXT  CA certificate. Default: ./ca.crt
      --ca-key TEXT   CA key. Default: ./ca.key
      -h, --help      Show this message and exit.
    
  • dt extension gendevcert

    generates a developer certificate used for signing extensions. Please note that there may be multiple developer certificates coming from a single root certificate. It's up to your organization to manage them.

    Usage: dt extension gendevcert [OPTIONS]
    
      creates developer key and certificate used for extension signing
    
      Options:
      --ca-cert TEXT   CA certificate. Default: ./ca.crt
      --ca-key TEXT    CA key. Default: ./ca.key
      --dev-cert TEXT  Developer certificate. Default: ./developer.crt
      --dev-key TEXT   Developer key. Default: ./developer.key
      -h, --help       Show this message and exit.
    
  • dt extension build builds distributable extension file from a given directory containing extension files (./extension by default). The extension will be signed with a developer certificate and key.

    Usage: dt extension build [OPTIONS]
    
      builds extension file from the given extension directory (extension in
      current dir. is the default)
    
      Options:
      --extension-directory TEXT  Directory where extension files are. Default:
                                  ./extension
    
      --target-directory TEXT     Directory where extension package should be
                                  written. Default: .
    
      --certificate TEXT          Certificate used for signing. Default:
                                  ./developer.crt
    
      --private-key TEXT          Private key used for signing. Default:
                                  ./developer.key
    
      --keep-intermediate-files   Do not delete the signature and `extension.zip'
                                  files after building extension archive
    
      -h, --help                  Show this message and exit.
    

Development

This tool requires Python 3.8+ and is build with poetry. Before starting, make sure you have a dedicated virtual environment for working with this project. Create your virtual environment in project directory:

python -m venv env

Activate it before proceeding:

source ./env/bin/activate

Install poetry:

$ pip install poetry

Now you can build the project and get the wheel file:

$(env) poetry build

The resulting wheel file can be found in the dist folder, e.g. ./dist/dtcli-0.0.1-py3-none-any.whl

If you have a separate environment where dtcli should be available, you should install the wheel file there. Simply run the following command:

$ pip install dt_cli-0.0.1-py3-none-any.whl

If you want to start using it in the environment where it was built, you just use this poetry command:

$ poetry install

From this moment you can start using the command line tool directly (or from your code, see a dedicated section below):

$ dt --help

Each command contains its own help description, see:

$ dt ext build --help

Testing

Run pytest tests

poetry run pytest --flake8

Run mypy tests

poetry run pytest --mypy dtcli --strict

Run test coverage report

poetry run pytest --cov . --cov-report html

Using dt-cli from your Python code

You may want to use some commands implemented by dt-cli directly in your Python code, e.g. to automatically sign your extension in a CI environment. Here's an example of building an extension programatically, it assumes dtcli package is already installed and available in your working environment.

from dtcli import building


building.build_extension(
    extension_dir_path = './extension',
    extension_zip_path = './extension.zip',
    extension_zip_sig_path = './extension.zip.sig',
    target_dir_path = './dist',
    certificate_file_path = './developer.crt',
    private_key_file_path = './developer.key',
    keep_intermediate_files=False,
)

Contributions

You are welcome to contribute using Pull Requests to the respective repository. Before contributing, please read our Code of Conduct.

License

dt-cli is an Open Source Project. Please see LICENSE for more information.

Metadata

Release files for dt-cli 0.0.9a0

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

Source distribution (sdist)

Source distribution for dt-cli 0.0.9a0
File Size Uploaded
dt-cli-0.0.9a0.tar.gz 14.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dt-cli 0.0.9a0
File Interpreter ABI Platform
dt_cli-0.0.9a0-py3-none-any.whl Python 3 none any Details

Total release size: 29.7 kB

Release files / dt-cli-0.0.9a0.tar.gz

Download URL dt-cli-0.0.9a0.tar.gz
Size 14.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7b852b7a8a172f2ee5078668dbb5548251b36f0b00d17ec36f08c11ba707699f
BLAKE2b-256 checksum
How to use checksums
101f44aa93c3b0c65e72d547ddc1a42490a9c6c5350b8e05c1059c16c79f4512
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.6 CPython/3.9.4 Linux/5.4.0-1043-azure

Release files / dt_cli-0.0.9a0-py3-none-any.whl

Download URL dt_cli-0.0.9a0-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a24f9ede52b3a7912b331cfb37c2ac8ffb09c95f3d9e5502f11944e8540e7fd5
BLAKE2b-256 checksum
How to use checksums
8b8511d51d5f8c7db3439482eecb728eaf5b6112169b640dc4469a6ecd7c42b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.6 CPython/3.9.4 Linux/5.4.0-1043-azure

Release history Release notifications | RSS feed

1.6.21

2 release files

1.6.19

2 release files

1.6.18

2 release files

1.6.17

2 release files

1.6.16

2 release files

1.6.15

2 release files

1.6.13

2 release files

1.6.11

2 release files

1.6.9

2 release files

1.6.7

2 release files

1.6.6

2 release files

1.6.5

2 release files

1.6.4

2 release files

1.6.3

2 release files

1.6.2

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.3

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.0.0

2 release files

This release

0.0.9a0 This release

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