Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 30 2019 14:37
    bhaskarmelkani starred lihaoyi/Ammonite
  • Jan 29 2019 04:27
    JYInMyHeart starred lihaoyi/Ammonite
  • Jan 29 2019 04:27
    JYInMyHeart starred lihaoyi/Ammonite
  • Jan 28 2019 15:07
    ishubelko starred lihaoyi/Ammonite
  • Jan 25 2019 22:38
    borissmidt starred lihaoyi/Ammonite
  • Jan 25 2019 17:12

    alexarchambault on 1.6.3

    (compare)

  • Jan 25 2019 17:11

    alexarchambault on master

    1.6.3 (compare)

  • Jan 25 2019 15:48
    alexarchambault commented #923
  • Jan 25 2019 01:15

    lihaoyi on gh-pages

    5ad9ae5538f23cab92ccd8c6b1617d8… (compare)

  • Jan 25 2019 00:50

    alexarchambault on master

    Partly revert 84d48542 (#923) … (compare)

  • Jan 25 2019 00:50
    alexarchambault closed #923
  • Jan 25 2019 00:50
    alexarchambault closed #920
  • Jan 25 2019 00:50
    alexarchambault closed #922
  • Jan 24 2019 23:13
    lihaoyi commented #923
  • Jan 24 2019 22:39
    alexarchambault closed #921
  • Jan 24 2019 22:39
    alexarchambault commented #921
  • Jan 24 2019 22:39
    alexarchambault edited #923
  • Jan 24 2019 22:38
    alexarchambault opened #923
  • Jan 24 2019 22:37
    david-bouyssie commented #919
  • Jan 24 2019 21:33
    nksureshkumar commented #922
eslo
@eslo:hacklab.fi
[m]
Or do I just have to load it manually?
Apparently this should work with sbt
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
:: adds the scala version prefix, for java libraries you need to use :
sbt will have the same problem if %% was used on this artifact instead of %
eslo
@eslo:hacklab.fi
[m]
Ok great! Now it works! 👍️ I hope my questions aren't too stupid.
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
they aren't :) everyone gets bitten by this at some point (or several times)
eslo
@eslo:hacklab.fi
[m]
I managed to get the processing library drawing some lines in an sbt project, but I can't seem to do that inside ammonite. It just compiles and then does nothing. I can import the defined things to ammonite repls, but they don't do much. I guess I have to figure a way to run this thing.
I think this part is the problem:
object ProcessingTest extends App {
PApplet.main("ProcessingTest")
}
I think sbt just runs that as the main somehow. just setting that as @main didn't seem to help alone
eslo
@eslo:hacklab.fi
[m]
It seems to me right now that the problem might be in that "ProcessingTest" is not actually the name of the class when running inside ammonite for some reason.
eslo
@eslo:hacklab.fi
[m]
I just don't know how to provide it correctly for PApplet.main()
eslo
@eslo:hacklab.fi
[m]
Ok I can' t get this thing to work. I'm altering between getting a ClassCastException and something about my class being private.
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
when you extend App it uses a crusty old feature called DelayedInit to capture the body of the object and create a main method out of it
eslo
@eslo:hacklab.fi
[m]
I think I understand that much. I just have no clue how to provide the class as a fitting parameter to the PApplet.main. it just appears to have no access to it in the context of ammonite.
eslo
@eslo:hacklab.fi
[m]
Haa I figured it out ... Kind of at least.
Apparently if I just use MyClass.getClass.getName it gives one extra dollar sign at the end of the string which breaks things.
Otherwise I could use the format it produces.
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
yeah, objects have $ in their classname (I think in bytecode they're just classes with all static fields)
eslo
@eslo:hacklab.fi
[m]
The working end result was "ammonite.predef.FilePredef$MyClass"
It still has one dollar sign, but the last one was apparently too much.
eslo
@eslo:hacklab.fi
[m]
Red a bit online and now I think I understand what is going on here. The trailing dollar is a scala thing and java interop does not want them.
George K. Thiruvathukal
@gkthiruvathukal
Does anyone know if Ammonite can be installed without root?
1 reply
All of the Linux instructions only show sudo, so I thought I would check.
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
@gkthiruvathukal: Echoing what crater2150 said, I can add that I manage ammonite using Coursier, and it uses a local folder that I added to the PATH
Erik Vesterlund
@erikv85

@sake92

@erikv85 I think you need os.pwd

What is that, a command to type, or what? With backticks doesn't work, and without prints my working directory, ~.

This is in regards to how to get :type to work in ammonite.

George K. Thiruvathukal
@gkthiruvathukal
@velvetbaldmime:matrix.org , thank you!
And thanks to @crater2150:qwertyuiop.de as well.
LingarajVB
@LingarajVB
I have a constants.scala file where there are hundreds of hardcoded string vals like below:
val dataInput = "raw.inputPath"
I want all of them to be able to use inside Ammonite REPL, how can I import it ? Please help!
LingarajVB
@LingarajVB
Got it! no worries.
Stephen Duncan Jr
@jrduncans
What should I be checking if running ammonite repl shows Scala 2.13.6 when started, but then attempts to use things seems to be referencing Scala3 library files and failing?
> amm
Loading...
Welcome to the Ammonite Repl 2.3.8-124-2da846d2 (Scala 2.13.6 Java 11.0.10)
@ import scala.util.Random
error while loading NotGiven, Missing dependency 'Add -Ytasty-reader to scalac options to parse the TASTy in <path>/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.0.0/scala3-library_3-3.0.0.jar(scala/util/NotGiven.class)', required by <path>/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.0.0/scala3-library_3-3.0.0.jar(scala/util/NotGiven.class)…
Lasse Benn Nørregaard
@lassebn

I'm having issues getting ammonite-compiler-interface for scala 2.13.6. It should be available according to https://mvnrepository.com/artifact/com.lihaoyi/ammonite-compiler-interface but I keep getting Error downloading com.lihaoyi:ammonite-compiler-interface_2.13:2.3.8-124-2da846d2 from SBT.
Also going to https://repo1.maven.org/maven2/com/lihaoyi/ammonite-compiler-interface_2.13/2.3.8-124-2da846d2/ammonite-compiler-interface_2.13-2.3.8-124-2da846d2.pom returns 404 Not Found.

Am I doing anything obviously wrong? Thank you :raised_hands:

Anton Sviridov
@velvetbaldmime:matrix.org
[m]

ammonite-compiler-interface_2.13

The compiler interface has to be versioned for the full Scala version - you need to depend on it like this:

"com.lihaoyi"  % "ammonite-compiler-interface" % "2.3.8-124-2da846d2" cross CrossVersion.full
Lasse Benn Nørregaard
@lassebn
Thank you @velvetbaldmime:matrix.org
Anton Sviridov
@velvetbaldmime:matrix.org
[m]

As a rule of thumb - everything that fathomably interfaces with the compiler has to be compiled against exact version of it.

Scala compiler API has no guarantees even between patch versions, so things like ammonite (and parts of Almond) need to be cross-published against full scala version :) Just like many compiler plugins.

Adam Jorgensen
@OOPMan
Hello, has anyone run into an issue like this?
[IJ]test:runMain amm
[warn] sbt 0.13 shell syntax is deprecated; use slash syntax instead: Test / runMain
[info] running amm
[error] (run-main-0) java.lang.ExceptionInInitializerError
[error] java.lang.ExceptionInInitializerError
[error]         at amm.main(amm.scala)
[error]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
[error]         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]         at java.base/java.lang.reflect.Method.invoke(Method.java:564)
[error] Caused by: java.lang.NullPointerException: Cannot invoke "scala.collection.mutable.ArraySeq$ofRef.toList()" because the return value of "scala.Predef$.wrapRefArray(Object[])" is null
[error]         at ammonite.Main$.main(Main.scala:279)
[error]         at amm$.<clinit>(amm.scala:1)
[error]         at amm.main(amm.scala)
[error]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
[error]         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]         at java.base/java.lang.reflect.Method.invoke(Method.java:564)
[error] stack trace is suppressed; run 'last Test / bgRunMain' for the full output
[error] Nonzero exit code: 1
[error] (Test / runMain) Nonzero exit code: 1
[error] Total time: 2 s, completed May 22, 2021, 7:02:27 PM
From the source code of the failing method it looks like it's failing on the primary entry point for Ammonite...
If it helps, my build.sbt is here: https://pastebin.com/Hbz1ya0Q
Adam Jorgensen
@OOPMan
Nvm, I worked it out
It's due to the main method changes in Scala 3
Siddhant Sanyam
@siddhant3s
In Mill I can do -i _.replto get an Ammonite REPL. Can Ammonite do the same with SBT easily?
Adam Jorgensen
@OOPMan
@siddhant3s it's pretty easy to use Ammonite within SBT but you do need to tweak the sample SBT stuff from the site if you're using Scala 3
Siddhant Sanyam
@siddhant3s
Are we talking about these steps: http://ammonite.io/#RunningAmmoniteREPL ?
Miguel Pérez Pasalodos
@mpasa
Hello! Somebody knows if I can use Coursier to get a list of jars of some dependencies? The goal is to get the jars, import them locally and then send them to remote Spark executors using -Dspark.files
nafg
@nafg
Yes you can
Chris Kipp
@ckipp:matrix.org
[m]
In the latest version of Ammonite I get the following simply when trying to do an import
❯ amm
Loading...
Welcome to the Ammonite Repl 2.3.8-124-2da846d2 (Scala 2.13.6 Java 11.0.11)
@ import scala.util.Try
error while loading NotGiven, Missing dependency 'Add -Ytasty-reader to scalac options to parse the TASTy in /Users/ckipp/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.0.0/scala3-library_3-3.0.0.jar(scala/util/NotGiven.class)', required by /Users/ckipp/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.0.0/scala3-library_3-3.0.0.jar(scala/util/NotGiven.class)
error while loading FromDigits, Missing dependency 'Add -Ytasty-reader to scalac options to parse the TASTy in /Users/ckipp/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.0.0/scala3-library_3-3.0.0.jar(scala/util/FromDigits.class)', required by /Users/ckipp/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.0.0/scala3-library_3-3.0.0.jar(scala/util/FromDigits.class)
error while loading CommandLineParser, Missing dependency 'Add -Ytasty-reader to scalac options to parse the TASTy in /Users/ckipp/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.0.0/scala3-library_3-3.0.0.jar(scala/util/CommandLineParser.class)', required by /Users/ckipp/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.0.0/scala3-library_3-3.0.0.jar(scala/util/CommandLineParser.class)
error while loading LowPriorityNotGiven, Missing dependency 'Add -Ytasty-reader to scalac options to parse the TASTy in /Users/ckipp/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.0.0/scala3-library_3-3.0.0.jar(scala/util/LowPriorityNotGiven.class)', required by /Users/ckipp/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.0.0/scala3-library_3-3.0.0.jar(scala/util/LowPriorityNotGiven.class)
Compilation Failed
why it it looking in Scala3 jars?
nevermind, I see it's reported already com-lihaoyi/Ammonite#1182
@keynmol: just a step ahead of me
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
I had to pin the ammonite version to one released for 2.13.4 to unbreak my things :-)