Skip to content

Question: on using a remote process for the Python interpreter #6

Description

@teodorlu

Hello Chris!

I really enjoyed listening to Scicloj meeting #4. You're doing interesting work here. I feel that you're setting the Clojure community up for an interop story with Python that's similar to how we're able to make use of Java.

I have a question, if you don't mind. Per now, I can use my own interpreter of choice like this:

(require '[libpython-clj.python :as py]
         '[libpython-clj.jna.base])

(defn get-python [_]
  "/home/teodorlu/opt/anaconda3/bin/python")

(alter-var-root #'libpython-clj.jna.base/*python-library* #'get-python)

I would like to use libpython-clj to interface with a running Python process that's not started from within the Clojure process, but "on its own terms". A possible process could look like this:

  1. Make some changes to the remote Python interpreter allow libpython-clj to ... do what it needs to do.
  2. Start a Clojure process
  3. Point the Clojure process to the running Python process
  4. Evaluate Python code in that context.

The reason why I can't just start a new process, is that the Python process is started by another application, and I need access to the application state, as the user interacts with the state.

  • Is this in scope for libpython-clj?
  • Do you think it's feasible?

I spent some time reading the libpython-clj source code, but I must admit that this is above my level, hence I'm asking.

Thanks again for your work, and have a nice day!
Teodor

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions