It could be solved with a hand-written recursive-descent parser for PEP 508. I don’t think the grammar is too bad; honestly the URL parsing bit is way more than what PEP 508 introduces.
Not that I’m specifically volunteering to write said parser.
I think this ties into Adding a default extra_require environment.