KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums PyKX Calling/using a Python function or Class from Q Re: Calling/using a Python function or Class from Q

  • rocuinneagain

    Member
    July 12, 2023 at 12:00 am

    pykx.q provides this functionality. Most EmbedPy code can be migrated by replacing .p with .pykx

    https://code.kx.com/pykx/1.6/api/pykx_under_q.html

    The needed file is included when you pip install pykx

    To make it available to your q processes run the commend to copy the needed files:

     

     

    python -c "import pykx as kx; kx.install_into_QHOME()"

     

     

    Then you can use as you describe:

     

     

     

    l pykx.q 
    np:.pykx.import`numpy 
    np[`:arange][10]` 
    0 1 2 3 4 5 6 7 8 9

     

     

     

    There are still some improvements needed to reach parity/maturity which will be coming in the next few releases of PyKX.

     

    License flags are needed to use this feature but they are now provided to all downloads.

    You can check your license in q

     

     

     

    q)`insights.lib.embedq`insights.lib.pykx in: `$" " vs .z.l 4 
    11b

     

     

     

    If you do not have the flags you just need to re download and a new license with the flags will be included.

    https://kx.com/kdb-personal-edition-download/ 

    https://kx.com/kdb-insights-personal-edition-license-download/