this post was submitted on 07 Jun 2024
22 points (89.3% liked)

Python

6368 readers
7 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

๐Ÿ“… Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

๐Ÿ Python project:
๐Ÿ’“ Python Community:
โœจ Python Ecosystem:
๐ŸŒŒ Fediverse
Communities
Projects
Feeds

founded 1 year ago
MODERATORS
 

I happen to write a lot of python code dealing with git repositories. Currently I am calling the git command line tool from python and interpret the output.

This solution really doesn't scale well. Can you recommend a python library that wraps git functionality?

I have found three:

  • GitPython: Seems to work well, but it is in maintenance mode, unlikely to be improved. It also does not have any type hints making working with it annoying.
  • pygit2: Seems well supported and has type hints. But it also seems very low level and pretty tedious to use.
  • dulwich: Looks very promising feature wise but I'm unsure how well it is supported. It seems like an ambitious project being largely done by just one person.
you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 1 points 5 months ago (3 children)

Honestly if you already know all the git commands? Iโ€™d use sh

[โ€“] [email protected] 6 points 5 months ago (1 children)

You'd still only get strings as returns. No objects modeling git concepts.

[โ€“] [email protected] 1 points 5 months ago* (last edited 5 months ago)

Fair point, I usually use exit codes

load more comments (1 replies)