How do you turn a Flask app into a Perl plugin?

105 Views Asked by At

I have a Flask app using some Python libraries for NLP and audio processing that I want to turn into a Plugin for Audacity. Audacity accepts plugins in Nyquist, Perl, and C/C++. I'm guessing, because of the similarity between Perl and Python, that I should go that route. Audacity's docs are pretty sparse, and I haven't found any very useful tutorials, so I have a lot of questions. Forgive me if they're silly questions - this is really new territory for me. Any and all advice is welcome.

  1. What are the steps necessary to turn that web app into a plugin?

  2. Does creating a Perl plugin mean translating all the Python code into Perl, or just creating a Perl script that calls the Python code?

  3. What does it mean that "scripting is not suitable for providing a service on a web server"?

  4. Our Flask app relies on a large custom-trained model file for Mozilla's DeepSpeech - is it possible to handle very large files in a Plugin?

  5. How do you test a plugin for a desktop app? Where do you see error logs?

Again, be gentle with me! I know these are probably silly questions, but I feel like my PM just dropped me in a foreign country with no map!

1

There are 1 best solutions below

2
On

Number 1: for perl you need to build a Makefile.PL or use another module packager

Number 2: yes you will have to rewrite your code to perl. You probably could package it but you would have to assume that people installing your package have Python installed

Number 3: Hard to say, maybe they are worried about injecting code or possibly poor memory management from long running scripts

Number 4: You can ship large files, if you're duplicating and releasing other peoples code, it's maybe better to use their installer for it and decouple your code from it

Number 5: there are many ways to test it. You can (and should) decouple the UI from the business logic. The business logic cn be tested with standard unit testing. The UI with something like Selenium. You may also need integration tests to test end-to-end