Grails and python integration - python

I have a Monet database to which I need to make a query remotely. There's a plugin for python which would make easier to make the query, but I'm creating a grails application.
So I need to create a Python module to make the query, and somehow integrate it to grails.
Does somebody knows how to do this? Thanks.

You don't do that.
Grails is written in Groovy, which is a JVM language; which means it can run any Java code. Monet provides JDBC drivers which should work with no problems.

You can implement python to java with http://www.jython.org
Jython is an implementation of the Python language for the Java platform

Related

fast neo4j query with python and java API

I want to use neo4j for large graph querying (12M nodes, 1.5G relations). I have tested the performance, and using cypher it's unsatisfactory as for the web-server.
Since java API query is >10x faster than the cypher, I want to write necessary query functions in java and handle everything in Python (my website backend is written in Python).
Can you give me some hints how to approach the problem of running Java functions within Python?
I have managed to run JPype. But only one java instance can access the embedded database. For that, py4j using background JVM process may be better solution. Yet, I cannot make py4j working. Do you have an experience with py4j? Or Python and neo4j java API?
The best way to achieve this is writing unmanaged extensions to your Neo4j server in Java. These unmanaged extensions expose new REST endpoints which can then be called from python via http.
A while ago I've created a kind of template for unmanaged extensions using gradle as build system.

Which programming language to use with Heroku?

Heroku supports Python/Ruby and I believe now or soon Java.
However it was built to run Rails apps in the cloud using active record...
Is Ruby/Rails better supported, more feature complete or stable for Heroku hosted development or is the architecture advanced enough that all offerings are equally weighted?
Personally I had some problems with Scala on Heroku, mostly due to outdated sbt plugins. Not sure how Java fairs in that regard. However, if you are looking for a Heroku-like Java environment, you can't do better than CloudBees, which is what I'm using for my Scala stuff now. You can get up to 5 apps for free, so maybe have a look at that.

Safest python code running

How can I protect my web server, if I run custom users code on server. If any user can submit his python source on my server and run it.
Maybe some modules or linux tools for close any network and hardware activity for this script.
Thank's all for help!
The concept you're thinking of is sandboxing. Check out the Python wiki page about it:
http://wiki.python.org/moin/SandboxedPython
In general, python is not the best language choice if you want to allow the execution of untrusted code. The JVM and .NET have much better support for sandboxing, so Jython and IronPython would be better choices.

What Python/IronPython web development framework work on the Microsoft technology stack?

I started learning Python using the IronPython implementation. I'd like to do some web development now. I'm looking for a python web development framework that works on the Microsoft technology stack (IIS + MS SQL Server). Django looks like an interesting framework but based on what I have read, getting it to work on the Microsoft technology stack seems very hard or not possible.
I want to lean a web framework that leverages python strengths, so ASP.NET is not an option here.
The reasons why I want to do Python on full Microsoft stack are:
We are a .Net shop and our production servers run the full Microsoft stack
With IronPython, I'll be able to interop with our product's existing .Net Libraries
Our existing database runs in SQL Server and I want to develop an app that queries that database
Deploying my Python projects to our server will not be allowed if I have to install another web server
Any recommendations?
Working with the full MS stack will be hard as not many FLOSS frameworks aim there. You'll have better luck with a WAMP (Windows/Apache/MySQL-PostgreSQL/Python) approach.
That being said, Django works on Windows, and even can be made to work under IIS by using PyISAPIe and MS SQL Server support.
TurboGears can also be installed on Windows, and has MS SQL Server support through its ORM backends.
Trying to use -AMP under Windows can be an exercise in masochism sometimes. It can be done, but using these frameworks under Linux/BSD is much much easier and enjoyable. You should definitely try it.
While perhaps not entirely mature, isapi-wsgi looks like a promising way to run the WSGI intermediate layer on IIS (I have no hands-on experience with it, but seems worth a try!). Once you have WSGI running just about any Python web framework, including Django, should run on top of it (my personal favorite is werkzeug, a non-framework of utilities on top of WSGI, but I realize it's probably a lower level of abstraction than most web developers prefer for typical web apps and websited).
django-mssql should let Django run fine on SQL Server and looks reasonably mature (again, no hands-on experience). If you prefer a more sophisticated obj-relational mapper, SQLalchemy claims to support MS-SQL "out of the box" with minor restrictions (e.g., no more than one IDENTITY column per table).
If you want to stick with IronPython, but can live with using SQLite instead of MS-Server, it should also be possible to use Django on IronPython with IIS.
Django does in theory run on Windows, but using Apache and MySQL. It's not possible (and certainly not recommended) to run it on IIS.
I know you totally didn't ask this, but I have to advise that if you really want to get into Python web development then looking into a Linux technology stack is definitely the recommended approach. :)

Communication between Windows Client and Linux Server

I want to provide my colleagues with an interface (using Windows Forms or WPF) to control the states of virtual machines (KVM based) on a linux host. On the command line of this server, I'm using a tool, called libvirt, which provides python bindings to access its functionality.
What whould be the best pratice to remotely access several function like libvirt or reading logfiles on the server. I thought about a REST Full Webservice generated by Python. Are there other viable options to consider?
Thanks,
Henrik
I'd develop an intranet web application, using any python web framework of choice.
That way you don't have to develop/install software on your client. They just point the browser and it works.
Because you are using a server-side tool that has Python bindings, you should give a serious look at PYRO which is a Python RPC library.
http://pyro.sourceforge.net/
To use this you would also have to use Python on the client, but that shouldn't be a problem. If you haven't start writing your client, then you could do it all in IronPython. Or, if you need to add this to an already existing client, then you could still bind in either IronPython or CPython as an embedded scripting engine.
For more on PYRO and Ironpython, see this wiki page http://www.razorvine.net/python/PyroAndIronpython
Proxmox VE is a complete solution to manage KVM (and OpenVZ) based virtual machines, including a comprehensive web console, so maybe you can get a full solution without developing anything?

Categories

Resources