GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - chrisdickinson/node-python: a binding between node.js (really, the V8 engine) and python. super beta super buggy super great

BranchesTags
Open more actions menu

Latest commit

 

History

14 Commits
14 Commits

Folders and files

NameName
Last commit message
Last commit date
LICENSE.bsd
LICENSE.bsd
 
 
README.md
README.md
 
 
binding.cc
binding.cc
 
 
package.json
package.json
 
 
wscript
wscript
 
 
wsgi.js
wsgi.js
 
 

Repository files navigation

node-python binding

I bumped this up from "playground" to "binding" on account of it starting to feel like the right thing to do.

This is a binding between Node.js and Python; unfortunately as written it actually embeds a python process inside of Node. It's of extremely alpha quality and was originally written with the intent of getting a better understanding of the internals of both V8 and CPython.

But, yeah, okay. So the cool things:

var sys = require('sys');
var python = require('./binding');
var pysys = python.import('sys');
sys.puts(pysys.toString());

Will output python's sys.path. And passing in arguments works, too:

var python = require('./binding'),
os = python.import('os'),
cwd = os.getcwd(),
basename = os.path.basename(cwd);

var sys = require('sys');

sys.puts(basename.toString());

Unfortunately Python objects are not really fully translated into native Javascript objects yet; you have to cast them from whatever they are into whatever you want them to be. At the moment, the only provided cast is "toString", but that should change in the near future (hopefully).

Passing python objects that you get from calling python functions from javascript can seamlessly be passed back into python functions (no casting required). Currently there's what I assume to be a passable argument translation implementation for simple Objects (ones that act like dicts), Arrays, Numbers (maybe?), and Strings.

You can slap together a tiny WSGI hosting thing on it, as well, which is provided in wsgi.js. It's half implemented, but it's midnight on a Sunday and I should probably sleep.

Installation

I've only tested this out on my computer so no huge promises can be made about other platforms. Running OSX 10.6.3:

node-waf configure build

In theory this is all you need in the entire world.

About

a binding between node.js (really, the V8 engine) and python. super beta super buggy super great

Resources

Readme
BSD-3-Clause license
Activity

Stars

66 stars

Watchers

5 watching

Forks

33 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.