Skip to content

CLI is broken #207

@jdebacker

Description

@jdebacker

@martinholmer Reports the following:

Tax-Brain CLI does not work

After installing Tax-Brain, I get the help message OK, but then get these errors:

(taxcalc-dev) behavioral_responses_tests> taxbrain --help     
usage: taxbrain [-h] [--data DATA] [--reform REFORM] [--behavior BEHAVIOR] [--assump ASSUMP] [--baseline BASELINE]
                [--outdir OUTDIR] [--name NAME] [--report] [--author AUTHOR]
                startyear endyear

This is the command line interface for the taxbrain package.

positional arguments:
  startyear            startyear is the first year of the analysis you want to run.
  endyear              endyear is the last year of the analysis you want to run.

options:
  -h, --help           show this help message and exit
  --data DATA          The file path to a micro-dataset that is formatted for use in Tax-Calculator.
  --reform REFORM      --reform should be a path to a JSON file.
  --behavior BEHAVIOR  --behavior should be a path to a JSON file containing behavioral assumptions.
  --assump ASSUMP      --assump should be a path to a JSON file containing user specified economic assumptions.
  --baseline BASELINE  --baseline should be a path to a JSON file containing a policy that will be used as the baseline
                       of the analysis
  --outdir OUTDIR      outdir is the name of the output directory. Not including --outdir will result in files being
                       written to the current directory.
  --name NAME          Name of the analysis. This will be used to name the directory where all output files will be
                       written.
  --report             including --report will trigger the creation of a PDF report summarizing the effects of the tax
                       policy being modeled.
  --author AUTHOR      If you are creating a report, this the name that will be listed as the author

(taxcalc-dev) behavioral_responses_tests> taxbrain 2035 2035 --data cps.csv --reform ref.json --behavior br1.json 
Traceback (most recent call last):
  File "/opt/anaconda3/envs/taxcalc-dev/bin/taxbrain", line 7, in <module>
    sys.exit(cli_main())
             ~~~~~~~~^^
  File "/opt/anaconda3/envs/taxcalc-dev/lib/python3.13/site-packages/taxbrain/cli.py", line 227, in cli_main
    args.usecps,
    ^^^^^^^^^^^
AttributeError: 'Namespace' object has no attribute 'usecps'

At a minimum, the args.usecps on line 227 of cli.py should be removed.

But tests should be written to cover this use case so that such an error is not introduced.

There also may need to be other changes to the Python and CLI to pass data objects to more recent version of Tax-Calculator correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions