[MRG+1] Relocate telnetconsole to extensions/ #1524
Conversation
Thanks @Digenis! We need to think about backwards compatiility: say, people disabled Telnet extension using EXTENSIONS option (as shown in the example in generated settings.py) - it shouldn't become enabled after the relocation. It is better to have a test for it. Adding it here may be enough, but I'm not sure. //cc @curita |
Adding it to @Digenis: Grepping 'telnet' in the repo shows that there are pending |
Thank you both. Something to consider before merging.
|
Would you consider to also disable it by default? |
This is out of the scope of this PR |
Why would it be out of scope? It's a change from an "essential" component into an extension, as part of "downgrading" it into an extension, I feel it could also be disabled by default. |
Telnet extension is conditionally disabled when twisted.conch is not importable, so it is disabled in Python 3. I haven't thought of this move as of "downgrading", only as of a cleanup, but I see what you're heading to. The problem with having telnet disabled by default is that if it is disabled and you need it (e.g. to debug an issue with a long-running spider without stopping it) you can't enable it without stopping the spider, which kind of defeats the purpose of telnet extension. I think this extension is started/stopped in a wrong place: it should be a 'crawler process extension', not spider/crawler extension; it shouldn't be started for every spider if there are multiple spiders in a process. Because of this reason I'm +0 to disable it by default; it feels wrong. But we don't have 'crawler process extensions' in Scrapy, so it is a moot point. |
More like: Telnet extension is conditionally enabled |
Okay I agree with that reasoning, when you need it and forgot to enable it. But it's more burden for the scripting/embedding approach, where one wants the minimal only. from scrapy.settings import Settings
settings = Settings()
# or
#from scrapy.utils.project import get_project_settings
#settings = get_project_settings()
settings.setdict({
'EXTENSIONS': {
'scrapy.telnet.TelnetConsole': None,
},
'DOWNLOAD_HANDLERS': {'s3': None},
})
process = CrawlerProcess(settings) Not needing to pull in |
@nyov yeah, I'm also disabling telnet console with CrawlerProcess. Btw, Settings is not necessary because CrawlerProcess accepts dicts, and s3 handler shouldn't cause problems now (it used to cause 1s startup delay). |
Ah, right, nice I can skimp on an import there (and removing the s3 workaround after 1.1). I'd still favor the minimalist approach, to disable telnet by default though. I'd hazard the guess that most people aren't using it, maybe not even quite aware of it. |
I'll be merging this since I don't see how we'll end the discussion of disabling telnet by default anytime soon I think another possibility could be to have telnet disabled in the default settings, but have it enabled in the Anyway, I'll open up a new ticket to continue the discussion there. |
[MRG+1] Relocate telnetconsole to extensions/
Fixes #1520