clj-python / libpython-clj

Python bindings for Clojure
Eclipse Public License 2.0
1.08k stars 68 forks source link

Make polyglot development easier by allow require-python to be path-informed #253

Closed jjtolton closed 11 months ago

jjtolton commented 11 months ago

I find myself writing code like this way too often:

(import-python)
(require-python 'os)

(let [cur-dir (os/getcwd)]
  (try
    (os/chdir "some/dir")
    (require-python 'path.i.need)
    (finally
      (os/chdir cur-dir))))

I feel like it would be much nicer if I could do:

(require-python :from "some/dir"
                'path.i.need
                :from "a/nother/dir"
                'other.data
                :from "yet/another"
                '[last-one :path "slightly/more/convoluted"])

This would make exploratory development much less of a chore when writing new Python files.

jjtolton commented 11 months ago

Closed by https://github.com/clj-python/libpython-clj/pull/254