Fork me on GitHub
#babashka
<
2020-06-09
>
jkrasnay00:06:14

@borkdude Yes, that version works for me without the extra backslashes. Thanks!

borkdude09:06:11

I think defprotocol, extend, extend-type, etc. are in a pretty good shape in the defprotocol branch of sci and babashka. Examples from clojuredocs seem to work. If there aren't any bugs discovered before tomorrow I'll merge to master and do a new release with this.

👀 8
parrot 36
nate16:06:37

very cool

nate16:06:05

I don't know if it's a bug or what, but a little bit ago I was trying to use https://github.com/cognitect-labs/test-runner.git to run my babashka tests

nate16:06:24

ran into a wall because it uses tools.namespace and that uses defprotocol

nate16:06:30

so I was excited to try it out now

nate16:06:12

running with clojure:

$ clojure -A:clj:test

Running tests in #{"test"}
WARNING: print already refers to: #'clojure.core/print in namespace: empath-test, being replaced by: #'empath-test/print

Testing empath-test

Ran 2 tests containing 12 assertions.
0 failures, 0 errors.

nate16:06:47

Running with new bb with defprotocol:

$ ./bb-defprotocol -cp $(clojure -R:test -Spath) -m cognitect.test-runner

Running tests in #{"test"}

Testing user

Ran 0 tests containing 0 assertions.
0 failures, 0 errors.

nate16:06:03

need to dig into why the namespaces aren't found when running in bb

nate16:06:11

hm, this is going to take longer than I thought I can't just add tools.namespace to my deps edn as a local root and start println debugging

borkdude17:06:05

I've tried tools.namespace and I think it didn't work because of a deftype somewhere (which bb doesn't yet support)

borkdude17:06:50

oh this was the issue: ` $ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {org.clojure/tools.namespace {:mvn/version "1.0.0"}}}') $ ./bb "(require '[clojure.tools.namespace.find])" clojure.lang.ExceptionInfo: Unable to resolve classname: http://java.net.URLClassLoader [at clojure/java/classpath.clj, line , column ]

borkdude17:06:05

This class is not supported by GraalVM

borkdude17:06:31

maybe there can be a fork of this library with some bb reader conditionals

borkdude17:06:21

So probably deftype and definterface are the next roadblocks to take

nate17:06:24

thanks for the info

nate17:06:01

for now, my simpler test runner script works just fine

borkdude17:06:20

I would be curious which other libraries are now possible to run

viesti14:06:26

hmm, does babashka support System/console?

viesti14:06:43

thinking about password prompt

borkdude14:06:07

Should this work?

$ clj -e '(.readLine (System/console))'
12322
"12322"

borkdude14:06:39

oh I see:

$ clj -e '(.readPassword (System/console))'

#object["[C" 0x743cb8e0 "[C@743cb8e0"]

viesti14:06:46

running on Windows for extra problems even 🙂

viesti14:06:02

clojure.lang.ExceptionInfo: Method readLine on class java.io.Console not allowed! [at \\....\, line 19, column 30]

viesti14:06:41

actually, didn't need password prompt after all, but got curious where that "http://java.io.Console not allowed!" came from

viesti14:06:32

I guess System/console returned a thing

borkdude14:06:05

that's because the class .Console isn't present in bb (yet)

borkdude14:06:37

It does seem to work:

borkdude14:06:57

So I can just add it for the next release

borkdude14:06:06

A test binary should be available in a few minutes in #babashka_circleci_builds

borkdude14:06:31

are you on linux, mac or Windows btw?

viesti14:06:15

using the free windows virtualbox image, writing a tooling script for a windows user

viesti14:06:23

host on osx

viesti14:06:37

dinner, can test after a while 🙂

viesti14:06:59

but thinking that System/console is a good addition, since you can do password prompts with bb then

borkdude14:06:02

$ ./bb -e '(println "Type password:") (let [pw (.readPassword (System/console))] (String. pw))'
Type password:
<here is an icon of a key I could not copy paste>
"123"

🔑 8
borkdude14:06:21

The above should be possible with releases just posted to https://clojurians.slack.com/archives/CSDUA8S6B/p1591713855009900 (cc @viesti)

viesti14:06:33

awesome fast response time from feature request to implementation :D

borkdude14:06:32

Also seems to work on Windows:

C:\Users\borkdude\Downloads>bb "(println \"Type password:\") (String. (.readPassword (System/console)))"
Type password:
<nothing to see here>
"123"

borkdude14:06:37

Maybe babashka for me is just a tool to prepare my migration back to Windows 😉

😎 8
viesti16:06:14

works also on my (virtual) machine

viesti19:06:42

now getting greedy, I wonder if https://github.com/weavejester/hashp could work with bb... 🙂

nate19:06:08

or nippy, that would be awesome

nate19:06:51

$ bb-defprotocol -cp $(clojure -Sdeps '{:deps {com.taoensso/nippy {:mvn/version "2.14.0"}}}' -Spath) "(require '[taoensso.nippy :as nippy])"
clojure.lang.ExceptionInfo: Unable to resolve classname: java.io.DataInputStream [at taoensso/nippy.clj, line , column ]

nate19:06:01

a possible tree to bark up

nate19:06:45

trying it out

borkdude20:06:09

nippy can be done via a pod probably

nate20:06:49

ah yes, good idea

viesti20:06:18

Converting the examples in this blog to use bb instead of bash + jq would be awesome I think :) https://medium.com/circuitpeople/aws-cli-with-jq-and-bash-9d54e2eabaf1

plins21:06:03

I took a look at the docs but didnt find an definitive answer lets say I want to use https://github.com/clj-commons/camel-snake-kebab in a babashka script (assuming its compatible with babashka), whats the easiest way to use it in the project? deps.edn + something?

borkdude21:06:33

@plins What a co-incidence. I just merged the defprotocol branch in which the tests for camel-snake-kebab now are running with babashka on CI. https://github.com/borkdude/babashka/blob/14cd18f50f4298b0ee623bd4992c704b5a4d6935/script/lib_tests/camel_snake_kebab_test#L12

plins12:06:51

thats fortunate 🙂 in love with babashka, making ETL a bliss

borkdude21:06:27

So it should be able to run with the new binaries from master (https://clojurians.slack.com/archives/CSDUA8S6B/p1591737307011100) using the way shown in the linked script.

borkdude21:06:38

I'll make a proper release tomorrow

plins12:06:37

how Im I suppose to install the new release? brew install and the install script installs 1.0

borkdude13:06:17

I haven't yet released

borkdude13:06:28

still fixing some minor things