How can I build a version-aware API router in Python using decorators?

Hi all,

I’m trying to build an API framework in Python that supports version-based routing like:

  • /v1/customers
  • /v2/customers

I want to use decorators to mark each function with its version and endpoint, like:

@route("/customers", version=1)
def get_customers_v1():
    ...

@route("/customers", version=2)
def get_customers_v2():
    ...
@route("/customers", version=1)
def get_customers_v1():