Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul implementation of Parameters #2

Open
6 of 8 tasks
moritz-weber opened this issue Mar 30, 2023 · 0 comments
Open
6 of 8 tasks

Overhaul implementation of Parameters #2

moritz-weber opened this issue Mar 30, 2023 · 0 comments

Comments

@moritz-weber
Copy link
Collaborator

moritz-weber commented Mar 30, 2023

Tasks

  • min, max properties for IntegerParamter and FloatParameter
  • index property for EnumParameter
  • default property (per instance) for all Parameters
  • set_with_boundary() method for IntegerParamter and FloatParameter
  • reset() method for all Parameters
  • Name and String validation: investigate the differences
  • investigate escaping requirements for str values
  • explicit setter for draft variable as value

Rationale

The current interaction with Parameter (get_value and set_value) is very cumbersome for Python. One would expect that

abc = componentx.collectiony.paramz

yields the result directly.
Furthermore, one would expect to set the value of a parameter just like this:

componentx.collectiony.paramz = xyz

instead of with the set_value() method.

However, there are a few features that parameters need to support:

  • min, max values should be respected in setters (for int, float)
  • nice to have: string and name parameters should be distinguishable, including an easy way to apply enumeration to names (if there is any difference between them)
  • draft variables need to be supported → "$XY" has to be evaluated by scanning the draft for matching rtds_draft_var components
    • resolving draft variables could be a method in the Draft class or a method of the Parameter class that takes a dictionary with available draft variables

Thoughts:

  • Parameters don't need their key attribute (this is all handled in the collection).
  • Explicit getters and setters could be hidden via auto-generated properties in collections.
  • BUT: when getting the value of a parameter, we need a way to specify if we want the raw value or the evaluated value (or always return the raw value and check for possible variables in the calling code)
  • Maybe implementing the value as a property would be a viable compromise
  • The from_str option could be implemented as a factory (class) method
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

No branches or pull requests

1 participant