◐ Shell
clean mode source ↗

Async support? · gitpython-developers/GitPython · Discussion #1330

I have no idea how much work would be required to implement this, but it'd be awesome to be able to

await Repo.clone_from(url, path)

(or something similar -- it's not the end of the world if it has to be a separate method):

await Repo.async_clone_from(url, path)

I just read the blurb about the status of this project, so totally get that this would only be unlikely to be implemented without an enterprising contributor.

I googled my way to asyncio.create_subprocess_exec, so it's definitely possible, but it seems like it'd be a ton of work to maintain async and non-async interfaces for everything, so I could understand if you'd rather not accept this as a contribution

You must be logged in to vote

I googled my way to asyncio.create_subprocess_exec, so it's definitely possible, but it seems like it'd be a ton of work to maintain async and non-async interfaces for everything, so I could understand if you'd rather not accept this as a contribution

Thanks for bringing this up - there is no doubt a use for this in async codebases, but the cost of maintaining that seems too high even with such an enterprising contributor.

If there is some potential in this regard, are there ways in python to 'asyncify` otherwise blocking code to make it flow better in async code bases or make it more composable? If so, this might be wroth a contribution to the documentation along the lines of 'GitPython and async'.

You must be logged in to vote

0 replies

the cost of maintaining that seems too high

@Byron Can you elaborate on that? This seems like an ideal library for async as it's very io bound and synchronous functions can call async functions, so (as I understand it) it wouldn't be a matter of maintaining both, just porting all the io to async calls.

You must be logged in to vote

2 replies

@Byron

Since GitPython is in maintenance mode, making such a breaking change is nothing that I'd include in the timeline, only bugfixes are made along with the occasional contributed feature.

Thanks for your understanding.

@lionel-panhaleux

@ahonnecke can I suggest using asgiref?

await asgiref.sync.SyncToAsync(git.Repo.clone_from)(url, path)

I this work for you, it looks to me like this could be a simple doc contribution.