Overview
The novem CLI is a simple command line utility to integrate novem with your existing shell scripts and workflows.
Installation
The novem command line interface, or cli, is distributed using the python Python Package Index, and you can install it using your preferred python command installation procedure. The source code is also available on GitHub if you want to manually download or install the cli.
To avoid contaminating the global namespace we recommend installing novem in a separate environment, ideally using a tool such as pipx. For the rest of these examples we’ll use pipx for installation.
Getting started
To install the novem cli please run the following in a terminal window with pipx
available: pipx install novem
.
# example of install workflow
username@computer:~/$ pipx install novem
username@computer:~/$ _
Once novem is installed you need to generate and store an api key to get access.
This can be done with the following commands: novem --init
username@computer:~/$ novem --init
• novem.no username: <your_username>
• novem.no password: <your_password>
✓ authenticated
✓ token created
✓ new token "novem-cli-computer-rj8chk2j" saved to ~/.config/novem/novem.conf
username@computer:~/$ _
Congratulations, your novem cli is now installed, configured and authenticated.
Configuration and options
The novem cli stores a configuration file in novem/novem.conf
under the
default config folder location. On Windows it
uses LOCALAPPDATA
or APPDATA
, whilst on Linux and Mac it tries to use
XDG_CONFIG_HOME
but defaults to ~/.config/
if not present.
The novem config files are very similar to windows ini style files as supported by python’s config parser. By default you should not need to make any manual changes to the novem config file, but it can be helpful to know how it works.
In short a configuration file consists of sections, each led by a [section] header, followed by key/value entries separated by an equals sign (=). Section names are case sensitive but keys are not. Leading and trailing whitespace is removed from keys and values.
The novem config file consists of three types of sections that is shared among all novem applications, including fuse, the python library or this cli. These sections are general, application and profile specific.
General
The [general]
section allows you to set options that is true for all
applications using the file. Here you can control things such as the API url,
logging, default profile etc.
The currently supported global options are:
profile
- the default profile to useapi_root
- the api url to use for the cli
[general]
profile = novem_demo
api_root = https://api.novem.no/v1/
Application (app)
The application specific sections start with the string app
followed by a
colon :
, after the colon follows the name of the novem application.
Currently only fuse
, cli
and pylib
are supported.
The different app sections allows you to override the [general]
values as
well as supply app specific options.
[app:cli]
profile = novem_research # change user for the cli
Profile
The final section type is the profile sections. Profile sections start with
the string profile:
followed by a profile name. This is the value referred
to in the [general]
and [app]
sections above.
As an example, the profile section for two users, novem_resarch and novem_demo could look as follows.
[profile:novem_demo]
username = novem_demo
token_name = novem-python-computer-as123ajs
token = <REMOVED>
[profile:novem_research]
username = novem_research
token_name = novem-python-computer-vgjaa1tb
token = <REMOVED>
Whilst the username and profile name can be the same, this is not mandatory.
Appendix
For an updated list of commands available on the cli version you have just use the -h
or --help
options.
usage: novem [-h] [--api_url API_URL] [--profile_name PROFILE_NAME]
[--token TOKEN] [--init] [--token_name TOKEN_NAME] [--force]
Novem commandline interface.
optional arguments:
-h, --help show this help message and exit
general:
--api_url API_URL api url to use, defaul is https://api.novem.no
--profile_name PROFILE_NAME
Which profile to use, combine with --init to setup a new
profile
--token TOKEN Use this token instead, overrides profile lookup
setup:
--init authenticate with the novem service and create default
configuration
--token_name TOKEN_NAME
name of token (lowercase alphanumeric, no whitespace)
--force force reinit of existing profile