The PEtab importer ignores a problem.yaml extension marked `required: true`, where the PEtab v2 spec says a tool that does not support it must reject the problem

Abierto
#957 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
76/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
backend

Línea de trabajo

Start in pybnf/petab/import_.py at read_problem_yaml (around lines 1429-1430, 1437, 1527, and 1579), then follow import_job around lines 244-245. Reproduce the with_ext and no_ext imports from the issue and compare their output. Done means a required unsupported extension is rejected with its name, while an extension marked required: false is ignored with a note.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug silent-incorrectness

A PEtab v2 problem.yaml can list extensions under an extensions: key. An extension marked required: true is one that "changes the mathematical interpretation" of the problem. For example, the SciML extension replaces part of the model with a neural network. The spec says: "Toolboxes must reject PEtab problems that use extensions with required: true that they do not support." PyBNF supports no extensions. Even so, its importer skips the whole extensions: block without a message and writes the same job it writes when the block is deleted. The user then fits a different problem from the one the file declares and is never told. PyBNF should refuse such a problem and name the extension.

Example

Take any PEtab v2 problem that PyBNF imports. For example, use a BNGL model m.bngl with 0 -> A() v3 and A() -> 0 k, one observable obsA = A, and a parameters table that estimates k. Append this to its problem.yaml:

extensions:
  my_ext:
    version: 1.0.0
    required: true

Then import it twice, once with the block and once without:

from pybnf.petab import import_job
import_job('with_ext/problem.yaml', 'imp_ext')
import_job('no_ext/problem.yaml', 'imp_noext')

Both calls return without printing anything, and diff -r imp_ext imp_noext finds no difference. A SciML-shaped block (sciml: with version, required: true, neural_networks:, hybridization_files: and array_files:) also gives output identical to the problem without it.

What PyBNF should do comes from the spec's Extensions section (petab.readthedocs.io, v2 data format), quoted above. The problem YAML schema defines required as whether "the extension is required for the mathematical interpretation of the problem". libpetab is a validator, not a simulator, so the rule does not bind it, but it does report the block. petab.v2.Problem.from_yaml records extensions: {'my_ext': ExtensionConfig(version='1.0.0', required=True)}, and lint_problem warns: The given problem uses the following extensions for which validation is not yet implemented: my_ext.

Why

read_problem_yaml (pybnf/petab/import_.py:1437) parses the file by hand. Since #902 it refuses any top-level key that the PEtab v2 schema does not allow. It accepts extensions as one of the allowed keys, with the comment "id and extensions carry nothing the importer reads" (import_.py:1429-1430). The key sets in_other (import_.py:1527), and every indented line beneath it is then skipped (import_.py:1579). import_job (import_.py:244-245) goes straight from this reader to the model-language check, so nothing records or checks an extension or its required flag.

Possible fix

In read_problem_yaml, record each entry under extensions: with its required value. In import_job, refuse any extension whose required is not literally false, naming the extension and quoting the spec's rule. The spec lets a tool ignore an extension with required: false, so for those a one-line note that PyBNF ignores it is enough.

Related: #902 (which rewrote this reader)

Found while fixing the PEtab issues #892–#908 (2026-09-25); reproduced on main at cd2be675.

Lenguaje dominante
Python
Estrellas
25
Forks
25
Merge medio
4 h 5 min
PR fusionados (30 d)
10

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de lanl/PyBNF

Todos los issues de lanl/PyBNF

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.