Skip to content

ParSet Refactor#2097

Open
kbwestfall wants to merge 62 commits intopypeit:developfrom
kbwestfall:parset_refactor
Open

ParSet Refactor#2097
kbwestfall wants to merge 62 commits intopypeit:developfrom
kbwestfall:parset_refactor

Conversation

@kbwestfall
Copy link
Copy Markdown
Collaborator

@kbwestfall kbwestfall commented Mar 31, 2026

This is a major refactor of the ParSet base class.

Many files are touched but the primary changes are in pypeit/par/parset.py and pypeit/par/pypeitpar.py. Branches that include changes to these files will likely have significant conflicts. I apologize for the headaches, and I'm happy to help with merges. Beyond those two files, the refactor is virtually invisible to the rest of the code, only requiring some changes to imports and some auto-generated doc scripts.

The main accomplishment of this PR is that it dramatically cleans up and streamlines the construction of ParSet subclasses. Instead of defining the parameters based on the combination of the call sequence of the __init__ function and the subsequent body of the function, everything is defined as part of a dictionary class attribute called parameters. This allows the refactored ParSet class to handle everything except the definition of those parameters and any validation methods. I.e., none of the current ParSet subclasses require a bespoke __init__ function; they all can make do with the base class method.

I used AI to help with this, and a script that compared the old and new versions of the ParSet subclasses (the parameters, types, options, and descriptions). After the initial refactor, in which I explicitly made both the old and new subclasses identical, I edited all of the descriptions. Most of this was to ensure a fixed line length, but I also edited the content of some.

All the unit tests pass, and I'll set the dev-suite going now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant