GithubHelp home page GithubHelp logo

ihnorton / pyjulia Goto Github PK

View Code? Open in Web Editor NEW

This project forked from juliapy/pyjulia

0.0 3.0 0.0 223 KB

python interface to julia

License: MIT License

Makefile 2.92% Shell 7.17% C 5.39% Python 84.52%

pyjulia's Introduction

PyJulia

Build Status Build status

Experimenting with developing a better interface to julia that works with Python 2 & 3.

to run the tests, execute from the toplevel directory

python -m unittest discover

Note You need to explicitly add julia to your PATH, an alias will not work.

pyjulia is tested against Python versions 2.7 and 3.5. Older versions of Python (than 2.7) are not supported.

Installation

You will need to install PyCall in your existing Julia installation

Pkg.add("PyCall")

Your python installation must be able to call Julia. If your installer does not add the Julia binary directory to your PATH, you will have to add it.

Then finally you have to install pyjulia. You may clone it directly to your home directory.

git clone https://github.com/JuliaPy/pyjulia

then inside the pyjulia directory you need to run the python setup file

sudo python setup.py install

pyjulia is known to work with PyCall.jl โ‰ฅ v0.7.2.

If you run into problems using pyjulia, first check the version of PyCall.jl you have installed by running Pkg.installed("PyCall").

Usage

To call Julia functions from python, first import the library

import julia

then create a Julia object that makes a bridge to the Julia interpreter (assuming that julia is in your PATH)

j = julia.Julia()

You can then call Julia functions from python, e.g.

j.sind(90)

How it works

PyJulia loads the libjulia library and executes the statements therein. To convert the variables, the PyCall package is used.

Limitations

Not all valid Julia identifiers are valid Python identifiers. Unicode identifiers are invalid in Python 2.7 and so pyjulia cannot call or access Julia methods/variables with names that are not ASCII only. Additionally, it is a common idiom in Julia to append a ! character to methods which mutate their arguments. These method names are invalid Python identifers. pyjulia renames these methods by subsituting ! with _b. For example, the Julia method sum! can be called in pyjulia using sum_b(...).

pyjulia's People

Contributors

jakebolewski avatar keno avatar stevengj avatar carreau avatar mrocklin avatar tsurherman avatar pallharaldsson avatar dsoto avatar eslgastal avatar eqt avatar fnmdx111 avatar ararslan avatar dlfivefifty avatar

Watchers

Isaiah Norton avatar James Cloos avatar  avatar

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.