Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

v2: writing a problem reformats all math expressions, including unchanged ones

Ouverte
#548 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
1-2 jours
Accessibilité débutants
30/100
Type d'issue
Refactorisation
Clarté
Plutôt claire
Activité
Active
Stack technique
python
Domaine
data

Piste de recherche

Start with how sympify_petab parses expressions on load and how to_df writes them back via petab_math_str in the petab.v2 modules. The proposed fix needs a decision on storing the original string on the expression model, which is a design question for maintainers before any code. Done means an unchanged formula round-trips to its original text, while a changed expression is still printed from sympy.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

In petab.v2, math expressions (observable and noise formulas, condition target values, observable/noise parameter overrides) are stored as sympy expressions, parsed with sympify_petab on load. On writing, to_df prints them with petab_math_str; the original string is not kept. Therefore, loading and writing a problem rewrites every expression, changed or not:

Input Written back
a - (b - c) a - b + c
(100*pApB + 200*pApA)/2 100*pApA + 50*pApB
2 * x / 3 0.6666666666666666*x
log10(x) log(x)/log(10)

The results are mathematically equivalent, but this makes diffs between original and written problems hard to read. E.g., when converting PEtab v1 problems to v2 and writing them, actual changes (like reparametrized noise formulas) are mixed with reformatting of unchanged formulas.

Possible approach: when parsing a string, also store the original string (e.g., as a pydantic private attribute), and write it in to_df if the expression is still equal to the parsed one; otherwise, print the expression. This keeps the current API.

Alternatives considered:

  • Storing strings and deriving sympy expressions on demand: breaks the current API.
  • Parsing with evaluate=False: reduces, but does not prevent, reformatting, and changes the expressions returned to users.

🤖 Drafted with AI assistance.

Langage dominant
Python
Étoiles
18
Forks
9
Merge moyen
2 j 4 h
PR mergées (30 j)
30

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de PEtab-dev/libpetab-python

Toutes les issues de PEtab-dev/libpetab-python

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.