Code Monkey home page Code Monkey logo

node-python's Introduction

node-python binding

Python bridge for nodejs! Call your python code from node!

Build Status

Installation

npm install node-python

Usage

// python stuff
var python = require('node-python');
var os = python.import('os');

// nodejs stuff
var path = require('path');

assert(os.path.basename(os.getcwd()) == path.basename(process.cwd()))

You should now go have fun with that and make it brokes :)

Current status

What works:

  • ✓ should convert javascript null to python NoneType
  • ✓ should convert javascript undefined to python NoneType
  • ✓ should convert javascript booleans to python booleans
  • ✓ should convert javascript date to python date
  • ✓ should convert javascript numbers to python floats
  • ✓ should convert javascript arrays to python list
  • ✓ should convert javascript objects to python dictionaries
  • ✓ should convert javascript nested objects correctly
  • ✓ should convert python dicts to javascript objects
  • ✓ should convert python lists to javascript arrays
  • ✓ should convert python strings to javascript strings
  • ✓ should convert python boolean to javascript booleans
  • ✓ should convert python numbers to javascript numbers
  • ✓ should convert python dates to javascript dates
  • ✓ should convert basic python dict to javascript object
  • ✓ should convert basic python list to javascript array
  • ✓ should return resulting value from python statement executed
  • ✓ should return resulting value from python statement executed, converting to string with complex types
  • ✓ should return object representing module imported, containing functions from imported module
  • ✓ should throw a PythonError when importing a module that does not exist
  • ✓ should throw an Error when importing a module that includes bad syntax

What to watch out for:

  • Losing precision from Python's 64 bits Integer to Node's Number (we hande this by converting decimals to string and using bignumber.js to consume them. better solutions to come)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.