We have benefited from the magic of pants in a pyt...
# general
p
We have benefited from the magic of pants in a python monorepo, but now I'm trying to work out how to trigger releases with release-please and I'm a bit stuck. tl;dr any docs on how to use release-please with apps in a monorepo where dependencies are not versioned would be very helpful please. The long story We have apps under
src/
and libraries under
libs/
, and 3rd party dependencies under
3rdparty/
using a lockfile. Different apps under src use different libraries, and
pants dependencies src/appname
finds the right dependencies without specifying them manually in the
BUILD
file for the appname.
pants package src/appname
pulls all of this together wonderfully and we get unbloated pex files for each app without any dependencies not used by that app. Wonderful I hear you say - that sounds excellent. And it is. Mostly. We release apps under
src/
using release-please. This works if files are changed in
src/appname
. But if we update a dependency that
src/appname
uses, release-please doesn't know this and doesn't bump the app. We want to avoid versioning and packaging our libraries if we can avoid it, largely to force everything to move in lockstep and not have to maintain multiple libraries. We know this won't scale, but this works for us for now. I have an 😈 solution that I'd prefer to avoid that touches a file in
src/appname
in a workflow and commits it with a
chore(deps)
conventional commit message, but that feels icky so I'm interested in hearing how smarter people than me do this please.
p
I'm not sure if you can find something automatic, but a simple script/workflow would do the job I think. Assuming that the script is triggered after a merge to main branch, you have to: • lists files changed between HEAD of the main and HEAD~1 • for each app, lists the dependencies (with --transitive) • compare dependencies with changed files; if there is an overlap, you release that app. What we do is we tag the whole repo instead (eg. app-name-vA.B.C) and then have a separate job that detects new tags and packages related app...
p
Thanks for that ... That's what I was considering as my evil plan. It got a little more complex before it was done because simply triggering release-please didn't see changes so didn't release.
We've ended up with a python script that runs in a workflow, that if dep has updated, a bump is made to
.release-trigger.txt
and committed - commit messages are taken from the dependencies that were updated
šŸ‘ 1
Just need to make it find the right changes for 3rd party deps now šŸ˜ž
p
ah, good point; I think you will only see lockfiles changed in version control, so that's impossible to detect šŸ˜•
p
requirements.txt gets updated as well. But everything uses that. So it's a challenge to see which libs changed and update based on them only