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.
What are the steps necessary to turn that web app into a plugin?
Does creating a Perl plugin mean translating all the Python code into Perl, or just creating a Perl script that calls the Python code?
What does it mean that "scripting is not suitable for providing a service on a web server"?
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?
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!
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
Related
Recently I've been developing Python code as a freelancer. I've mostly worked on social media bots, my usual way of delivering the code is as a Python script for people to run on their compilers. However, I've started to run into people that lack the technical knowledge of installing modules and running the code that way. How do I create a package like software and deliver it in a way that can be ready-to-run and users don't have to download anything extra? Thank you in advance for your feedback.
Check out py2exe. It is a wrapper that converts your script into an executable, so the user can run it without needing to install any python libraries.
Alternatives to py2exe are:
PyInstaller - the advantage of using this is that it lets you build executables in formats other than exe, if you want to make your program run on non-Windows platforms, for example.
cx_Freeze - this is also another cross-platform alternative.
One method would be (as stated in the previous answer) is to use exe converters, but that wouldn't be as effective if you target Mac and Linux users as well.
My solution is going to take you a little more time, but it will be worth it. Here goes:
Please learn Angular JS, or some other framework (I prefer Angular). Once you know that, you can easily develop a web app for your project, and add your Python to that.
The good news is, there are lots of tutorials for this, such as https://codehandbook.org/creating-a-web-app-using-angularjs-python-mongodb/ (also teaches you mongodb) Anyways, you can find other tutorials on your own.
You could of course, I guess, build it into a mobile app, but I think web app would be easier.
I am teaching a class soon and I want to have users try my platform without the need of installing Python in their computers and to run everything online. I have searched for platforms such as Skulpt, CodeMirror and Trinket and they seem ok for what I want to do. However, I want to develop a GUI for the users to input parameters since there are a lot of options and I don't want users with no Python experience to run the programs from the command line like I do and hide the Python code behind the GUI. I have learnt simplegui recently but I think the GUIs you can create are not visually pleasant and for me this is a big no. I also saw in another post that using Tkinker with a in-browser python implementation is not possible.
So, I would like to know what would be the best combination of in-browser Python implementation and GUI module to reach my goal please?
Thank you so much!
I guess Jupyter could meet your needs. Getting started here.
The Jupyter Notebook is a web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, machine learning and much more.
The Notebook has support for over 40 programming languages, including those popular in Data Science such as Python, R, Julia and Scala.
I am a Python/web programmer.
Now, I would like to transition to building applications for the Mac.
Please tell me--what do I have to learn to get started?
What books would you recommend?
Assuming that you included the "python" tag after considering that it will be interpreted as applying to the question and not the questioner, you must be interested in writing Python applications for the Mac, right? After all, you didn't include "web" as one of the tags too.
If that's true, I'm not sure what more you need to know already, other than perhaps picking a GUI framework, if you want to write GUI applications.
I use wxPython quite successfully for applications which run on OS X (and Windows). Very few Mac-specific issues have cropped up to cause trouble, primarily because both Python and wxPython are remarkably cross-platform. The few that have come up are by and large documented and have known workarounds, or the resolution is fairly simple to find.
I've needed no books on the subject, and really know very little about Macs. It really hasn't been a problem so far.
The programming language of choice for building OS X gui applications is Objective-C with Cocoa, I would recommend that you check out some books on that. There are python bindings for Cocoa but they are not optimal.
You should check out previous questions looking for books on Obj-C and Cocoa.
What are some applications for Python that relative amateur programmers can get into?
For example, Ruby has Rails for building web applications. What are some cool applications of Python?
Thanks.
Google App Engine has excellent support for developing -- and especially for deploying -- web applications in Python (with several possible frameworks, of which Django may be the most suitable one for "relative amateurs"). Apart from web apps, Blender lets you use Python for 3D graphics, Poser for apps involving moving human-like figures, SPSS for statistics, scipy and many other tools included in Enthought's distribution support Python use in scientific programming and advanced visualization, etc, etc -- the sky's the limit.
"cool" is a state of mind. Hence cool applications depends on your definition of cool. A Ant colony simulation is cool, if you want to implement the theory.
Python, with its own and 3rd party libraries (batteries) has been applied in possibly all domains of day to day programming. My advise is, decide on the cool app you want to write and then see, what Python has to offer in that domain. If you are sufficiently satisfied, you can start coding. Good Luck!
You can build web applications in Python. See the Django framework.
Besides that, here's a nice list.
Not particularly relevant, but interesting, is the fact that NASA uses Python.
I wasn't a programming amateur at the time, but using pygame was my first intro to Python.
Python is a general purpose programming language much like Ruby. It can be used for systems programming, embedded programming, desktop programming, and web programming. In short, it has about as much potential for "cool" projects as any other general purpose language.
One of the first bits of Python programming I ever did was to hack on the nicotine client for the Soulseek peer-to-peer network to add a '/g [query]' chat command to open the default browser and search Google.
Probably not the most general purpose example, but I learned Python when AutoDesk Maya adopted it as a secondary programming language to complement MEL (Maya Expression Language). By comparison, it was a god-sent.
I like:
Django, for web development
PyQt4 for GUI programming
pygame for games, input management etc
PIL - python imaging library, it's not huge application, but really helpful and library imo
also, Blender is an application scriptable in Python, so if you'd be into some 3D graphics, here you got it.
If you're making applications for windows and want to ship them easily, you can also look at stuff like py2exe.
The background
I'm building a fair-sized web application with a friend in my own time, and we've decided to go with the Django framework on Python. Django provides us with a lot of features we're going to need, so please don't suggest alternative frameworks.
The only decision I'm having trouble with, is whether we use Python or Jython to develop our application. Now I'm pretty familiar with Java and could possibly benefit from the libraries within the JDK. I know minimal Python, but am using this project as an opportunity to learn a new language - so the majority of work will be written in Python.
The attractiveness of Jython is of course the JVM. The number of python/django enabled web-hosts is extremely minimal - whereas I'm assuming I could drop a jython/django application on a huge variety of hosts. This isn't a massive design decision, but still one I think needs to be decided. I'd really prefer jython over python for the jvm accessibility alone.
Questions
Does Jython have many limitations compared to regular python? Will running django on jython cause problems? How quick is the Jython team to release updates alongside Python? Will Django work as advertised on Jython (with very minimal pre-configuration)?
Decision
Thanks for the helpful comments. What I think I'm going to do is develop in Jython for the JVM support - but to try to only use Python code/libraries. Portability isn't a major concern so if I need a library in the JDK (not readily available in python), I'll use it. As long as Django is fully supported, I'm happy.
Django does work on Jython, although you'll need to use the development release of Jython, since technically Jython 2.5 is still in beta. However, Django 1.0 and up should work unmodified.
So as to whether you should use the regular Python implementation or Jython, I'd say it's a matter of whether you prefer having all the Java libraries available or all of the Python libraries. At this point you can expect almost everything in the Python standard library to work with Jython, but there are still plenty of third-party packages which will not work, especially C extension modules. I'd personally recommend going with regular Python, but if you've got a ton of JVM experience and want to stick with what you know, then I can respect that.
As for finding Python hosting, this page might be helpful.
I'd say that if you like Django, you'll also like Python. Don't make the (far too common) mistake of mixing past language's experience while you learn a new one. Only after mastering Python, you'll have the experience to judge if a hybrid language is better than either one.
It's true that very few cheap hostings offer Django preinstalled; but it's quite probable that that will change, given that it's the most similar environment to Google's app engine. (and most GAE projects can be made to run on Django)
I have recently started working on an open source desktop project in my spare time. So this may not apply. I came to the same the question. I decided that I should write as much of the code as possible in python (and Django) and target all the platforms CPython, Jython, and IronPython.
Then, I decided that I would write plugins that would interface with libraries on different implementations (for example, different GUI libraries).
Why? I decided early on that longevity of my code may depend on targeting not only CPython but also virtual machines. For today's purposes CPython is the way to go because of speed, but who knows about tomorrow. If you code is flexible enough, you may not have to decide on targeting one.
The downside to this approach is that you will have more code to create and maintain.
Django is supposed to be jython-compatible sinc version 1.0.
This tutorial is a bit outdated, but from there you can see there are no special issues.