-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Other project zest.releaser hooks pollute my own release workflow #168
Comments
One more thing: I found out because astropy hook failed. This might be happening for other people as well and something they are not aware might be running while they release. |
Well, hooks can be global or local. Both can be valid use cases and are supported.
The only thing that makes a hook local, is such a check on I don't know zest.releaser/zest/releaser/utils.py Line 645 in 8c7489a
|
Thanks for your response. But is kind of annoying that a package can install a global hook without my consent. If there is no way to limit this, I would like to be able opt-in in my package to use a global hook. |
By the way, astropy comes with anaconda. So a lot of Python users might be having this problem. |
I've opened a ticket for astropy itself with @mauritsvanrees' tip included: astropy/astropy#4633 It is my guess, too, that the problem should be fixed there. |
Thanks for looking into this but please consider rethinking the strategy in zest releaser. I think is utterly broken that a project with a bad hook can make my zest installation unusable. I think it would be better if projects can install and a advertise global hooks, but you need to opt-in for them. |
I don't think I want to switch to an opt-in mechanism. Most of the hooks I've seen in use are intended to be used for all projects. If the user installs them, the user intends them to be used. Otherwise you have to add code/configuration to every single project. But you are probably right that it is broken if a bad hook can make everything unusable. @mauritsvanrees, what about a bare try/except around hooks that catch everything? It won't help against already-mis-modified data, but at least it'll help when they error on something. Would that be safe to do? Or are there other consequences? Are there hooks that depend on exceptions bubbling up? |
That is exactly the point; a user install a package to use the package itself, not necessarily package zest releaser hooks. The hooks are not advertised nor the user is able to pip install the package without them. I like the opt-in idea. I think that it could be done easily in the setup.cfg or at least asking during the release process as it is done for pyroma. (It is different with things like pyroma since that package purpose is to help you with the release process) |
And my point is two-fold:
Removing global hook support because there's a bug in one package: I think there'll be a lot of outcry if we were to do that :-) |
If you do not agree to opt-in for global hook, how about this:
In that file, functions should be named according to the hook you want to call. For example: def prereleaser_middle(data):
# do something here Another reason for this is that the release related code does not need to be inside your package. What sounds wrong to me is that a project need to add this to make it local. if data['name'] != 'my.package':
return Local should be the default for a hook, global should require more code. |
Local file instead of the existing hooks: no. Way too much work and I don't want to turn that into a completely different mechanism. The The "if data" trick is a very small thing you have to add. Now that the issue cropped up, in hindsight, a You seem to be intent on getting rid of global hooks and you think they're bad and evil. To put your problem into perspective:
So, to me it looks like a relatively isolated case. It isn't worth breaking many existing packages by making backwards-incompatible changes. (It is worth making some fixes in zest.releaser, of course :-) ) |
It is not that the data trick is big or small: is just that I think that the case with more consequences should require more code. I think that the worst effect is actually a package tampering with my release process. But in any case, thanks for taking the time for reading and answering. And most importantly for your time in this very useful package. |
I still think the best is for you to create a virtualenv for zest.releaser with only the extra packages that you want. All should work fine then. I agree with Reinout. At least ninety percent of the hooks I use are global hooks, meant for every package. I happily use them. It is seldom that I see a local one. We are going to keep that. Whatever we do, hooks that are currently operating globally, will not be switched off without any action by the user. But we can think of adding command line or config options. Something like Doing a try/except seems fine too. We are currently not checking a return value or catching any exceptions. When a hook currently raises an exception, it bubbles up and the script quits. When we start catching this, that is a relatively big change, but seems safe and good to me. When we catch an error, we should print the traceback, so the add-on author has a chance to see what goes wrong. And we should then ask the user if she wants to continue or quit. (Or possibly retry the hook, we have code for that.) Maybe an option Any chance that you could work on a pull request for the |
I will look into it and let you know |
They fixed it in astropy: astropy/astropy#4650 It should end up in future releases. Apparently there are several entry points and all the other ones already had the The |
Not sure if I should open a new report... here goes my problem: I made freitag.releaser, a wrapper around plone.releaser (which in turn is a wrapper around zest.releaser, yay!) So plone.releaser installs quite a lot of entry points, which are fine and must be global for plone's purpose but that are getting on the way of my workflow with freitag.releaser. So could there be a way to disable and/or override them? Right now I just forked plone.releaser and removed the entry points. |
Yeah, this has come up a few times, see also #173. That one is more focused, so I will add an idea there. |
Something very weird happened when I was releasing my own project (not related with astropy):
It seems that astropy's zest releaser hook is polluting my own release workflow. There is something very wrong about this
The text was updated successfully, but these errors were encountered: