Metadata-Version: 2.1
Name: jruntime
Version: 0.2.0.post1
Summary: Python extension that interacts with the J language
Home-page: https://github.com/zhihaoy/jsource
Author: Zhihao Yuan
Author-email: zy@simplerose.com
License: GPLv3
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: Microsoft :: Windows :: Windows 10
Classifier: Operating System :: POSIX :: Linux
Requires-Python: >=3.8

.. image:: https://github.com/zhihaoy/jsource/raw/jruntime-pyd/docs/source/_static/jpyd.png

|

**jruntime** is a modern Python extension that interacts with the J language.  It provides deep integration between Python and J in the following ways:

- Takes over J engine I/O with Python I/O
- Maps between J arrays and NumPy ndarrays, J boxes and Python tuples
- Binds J nouns to lexical scopes using Python ``with`` statements
- Handles J errors using Python exceptions
- Emits the complete API document in ``help(jruntime)``

Getting Started
===============

Install jruntime and NumPy from PyPI:

.. code-block:: bash

    pip install jruntime numpy

Now you can run J code and read data in NumPy arrays:

.. code-block:: python

    >>> import jruntime
    >>> j = jruntime.Session()
    >>> j.runsource('v =: 3 4 $ i.12')
    >>> j['v']
    array([[ 0,  1,  2,  3],
           [ 4,  5,  6,  7],
           [ 8,  9, 10, 11]], dtype=int64)

Or put Python data in J and run code that uses it:

.. code-block:: python

    >>> with j.let(title='Price', v=[.99, 1.48, 0.26]):
    ...     j.runsource('title;+/ v')
    +-----+----+
    |Price|2.73|
    +-----+----+


