2

There is a quite similar question here: What's the difference between a twistd plugin and a twistd service?

And the answer is:

A plugin is nicer in that you can have command-line options

When i started learning twisted i was working with an existing application, and i was confused where is the entry point, which was somewhere in twisted/plugins folder.

From then my preferred way is using tac files in the top folder, but now i got to a point when i need to pass some command line arguments to my script. And i am told to use twisted application plugins.

I am confused by the term plugin in twisted. For me it means somethings that changes an application in a seamless way - you don't really have to know they exist - they just 'plug in' into your application changing its behavior.

But i cannot understand the conceptual difference between twisted applications and twisted application plugins. For me - they serve the same purpose, but are given different features - why?

When should i use twisted applications and when plugins?

Community
  • 1
  • 1
warvariuc
  • 57,116
  • 41
  • 173
  • 227

1 Answers1

1

Plugins in twisted only adds commands and/or options to twistd script. They don't mean anything more.

So well yes, there are two ways to write a startup script for your application, one is using .tac file and one is to add a command (through plugin) to twistd.

I think .tac file is easier to write.

I think it is not a wrong thing to use both: plugins and .tac files.

There is also a third way: write your own startup script instead of twistd.

But i cannot understand the conceptual difference between twisted applications and twisted application plugins. For me - they serve the same purpose, but are given different features - why?

Well no. They don't serve same purpose. Twisted application is just a .tac file that can be started with twistd script. It is more like a config file. Config file with python syntax. It's purpose is that you don't need to write your own start-up script. But if twistd does not provide enough options for you, you can write a plugin for it. So the purpose for plugins is to extend twistd.

And if I had to publish a stand alone application I would write my own startup script and would not use twistd script. twistd is ok if users of the application are familiar with twisted and or has more twisted apps. I think it is only a burden to user to see all the different options of twistd and it is very frustrating not to be able to start application without referring to documentation.

For example scrapy does that: it provides a script scrapyd for users who are not familiar with twisted.

Ski
  • 14,197
  • 3
  • 54
  • 64
  • 2
    >And if I had to publish a stand alone application I would write my own startup script and would not use twistd script. >For example scrapy does that: it provides a script scrapyd for users who are not familiar with twisted. < scrapyd source: `twistd -ny "$tacfile"` – warvariuc Jan 09 '12 at 09:17