PyJulia
Project description
=======
|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
.. code:: shell
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
.. code:: julia
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.
To get released versions you can use:
::
pip 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] pip install [-e] .
The ``-e`` flag makes a development install meaning that any change to
pyjulia source tree will take effect at next python interpreter restart
without having to reissue an install command.
``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
.. code:: python
import julia
then create a Julia object that makes a bridge to the Julia interpreter
(assuming that ``julia`` is in your ``PATH``)
.. code:: python
j = julia.Julia()
You can then call Julia functions from python, e.g.
.. code:: python
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.
Python references to Julia objects are reference counted by Python, and
retained in the ``PyCall.pycall_gc`` mapping on the Julia side (the
mapping is removed when reference count drops to zero, so that the Julia
object may be freed).
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(...)``.
.. |Build Status| image:: https://travis-ci.org/JuliaPy/pyjulia.svg?branch=master
:target: https://travis-ci.org/JuliaPy/pyjulia
.. |Build status| image:: https://ci.appveyor.com/api/projects/status/kjd0iex9gh0c3yqa?svg=true
:target: https://ci.appveyor.com/project/Keno/pyjulia
Home-page: http://julialang.org
Author: The Julia and IPython development teams.
Author-email: julia@julialang.org
License: MIT
Description-Content-Type: UNKNOWN
Description: UNKNOWN
Keywords: julia python
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
|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
.. code:: shell
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
.. code:: julia
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.
To get released versions you can use:
::
pip 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] pip install [-e] .
The ``-e`` flag makes a development install meaning that any change to
pyjulia source tree will take effect at next python interpreter restart
without having to reissue an install command.
``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
.. code:: python
import julia
then create a Julia object that makes a bridge to the Julia interpreter
(assuming that ``julia`` is in your ``PATH``)
.. code:: python
j = julia.Julia()
You can then call Julia functions from python, e.g.
.. code:: python
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.
Python references to Julia objects are reference counted by Python, and
retained in the ``PyCall.pycall_gc`` mapping on the Julia side (the
mapping is removed when reference count drops to zero, so that the Julia
object may be freed).
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(...)``.
.. |Build Status| image:: https://travis-ci.org/JuliaPy/pyjulia.svg?branch=master
:target: https://travis-ci.org/JuliaPy/pyjulia
.. |Build status| image:: https://ci.appveyor.com/api/projects/status/kjd0iex9gh0c3yqa?svg=true
:target: https://ci.appveyor.com/project/Keno/pyjulia
Home-page: http://julialang.org
Author: The Julia and IPython development teams.
Author-email: julia@julialang.org
License: MIT
Description-Content-Type: UNKNOWN
Description: UNKNOWN
Keywords: julia python
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
julia-0.1.4.tar.gz
(215.8 kB
view details)
Built Distribution
julia-0.1.4-py2.py3-none-any.whl
(220.4 kB
view details)
File details
Details for the file julia-0.1.4.tar.gz
.
File metadata
- Download URL: julia-0.1.4.tar.gz
- Upload date:
- Size: 215.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea83e23a35a4a60014654cbcab70daf1da7539dc2129a19bb7e6354a168bad70 |
|
MD5 | 93f91ff9feba37fada1bf794f1c381dc |
|
BLAKE2b-256 | ded681c7aac5509dcad02f60af294def315ea657105f2d4c911a00ba8faa1ef4 |
File details
Details for the file julia-0.1.4-py2.py3-none-any.whl
.
File metadata
- Download URL: julia-0.1.4-py2.py3-none-any.whl
- Upload date:
- Size: 220.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65ea0cf0332f9e45b1f7ad935477f043ac18c9dbe982094240e02da1490b61d3 |
|
MD5 | 1e9b6b63e18e8fb95c4e5bcf7ce4f72e |
|
BLAKE2b-256 | 84166b3ebe7ec2778deafecf88c2f0940e2c5f15b2320951fd9b6bdd098cd811 |