PEtab-dev / PEtab-dev/libpetab-python

Improve error handling in Problem.from_yaml - parameter_file

Open
#218 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
18
Forks
9
PR merge metrics
No merged PRs in 30d

Description

Missing parameter_file in the yaml file should provide a proper error message instead of just a KeyError:

File petab/problem.py:259, in Problem.from_yaml(yaml_config)
    255     warn("Support for PEtab2.0 is experimental!")
    257 problem0 = yaml_config['problems'][0]
--> 259 if isinstance(yaml_config[PARAMETER_FILE], list):
    260     parameter_df = parameters.get_parameter_df([
    261         get_path(f)
    262         for f in yaml_config[PARAMETER_FILE]
    263     ])
    264 else:

KeyError: 'parameter_file'

Also applies to sbml_files in --> 270 if len(problem0[SBML_FILES]) > 1:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read Problem.from_yaml in petab/problem.py at the parameter_file and sbml_files accesses. Check the surrounding YAML parsing behavior, then exercise inputs missing each key and verify they produce clear errors rather than raw KeyError exceptions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.