This is not exactly what you asked for, but this is a popular question and more people may need what I needed.
To get the variable's name only, without its value (Python 3.8 and above):
def varname(var_name_from_fstring: str) -> str:
return var_name_from_fstring.split("=", maxsplit=1)[0]
my_variable = "blah"
name = varname(f"{my_variable=}")
print(name)
# Prints "my_variable"