pypa / setuptools-scm

the blessed package to manage your versions by scm tags
https://setuptools-scm.readthedocs.io/en/latest/
MIT License
866 stars 214 forks source link

Calculate distance in a git monorepo just for the current project's path #1056

Open ovidiu-eremia opened 4 months ago

ovidiu-eremia commented 4 months ago

Hello,

I'm trying to use this great tool for versioning different projects in the same git monorepo. Is there a possibility to calculate the distance just for commits done on the current project's path?

Thank you, Ovi

RonnyPfannschmidt commented 4 months ago

that requires a custom git query - gi describe doesnt provide that

a gitpython backend may be able to provide that, but implementation is not on my personal planning horizon

ovidiu-eremia commented 4 months ago

Thank you for your quick reply @RonnyPfannschmidt !

I perfectly understand why this is not on your roadmap, as a monorepo wasn't on mine either :-) but I need to work with it. So, if you could please provide some guidance on where could I plugin this functionality in setuptools_scm and maybe how would that be expected to look like, I'd really appreciate it!

Thanks, Ovi

RonnyPfannschmidt commented 4 months ago

right now we dont have a good extension point to plug this in - it may be necessary to add a functionality to explicitly choose the backend in the configuration and/or a new entrypoint + possibly a ordering mechanism for the entrypoints

a little brainstorming on how to enable this is necessary

also im not opposed to adding this directly into setuptools_scm - a key addition would be reading git Details based on a new plugin

something similar is also needed to deal with parse checkouts

ovidiu-eremia commented 4 months ago

Ok, I don't think I can help you with the brainstorming... :-) So, I suppose I should wait for you to have an idea on what is the best approach on solving this and come back to me with a direction on how should I proceed implementing it?

RonnyPfannschmidt commented 4 months ago

im unlikely to work on this alone - in particular since i dont have a own need and dont want to mess it up

ovidiu-eremia commented 4 months ago

Ok, then I'll try to be the driver of this feature and maybe if you could help me navigating through all the options, please? Should I start by looking into how could I write a plugin just for reading the git details? I guess we'd rather go with something that could be reused also for git sparse checkouts, this is the idea, right?

RonnyPfannschmidt commented 4 months ago

the starting point is a acceptable mechanism for picking a alternate data source then adding one that allows to use a git python binding to calculate the difference per subpart of the monoroep