Switching from pyup to dependabot
Switching from pyup to dependabot
I maintain a bunch of Python-based projects including some major projects like Crash Stats, Mozilla Symbols Server, and Mozilla Location Services. In order to keep up with dependency updates, we used pyup to monitor dependencies in those projects and create GitHub pull requests for updates.
pyup was pretty nice. It would create a single pull request with many dependency updates in it. I could then review the details, wait for CI to test everything, make adjustments as necessary, and then land the pull request and go do other things.
Starting in October of 2019, pyup stopped doing monthly updates. A co-worker of mine tried to contact them to no avail. I don't know what happened. I got tired of waiting for it to start working again.
Since my projects are all on GitHub, we had already switched to GitHub security alerts. Given that, I decided it was time to switch from pyup to dependabot (also owned by GitHub).
Switching from pyup to dependabot
I had to do a bunch of projects, so I ended up with a process along these lines:
-
Remove projects from pyup.
All my projects are either in
mozilla
ormozilla-services
organizations on GitHub.We had a separate service account configure pyup, so I'm not able to make changes to pyup myself.
I had to ask Greg to remove my projects from pyup.
I wouldn't suggest proceeding until your project has been removed from pyup. Otherwise, it's possible you'll get PRs from pyup and dependabot for the same updates.
-
Add dependabot configuration to repo.
Then I added the required dependabot configuration to my repository and removed the pyup configuration.
I used these resources:
configuration documentation https://dependabot.com/docs/config-file/.
configuration validator https://dependabot.com/docs/config-file/validator/.
I created a pull request with these changes, reviewed it, and landed it.
-
Enable dependabot.
For some reason, I couldn't enable dependabot for my projects. I had to ask Greg who I think asked Hal to enable dependabot for my projects.
Once this was done, then dependabot created a plethora of pull requests.
While there are Mozilla-specific bits in here, it's probably generally helpful.
Dealing with incoming pull requests
dependabot isn't as nice as pyup was. It can only update one dependency per PR. That stinks for a bunch of reasons:
working through 30 PRs is extremely time consuming
every time you finish up work on one PR, it triggers dependabot to update the others and that triggers email notifications, CI builds, and a bunch of spam and resource usage
dependencies often depend on each other and need to get updated as a group
Since we hadn't been keeping up with Python dependencies, we ended up with between 20 and 60 pull requests to deal with per repository.
For Antenna, I rebased each PR, reviewed it, and merged it by hand. That took a day to do. It sucked. I can't imagine doing this four times every month.
While working on PRs for Socorro, I hit a case where I needed to update multiple dependencies at the same time. I decided to write a tool that combined pull requests.
Thus was born paul-mclendahand. Using this tool, I can combine pull requests. Using paul-mclendahand, I worked through 20 pull requests for Tecken in about an hour. This saves me tons of time!
My process goes like this:
create a new branch on my laptop based off of the main branch
list all open pull requests by running
pmac listprs
make a list of pull requests to combine into it
-
for each pull request, I:
run
pmac add PR
resolve any cherry-pick conflicts
(optional) rebuild my project and run tests
push the new branch to GitHub
create a pull request
run
pmac prmsg
and copy-and-paste the output as the pull request description
I can then review the pull request. It has links to the other pull requests and the data that dependabot puts together for each update. I can rebase, add additional commits, etc.
When I'm done, I merge it and that's it!
paul-mclendahand v1.0.0
I released paul-mclendahand 1.0.0!
Install it with pipx:
pipx install paul-mclendahand
Install it with pip:
pip install paul-mclendahand
It doesn't just combine pull requests from dependabot--it's general and can work on any pull requests.
If you find any issues, please report them in the issue tracker.
I hope this helps you!