Include parameter descriptions as comments in generate-config's output

Aperta
#433 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
58/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
python
Ambito
cli, documentation

Direzione di ricerca

Start by locating the generate-config implementation and the init-project path that calls generate_config(), then inspect pipeline-class docstrings such as pyopia.process.Segment for parameter descriptions. The work will involve preserving those descriptions while writing TOML comments, so identify the relevant configuration-generation tests or add coverage for the generated config.toml. Done means generated configuration files contain a description comment above each parameter sourced from the corresponding docstring.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

patch / enhancement

generate-config (and init-project, which calls it) builds a plain Python dict and dumps it via toml.dump(), so the resulting config.toml has no comments at all - every step's parameters are just bare key = value lines, even though the corresponding pipeline classes already have real per-parameter descriptions in their own docstrings (e.g. pyopia.process.Segment's numpydoc Parameters section).

Found this building pyopia-gui's Configuration tab, which shows each step's parameters with these descriptions - it works by introspecting the classes' docstrings itself at runtime (inspect.signature + parsing the Parameters section), so this isn't blocking pyopia-gui specifically. But anyone editing a generated config.toml by hand, outside pyopia-gui, currently gets no hint of what any parameter does or what values are valid, even though PyOPIA's own docstrings already have that information.

Would be a nice, low-risk improvement if generate-config's output included each parameter's description as a comment above it, sourced from the same docstrings - e.g.:

[steps.segmentation]
pipeline_class = 'pyopia.process.Segment'
# threshold for segmentation. Defaults to 0.98.
threshold = 0.98

Since generate_config() currently builds a plain dict before toml.dump(), this would need moving to something that writes TOML directly (or post-processing the dumped text to insert comments) rather than round-tripping through a dict - a bit more work than a one-line change, but the underlying descriptions already exist in docstrings PyOPIA already maintains, so it's not new documentation to write.

Lingua principale
Jupyter Notebook
Stelle
19
Fork
7
Merge medio
10g 11h
PR unite (30g)
1

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di SINTEF/pyopia

Tutte le issue di SINTEF/pyopia

Issue simili

Altre issue su CLI

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.