Command Line Interface

While most of the pyirk usage wil come from actual python code, pyirk also provides a rich command line interface (CLI) which can be used for introspection purposes (visualization) or interactive usage.

Visualization

Currently there is some basic visualization support via the command line. To visualize your a module (including its relations to the builtin_entities) you can use a command like

pyirk --load-mod demo-module.py demo -vis __all__

Interactive Usage

To open an IPython shell with a loaded module run e.g.

pyirk -i -l control_theory1.py ct

Then, you have ct as variable in your namespace and can e.g. run print(ct.I5167.R1).

(The above command assumes that the file control_theory1.py is in your current working directory.)

Manpage

For an overview of available command line options, execute the command:

pyirk -h

command line interface to IRK (imperative representation of knowledge)

usage: pyirk [-h] [-nk NUMBER_OF_NEW_KEYS] [-l MOD_PATH PREFIX]
             [-lp PACKAGE_TOML_PATH] [-rwd] [-pad path] [-grp reportconf-path]
             [-vis uri] [-i] [-dj] [-djs] [-ac] [-ik path_to_mod]
             [-utd path_to_irk_package] [--dbg] [--version]
             [inputfile]

Positional Arguments

inputfile

input file

Named Arguments

-nk, --new-keys

generate new keys

-l, --load-mod

load module (.py file) from path with prefix.

-lp, --load-package

load irk package (represented by irkpackage.toml file)

-rwd, --relative-to-workdir

DEPRECATED; specifies that the module path is interpreted relative to working dir (not the modules install path)

Default: False

-pad, --parse-ackrep-data

parse ackrep data repository, create items and relations. specify path to ackrep_data base dir (…/ackrep_data)

-grp, --generate-report

generate report based on configuration file (e.g. reportconf.toml)

-vis, --visualize

create a visualization for the entity

-i, --interactive-session

start an interactive session (with the specified module/package loaded)

Default: False

-dj, --start-django

start the django server from the current directory

Default: False

-djs, --start-django-shell

start the django shell from the current directory (mainly useful for development)

Default: False

-ac, --create-autocomplete-candidates

create a file with autocomplete candidates in the current workdir

Default: False

-ik, --insert-keys-for-placeholders

replace `_newitemkey_ = ` with appropriate short keys

-utd, --update-test-data

create a subset of the irkpackage (e.g. OCSE) and store it in the test_data dir of pyirk-core

--dbg

start debug routine

--version

print the version and exit

Default: False