libpython-clj icon indicating copy to clipboard operation
libpython-clj copied to clipboard

uv integration

Open behrica opened this issue 3 months ago • 8 comments

see #libpython-clj-dev > declarative python environments with uv

behrica avatar Aug 31 '25 20:08 behrica

No idea why the CI tests fail for MacOS....

In general, I cannot test the code under MacOS, which somebody should do and eventualy adapt the docu. 'uv' does run on MacOs, it says.

behrica avatar Aug 31 '25 20:08 behrica

No idea why the CI tests fail for MacOS....

In general, I cannot test the code under MacOS, which somebody should do and eventualy adapt the docu. 'uv' does run on MacOs, it says.

I can try on macos later this week.

jjtolton avatar Sep 01 '25 14:09 jjtolton

No idea why the CI tests fail for MacOS.... In general, I cannot test the code under MacOS, which somebody should do and eventualy adapt the docu. 'uv' does run on MacOs, it says.

I can try on macos later this week.

Ah, I've seen this before. This error might have nothing to do with uv, this might be a JVM silicon chip compatibility issue.

jjtolton avatar Sep 01 '25 14:09 jjtolton

I have some concerns with uv.clj.

  1. The file needs some overall cleanup
  2. I'm not sure why we are writing the pyproject.toml in the first place, but we should be careful not to overwrite an existing one. Does this need to be configured? Does it need to be merged with an existing .toml file?
  3. There are unneeded dependencies in the file

jjtolton avatar Sep 01 '25 17:09 jjtolton

I'm not sure why we are writing the pyproject.toml in the first place, but we should be careful not to overwrite an existing one. Does this need to be configured? Does it need to be merged with an existing .toml file?

This is the way uv works. uv requires a file on disk with the dependencies. I would not go for a merge approach. This feature is in my view only suitable for "very simple" situations, where the pyproject.toml only contains python dependencies. If a user has any need for other configuration, he should not use the feature. But we should keep in mind, that this is for a "clojure project" which uses python libraries. So there should not be any need for complex configurations in pyproject.toml, like a "python build" A quickstart for 90 % of the cases, specialy tailored of using libpython-clj

Without a generated pyproject.toml we cannot have python deps in python.edn.

behrica avatar Sep 01 '25 19:09 behrica

without pyproject.toml generation the "only" functionality of the setup-fn would be to run "sync uv". (and then we don't need this feature)

behrica avatar Sep 01 '25 19:09 behrica

so yes, the added value for me is to not need to worry about creation of a pyproject.toml by hand. (but a 'uv init' takes care of this as well)

and that it can as well "sync" the python version used

behrica avatar Sep 01 '25 19:09 behrica

The alternative to "changing/creating/overwriting" an existing pyproject.toml is to leave it to the user to add his python dependencies into it.

Then the only thing we do in clojure would be to call (shell/sh "uv" "sync"), which questions the need for any clojure code.

behrica avatar Sep 14 '25 09:09 behrica