Skip to content

Add shorthand syntax to simplify user configs#253

Open
TimothyWillard wants to merge 1 commit intomainfrom
shorthand-configs
Open

Add shorthand syntax to simplify user configs#253
TimothyWillard wants to merge 1 commit intomainfrom
shorthand-configs

Conversation

@TimothyWillard
Copy link
Copy Markdown
Collaborator

Description

Added the ability for flepimop2 to parse shorthand syntax form modules
that easy to specify in a single line with few arguments. In a
configuration file this looks like the user specifying the module model
as a string. For example:

parameter:
  beta: fixed(0.3)

The initial portion of the string, 'fixed', identifies the module to
load and the contents between the parens are pased to from_shorthand
class method (if implemented) to parse into a well formed module.

  • Updated build functions to accept strings, by default
    flepimop2._utils._module._build handles this by defering to the
    from_shorthand classmethod of the requested module.
  • Added shorthand syntax for FixedParameter for user convenience.
  • Removed the default module from the flepimop2.*.abc.build helpers,
    instead requiring that users either use shorthand syntax or specify a
    'module' explicitly.

Related issues

Closes #14, closes #100.

Checklist

  • I have read through and understand the pull request process.
  • I ran successfully ran CI local via just ci.
  • I have updated the CHANGELOG.md or noted "no major changes" in my commit if the PR is small.

Added the ability for `flepimop2` to parse shorthand syntax form modules
that easy to specify in a single line with few arguments. In a
configuration file this looks like the user specifying the module model
as a string. For example:

```yaml
parameter:
  beta: fixed(0.3)
```

The initial portion of the string, 'fixed', identifies the module to
load and the contents between the parens are pased to `from_shorthand`
class method (if implemented) to parse into a well formed module.

- Updated build functions to accept strings, by default
  `flepimop2._utils._module._build` handles this by defering to the
  `from_shorthand` classmethod of the requested module.
- Added shorthand syntax for `FixedParameter` for user convenience.
- Removed the default module from the `flepimop2.*.abc.build` helpers,
  instead requiring that users either use shorthand syntax or specify a
  'module' explicitly.

Closes #14, closes #100.
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.

Restore parameter: value syntax for fixed parameters Syntactical sugar for "simplified configs" with one or few modules

1 participant