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

Allow inclusion of repeated patterns in support yaml #211

Open
gilesknap opened this issue May 2, 2024 · 1 comment
Open

Allow inclusion of repeated patterns in support yaml #211

gilesknap opened this issue May 2, 2024 · 1 comment
Assignees

Comments

@gilesknap
Copy link
Member

The dls-plc module is an example of why this is needed. It's builder.py translation to dls-plc.ibek.support.yaml comes out at 12000 lines.

This is because there are many arguments relating to interlocks that are repeated in each of the definitions.

If instead we could write those arguments down once and include them then the file would be much more maintainable. We can use yaml references for this purpose. https://medium.com/@kinghuang/docker-compose-anchors-aliases-extensions-a1e4105d70bd

Thus the argument list would become List[Arg | List[Arg]]
And the definitions list would maybe look like:

thing:
  args: &thing_args
    - type: str
      name: P
    - type: str
      name: Q

other_thing:
  args:
    - *thing_args
    - type: str
      name: R

Although maybe we should have a separate top level dictionary item as a peer to 'defs' that declares shared argument lists. Also need to think about whether other things like database declarations and startup script lines would also want to support this kind of thing.

@gilesknap gilesknap self-assigned this May 2, 2024
@gilesknap gilesknap changed the title Allow inclusion of repeated patterns Allow inclusion of repeated patterns in support yaml May 2, 2024
@gilesknap
Copy link
Member Author

in 3.0.0b6 we have radically adjusted the schema in order to support yaml anchors and aliases in args (now called parameters).

I've experimented with the 12000 line dlsPLC and reduced it to around 5000 lines.

Leaving this open as a reminder to complete the translation of dlsPLC and add a test to verify that the aliased form loads in as exactly the same object graph.

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