Skip to content

Automate ABNF to python namespace patterns #899

Closed

Description

@ahouseholder

In #898, we added a new ABNF file src/ssvc/utils/ssvc_namespace_pattern.abnf
that was used to generate the namespace regex patterns in src/ssvc/utils/patterns.py. However, this conversion was a one-shot static event.

I'd like us to be able to dynamically read the .abnf file and have that populate the items in patterns.py automatically at run time. I believe this is possible using library methods from abnf-to-regex.

Activity

  1. added this to the 2025-09 milestone on Aug 21, 2025
  2. added
    integrationRelated to integration of SSVC into another framework or system
    on Aug 26, 2025
  3. removed this from the 2025-09 milestone on Sep 9, 2025
  4. bernhardreiter commented on Sep 17, 2025

    @bernhardreiter
    Contributor

    Added eclipse-aascw/abnf-to-regexp#44 to fix the repetition regex difference in upstream first.

  5. bernhardreiter commented on Feb 19, 2026

    @bernhardreiter
    Contributor

    Meanwhile https://github.com/aas-core-works/abnf-to-regexp/releases/tag/v1.2.0 has what we need, so I'll prepare a merge request.

  6. bernhardreiter commented on Feb 19, 2026

    @bernhardreiter
    Contributor

    I'd like us to be able to dynamically read the .abnf file and have that populate the items in patterns.py automatically at run time.

    Do you prefer to read the .abnf file each time at runtime?
    (As opposed to have a "make regenerate" step that creates the .py file.)

    I believe this is possible using library methods from abnf-to-regex.

    Looking at https://github.com/aas-core-works/abnf-to-regexp/blob/1fc56a6a93c0aa777f641828788595535dbbba94/abnf_to_regexp/main.py#L48 and deeper, it seems that abpf-to-regexp does not offer library functions that return the generated patterns. It generates strings. In order to get this into the code dynamically would mean to exec() them in python.

    The parsing and exec() step in runtime will add an overhead to the startup time of ssvc.

    Instead a classic Makefile rule could be used that creates a new abnf_pattern.py file each time the source .abnf file has been changed.

  7. added a commit that references this issue on Feb 19, 2026
    d072c7b
  8. bernhardreiter commented on Feb 19, 2026

    @bernhardreiter
    Contributor

    See #1065 for the Makefile based approach.

  9. added a commit that references this issue on Feb 20, 2026
    289719b
  10. bernhardreiter commented on Feb 20, 2026

    @bernhardreiter
    Contributor

    to get this into the code dynamically would mean to exec() them in python.

    But it can be done. See #1067 for the runtime parsing approach.
    Chose the one you prefer.

  11. added this to the 2026-03 milestone on Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    integrationRelated to integration of SSVC into another framework or system

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions