Dapla CLI

PyPI Status Python Version License

Documentation Tests Coverage Quality Gate Status

pre-commit Black Ruff Poetry

Installation

Install with pipx from pypi:

pipx install dapla-cli

Alternatively you can build dapla-cli using the provided nix flake:

$ nix build .#dapla-cli
$ ./result/bin/dp --version

or open the provided nix shell:

$ nix develop .#
$ dp --version

Usage

Starting point: dp --help

Auth

This tool uses a device flow to authenticate against a Keycloak client.

Keycloak clients

By default it will use a client called dapla-cli, but this may be customized by providing a value --client my-client.

Any client used by this tool needs to have the device flow activated. Refer here for an example client configuration.

Login

Run the command and then follow the instructions to

dp auth login
dp auth login --client my-client --env test

Show token

Once logged in, the access token can be accessed.

dp auth show-access-token
dp auth show-access-token --client my-client --env test --to-clipboard

Logout

dp auth logout

API reference

Please see the [Reference Guide] for details.

Development

Install a local development edition with pipx from the source code:

pipx install --editable .

Alternatively, use make help for other options, such as running Dapla CLI in an isolated environment:

run-isolated       Run Dapla CLI in isolated environment (Docker container) using latest release from PyPI
run-isolated-dev   Run Dapla CLI in isolated environment (Docker container) using latest release from local source (in editable mode)
pipx-install       Install with pipx from PyPI
pipx-install-dev   Install with pipx from the source code in editable mode
build-docker       Build local Docker image for testing in an isolated environment

Contributing

Contributions are very welcome. To learn more, see the Contributor Guide.

License

Distributed under the terms of the MIT license, Dapla CLI is free and open source software.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Credits

This project was generated from Statistics Norway’s SSB PyPI Template.