Skip to content

get rid of the parse dependency? #206

@mathause

Description

@mathause

We use the r1chardj0n3s/parse library to retrieve the placeholders out of the path. When I wrote this library I looked for functionality that does the inverse from f-strings and parse offered exactly this & has therefore been very helpful. It does the parsing by constructing regular expressions that are then matched against the path. However, there are 3 limitations:

  1. it offers format specifiers that are not invertible
  1. placeholders cannot be empty
  1. it's not typed

We could try to remove our dependency on parse and write out our own parsing functions/ regexes. We could also vendor and adapt it (it's under a MIT license). This could allow to overcome the issues above. We would need to think very much about which format specifiers are needed for paths.

Disadvantages:

  • overall it works well the way it is now
  • it would be quite some work
  • a lot of thought went into the regexes - can we really do better (we might)

Alternatives:

  1. restrict the allowed format specifiers
  2. could allow custom types (but probably not a nice API)
  3. not a real problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions