-
-
Notifications
You must be signed in to change notification settings - Fork 402
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
Automatic reloading of PyFilePlugin
s
#871
Comments
I don't think it's a good idea, it would cause too much reloading when I'm working on a module with auto-saving enabled... |
@elad661 That's why it would be enabled by a config flag. |
I'd prefer an option to the command, but yeah. It would be optional. |
I wonder if a Like, |
Or just I'm not against adding a new command-line flag, either. Maybe Sopel could support a Alternatively (or additionally), |
This conversation reminds me that I wish #1429 and #1434 to be merge before working again on the That's why, even though I'm not against a |
@dgw after further consideration, I don't think it's reasonable to plan this for Sopel 7.0, and probably not for the Sopel 7.x branch anyway. I'd suggest to remove the milestone for now. |
Mm, implementing this was predicated on fixing the issues with reloading. And we've had this discussion several times now—we can't properly fix reloading until we at minimum no longer support old versions of Python (2.7, 3.3) that don't support the internal machinery needed for better reloading support. There might be other things we need to do, too. It's interesting that you revived this particular issue today, because I was just working on a new feature for our Twitter plugin and had reloading issues. That is, telling Sopel to reload it didn't work. Obviously #1056 is still a problem. I should just bump its milestone along with this issue's, since they both ultimately depend on better reload machinery. What does work right now (mostly) is reloading single-file plugins, i.e. |
PyFilePlugin
s
Agreed with @Exirel. We'll leave this for after we drop old Python versions, in 8.0, when we'll have guaranteed access to some better reloading machinery from more recent Pythons. |
I'm thinking about this feature, and I think we could drop it from any milestone, and just left it here for anyone to pick and grind their teeth on. From my perspective, this is a lot of work for very little reward, and I'd rather focus on other things for now. After all, it's a feature from 2015, and I'm not even sure it is still valid, even more now with the built-in pytest plugin with all the fixtures that make live testing less necessary. |
I imagine this still would be useful while prototyping stuff. Not everyone starts right in on a full package with tests when creating a new plugin. We'll likely never eliminate the utility of directly reloading files. As far as the amount of work required, how about this proposal using a library (so no need for us to maintain file-watch code):
Without having gone too deep on this just yet, I think this would require only having an event handler function that can map the path to a plugin loaded by the bot, and setting up the Observer during startup if the option is enabled. (Cue reasons why it's not "only", i.e. not that simple. 😅) |
I agree, and that's why I suggest that we remove the milestone, because I don't think it is worth it for version 8.0 per say. Nothing new is planned on the plugin system for the foreseeable future, so I guess any version will do. |
I suppose it should be enabled by a config flag, since this is mostly useful for developing and testing new modules, but not very useful in production when modules are assumed to be stable.
Maintainer note: We should only support auto-reloading single-file plugins. Not even manually reloading package or entrypoint plugins works properly, so they definitely cannot be auto-reloaded. Scope of this feature is to add a config option that enables auto-reload for single-file plugins only.
Jury's still out on whether it should be a Boolean or a list of plugin names. Either, really. There's definitely a case to be made for whitelisting the specific plugins that can be auto-reloaded. — @dgw
The text was updated successfully, but these errors were encountered: