This one works with the gitpython library:
from git import Repo repo = Repo('https://github.com/readme') repo_tags = repo.git.ls_remote("--tags",'https://github.com/readme',sort='-v:refname') print(rr.split('\n')[0].split('/')[-1])