PEtab-dev / PEtab-dev/libpetab-python

Improve error handling in Problem.from_yaml - format_version

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

Nobody has claimed this yet.

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

Description

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

--> 250 if yaml_config[FORMAT_VERSION] not in {"1", 1, "1.0.0", "2.0.0"}:
    251     raise ValueError("Provided PEtab files are of unsupported version "
    252                      f"{yaml_config[FORMAT_VERSION]}. Expected "
    253                      f"{format_version.__format_version__}.")
    254 if yaml_config[FORMAT_VERSION] == "2.0.0":

KeyError: 'format_version'

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

Start at the Problem.from_yaml entry point and reproduce the failure with a YAML file missing format_version. Trace the existing version validation and error handling, then make the missing field produce a proper error instead of KeyError; done means the reported case has a clear error and the relevant checks pass.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.