Hi.
The short answer is: you can't. Cypher does not accept a variable in all places. Constraint names is one of them.
The long answer is: you can work around this by using string interpolation/concatenation. But you have to be really careful not to make your application vulnerable to query injection.
Here is some documentation that should help you get started https://neo4j.com/docs/python-manual/current/query-advanced/#_dynamic_values_in_property_keys_relationship_types_and_labels