Using the command-line interface#

Use the policyengine-core command-line tool to run tests or manage data without writing Python code.

usage: policyengine-core [-h] {test,data} ...

Positional Arguments#

command

Possible choices: test, data

Available commands

Sub-commands#

test#

Run OpenFisca YAML tests

policyengine-core test [-h] [-c COUNTRY_PACKAGE] [-e [EXTENSIONS ...]]
                       [-r [REFORMS ...]] [-n NAME_FILTER] [-p]
                       [--performance-graph] [--performance-tables] [-v] [-a]
                       [-d MAX_DEPTH] [-o [ONLY_VARIABLES ...]]
                       [-i [IGNORE_VARIABLES ...]]
                       path [path ...]

Positional Arguments#

path

paths (files or directories) of tests to execute

Named Arguments#

-c, --country-package

country package to use. If not provided, an automatic detection will be attempted by scanning the python packages installed in your environment which name contains the word “policyengine”.

-e, --extensions

extensions to load

-r, --reforms

reforms to apply to the country package

-n, --name_filter

partial name of tests to execute. Only tests with the given name_filter in their name, file name, or keywords will be run.

-p, --pdb

drop into debugger on failures or errors

Default: False

--performance-graph, --performance

output a performance graph in a ‘performance_graph.html’ file

Default: False

--performance-tables

output performance CSV tables

Default: False

-v, --verbose

increase output verbosity. If specified, output the entire calculation trace.

Default: False

-a, --aggregate

increase output verbosity to aggregate. If specified, output the avg, max, and min values of the calculation trace. This flag has no effect without –verbose.

Default: False

-d, --max-depth

set maximal verbosity depth. If specified, output the calculation trace up to the provided depth. This flag has no effect without –verbose.

-o, --only-variables

variables to test. If specified, only test the given variables.

-i, --ignore-variables

variables to ignore. If specified, do not test the given variables.

data#

Manage OpenFisca data

policyengine-core data [-h] [-c COUNTRY_PACKAGE]
                       dataset {generate,download,upload,remove,list}

Positional Arguments#

dataset

The dataset to focus on.

action

Possible choices: generate, download, upload, remove, list

The action to perform. Pass any additional options as keyword arguments.

Named Arguments#

-c, --country-package

country package to use. If not provided, an automatic detection will be attempted by scanning the python packages installed in your environment which name contains the word “policyengine”.

Hint

To list all the datasets for a country package, use policyengine-core data datasets list, passing in a country package as needed.