@kevin26428 can you elaborate?
@borkdude there is a construct in libpython-clj which appears to make certain namespaces / aliases available. it is called import-python
.
after it is evaluated, 7 namespaces / aliases become available.
do you have a recommendation as to how to teach clj-kondo about this construct using hooks?
for starters i tried constructing a do
form containing a require
form, but i'm getting the sense that may not work.
@sogaiu Maybe:
(comment
(require 'python.list))
(python.list/hi)
@borkdude i see that that works in an editor, thanks. i tried with:
(comment
(require (quote python.list)))
(python.list/hi)
but that doesn't seem to work in my editor.
how do i construct a quoted form (i.e. using single quote) using the hooks api? i thought i might need to use rewrite-clj's quote-node but that doesn't appear to be in the hooks api. may be there is another way?Hmm, clj-kondo's handling of require might not understand that currently. That's something to fix. But since you are writing a hook, this won't be emitted top level anyway?
clj-kondo only parses top-level requires currently
ah i see.
or are you handling import-python at the top level?
i think the typical place to use it is at top level, but doesn't the hooks api only let us return one node?
this is very co-incidental: I fixed a similar thing in sci recently: macros emitting top-level dos
🙂
I think there's two things to post issues for:
- clj-kondo should handle requires in top-level dos
- clj-kondo should handle require with quote
ok, i'm fine to make those if you like.
yeah please. I'm about to start a new 2 week Clojurists Together cycle for clj-kondo :)
cool, will do.
Sophisticated CI script using babashka and clj-kondo in Gitlab: https://gist.github.com/hansbugge/4be701d771057e8ef6bbbb0912656355