Pyblish_NW


#1

A Pyblish Project for providing graphical front-end using NW.js, an app runtime based on Chromium and node.js


#2

Cool, I’ll get the conversation started.

I can see a number of benefits of a Node.js implementation of a frontend.

  1. Access to developers. There are tons and tons of developers with knowledge about web application development, so finding open source contributors is much easier than it is for QML.
  2. Graphs and charts. There are tons and tons of resources available for data visualisation available, which is more or less what the Pyblish QML is all about.

It’s not all glitter and sparkles however.

  1. Node.js for desktop applications is in early beta and likely to change rapidly over the coming years.
  2. Memory footprint is relatively large, due to running under Chromium.

What other pros and cons can you think of?

@ljkart From our conversation on Hangouts, you were looking at communicating with Python through Node.js?


#3

Pros:

  • Developing desktop applications using HTML, CSS and JavaScript meaning able to access most of the new web technologies.
  • npm(node package manager) powered - 145,991 packages till now
  • Easy to package the application for end users using many build tools
  • If you already have a web application then it is easy to use most of that existing code-base to build a desktop application.
  • File system support, which is not possible through web-apps
  • Rich Documentation, Debugger Support
  • wide variety of HTML5 support such as Web Components, Drag & Drop, Data persistent, WebGL, WebRTC, CSS3 and more

Cons :

  • Compared to native applications, desktop web applications typically
    require a much larger amount of RAM and CPU power to run and render
  • When packaging applications using either shell, the resulting executable contains an almost complete version of Chromium and Node.js as well as your HTML, CSS and JavaScript. Depending on the target system, the entire packaged application can become almost 100Mb, whilst the size of an application using native UI libraries can start at a mere few kilobytes in size

@marcus : experimenting inter-communication between node.js and python. would like to know best way for doing that.
like having a python server running and respond to NW and NW will render the output to GUI.
Will start doing through simple ways using http or sockets?
expecting more suggestions!


#4

Those looks like some very good pros and cons of Webkit, but in a very general sense. How about in relation to Pyblish QML?

Open Questions

Here are the question I think we need to have a think about before getting too deep into development.

What will Pyblish NW offer…

  1. users that are considering whether they should use Pyblish QML or Pyblish NW?
  2. developers interested in contributing to Pyblish?

IPC

like having a python server running and respond to NW and NW will render the output to GUI.

Here’s an example of how you can open up a connection to a running instance of Python.

Python

import flask

app = flask.Flask(__name__)

@app.route("/")
def main():
  print "Triggered from Node.js!"

if __name__ == "__main__":
  app.run(port=8000)

From here, you can send a request to Python from Node.js, like this.

Node.js

// Node.js
var http = require('http');

var options = {
  host: '127.0.0.1',
  port: '8000',
  path: '/'
};

http.request(options, function (response) {
  console.log(response);
}).end();

Running that in any Node.js console or app will make the Python console output something like:

Triggered from Node.js!
127.0.0.1 - - [06/May/2015 13:16:18] "GET / HTTP/1.1" 500 -

And from there, it’s up to you to handle the request and do something useful with it.