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
discobaba
@uncleweirdo_twitter
Legions of scala fans are anxiously waiting ;-)
discobaba
@uncleweirdo_twitter
Well, I was originally using the "main" method because of a need to pass arguments and just kind of simplified them away to illustrate the failure I was getting. How does one pass arguments to a scala 3 amm script? Or better, where are the examples?
Lorenzo Gabriele
@lolgab
I think this is not supported on Scala 3 at all yet
You can try in scala-cli
discobaba
@uncleweirdo_twitter
Yeah, that works. Thanks
bblfish
@bblfish:matrix.org
[m]
I try using source but I get the error
@ source(new java.util.ArrayList())
cmd5.sc:1: could not find implicit value for parameter pprinter: pprint.PPrinter
val res5 = source(new java.util.ArrayList())
                 ^
Compilation Failed
I am using Ammonite Repl 2.5.4 (Scala 2.13.8 Java 18.0.1.1)
I deleted my old .ammonite directory
Saqib Saleem
@saqib-trywe
Hi - I’ve come back to using ammonite after a fairly longtime and ls! no longer works. Infact other nice syntax like |? also no longer works. Has this been removed?
4 replies
ben
@ben:matrix.iofel.me
[m]
Thats a good question, how do you use grep with the new os lib?
Li Haoyi
@lihaoyi
it was changed when we dropped ammonite-ops in favor of os-lib
you can probably copy the old code and make it work, but i don't personally use it and we stopped supporting jt
ben
@ben:matrix.iofel.me
[m]
grep is still there by default, how would you use it now?
Li Haoyi
@lihaoyi
i don't haha, probably should have removed it as well
Jakob Vad Nielsen
@lazee
Hi. This has probably been answered many times before...Is it possible to get IntelliJ to import external dependencies these days for Ammonite scripts? I have tried to follow guides like https://www.baeldung.com/scala/ammonite-scripting, but no matter what I do, cats-effect and other packages are not imported. Any tips or recommendations for other IDEs where Ammonite scripting works like a charm ?
image.png
Hard to code when everything looks like this. I have tried the $ivy.{} way of importing packages, but IntelliJ still doesn't import the packages.
ben
@ben:matrix.iofel.me
[m]
$ivy works for me in intellij
Sometimes i have to use Option + enter and ask it to download the library
Florian Schmaus
@Flowdalic

I get

java.lang.NoSuchMethodError: 'void geny.Writable.$init$(geny.Writable)'
  upickle.Api$$anon$1.<init>(Api.scala:94)
  upickle.Api.stream(Api.scala:94)
  upickle.Api.stream$(Api.scala:92)
  upickle.default$.stream(Api.scala:157)
  ammonite.runtime.Storage$Folder$$anon$33.update(Storage.scala:220)

when trying to embed ammonite in a Scala 3.1.2 project

Ok, manually adding ivy"com.lihaoyi::upickle:2.0.0", to the deps fixes it
uh, and I also run into com-lihaoyi/Ammonite#1250
Carlos Eduardo de Paula
@carlosedp:matrix.org
[m]
Hi all, I wrote an ammonite script to check for updated plugins on .sc files (both ammonite scripts and build.sc which is a script itself). Would love to hear some feedback.
https://gist.github.com/carlosedp/c3ea2814ac5392051a562e95c1298239
Florian Schmaus
@Flowdalic
The following fails with a ton of exceptions. I see that Guice is involved. Is this a known issue when executing Guice related stuff via ammonite?
```
#!/usr/bin/env amm-3.1

import $ivy.`io.github.cdancy:jenkins-rest:1.0.1`

val client = com.cdancy.jenkins.rest.JenkinsClient
  .builder()
  .endPoint("https://example.org")
  .build()
ghc1001
@ghc1001

How can I get Ammonite to read Scala artifacts from the Coursier cache
(defaults to ~/.cache/coursier/v1/https/repo1.maven.org/maven2/)?

I'm new to Ammonite and Scala. I installed Ammonite with Coursier. I can run
the Ammonite REPL just fine. However, when I try e.g.:

@ import $ivy.{
        `org.apache.spark::spark-core:3.1.2`,
        `org.apache.spark::spark-sql:3.1.2`
    }

Failed to resolve ivy dependencies:Error downloading org.apache.spark:spark-core_2.13:3.1.2                                             │-rwxrwxr-x 1 ghc1001 ghc1001   1235 Sep 25 12:22 sbt*
not found: /home/ghc1001/.ivy2/local/org.apache.spark/spark-core_2.13/3.1.2/ivys/ivy.xml                                               │-rwxrwxr-x 1 ghc1001 ghc1001   1149 Sep 25 12:22 sbtn*
not found: https://repo1.maven.org/maven2/org/apache/spark/spark-core_2.13/3.1.2/spark-core_2.13-3.1.2.pom                            │-rwxrwxr-x 1 ghc1001 ghc1001 128933 Sep 25 12:21 scala*
Error downloading org.apache.spark:spark-sql_2.13:3.1.2                                                                                 │-rwxrwxr-x 1 ghc1001 ghc1001 128932 Sep 25 12:22 scalac*
not found: /home/ghc1001/.ivy2/local/org.apache.spark/spark-sql_2.13/3.1.2/ivys/ivy.xml                                                │-rwxrwxr-x 1 ghc1001 ghc1001   1253 Sep 25 12:22 scala-cli*
not found: https://repo1.maven.org/maven2/org/apache/spark/spark-sql_2.13/3.1.2/spark-sql_2.13-3.1.2.pom      

Because I have no /home/ghc1001/.ivy2/. Fetching the artifacts with cs works, however:

cs fetch org.apache.spark::spark-core:3.1.2

(base) ghc1001@hippo:~/dot/scala/scala/data/kaggle$ cs fetch org.apache.spark::spark-core:3.1.2
https://repo1.maven.org/maven2/org/apache/kerby/kerb-client/1.0.1/kerb-client-1.0.1.jar                                           
100.0% [##########] 110.4 KiB (1.2 MiB / s)                                                                                     

[snip, snip]

(base) ghc1001@hippo:~$ find /home/ghc1001/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/spark/spark-core_2.12/ -ls
68160609      4 drwxrwxr-x   3 ghc1001   ghc1001       4096 Sep 25 17:22 /home/ghc1001/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/spark/spark-core_2.12/
68160610      4 -rw-rw-r--   1 ghc1001   ghc1001         20 Sep 25 17:22 /home/ghc1001/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/spark/spark-core_2.12/.maven-metadata.xml__sha1.computed
68160613      4 -rw-rw-r--   1 ghc1001   ghc1001         40 Jul 15 10:47 /home/ghc1001/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/spark/spark-core_2.12/.maven-metadata.xml__sha1
68160614      0 -rw-rw-r--   1 ghc1001   ghc1001          0 Sep 25 17:22 /home/ghc1001/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/spark/spark-core_2.12/.maven-metadata.xml.checked
68160615      4 drwxrwxr-x   2 ghc1001   ghc1001       4096 Sep 25 17:22 /home/ghc1001/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/spark/spark-core_2.12/3.1.2
68160619      4 -rw-rw-r--   1 ghc1001   ghc1001         40 May 24  2021 /home/ghc1001/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/spark/spark-core_2.12/3.1.2/.spark-core_2.12-3.1.2.pom__sha1
68160700      4 -rw-rw-r--   1 ghc1001   ghc1001         40 May 24  2021 /home/ghc1001/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/spark/spark-core_2.12/3.1.2/.spark-core_2.12-3.1.2.jar__sha1
68160617     36 -rw-rw-r--   1 ghc1001   ghc1001      34209 May 24  2021 /home/ghc1001/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/spark/spark-core_2.12/3.1.2/spark-core_2.12-3.1.2.pom
68160618      4 -rw-rw-r--   1 ghc1001   ghc1001         32 May 24  2021 /home/ghc1001/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/spark/spark-core_2.12/3.1.2/.spark-core_2.12-3.1.2.pom__md5
68160706      4 -rw-rw-r--   1 ghc1001   ghc1001         20 Sep 25 17:22 /home/ghc1001/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/
QUESTION: How can I get Ammonite to read the Scala artifacts from the Coursier cache e.g. ~/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/spark/spark-core_2.12/
Lorenzo Gabriele
@lolgab
Ammonite is on Scala 2.13 while cs is downloading the 2.12 artifacts. Try to install ammonite for Scala 2.12 in a separate binary like amm212
ghc1001
@ghc1001
Thanks for your answer @lolgab! I thought that Coursier might be the issue (so maybe it's really a Coursier question, not an Ammonite question), so I followed the instructions on (base) ghc1001@hippo:~/dot/scala/scala$ sudo sh -c '(echo "#!/usr/bin/env sh" && curl -L https://github.com/com-lihaoyi/Ammonite/releases/download/2.5.4/2.13-2.5.4) > /usr/local/bin/amm && chmod +x /usr/local/bin/amm' && amm
[sudo] password for ghc1001:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 46.1M 100 46.1M 0 0 33.2M 0 0:00:01 0:00:01 --:--:-- 61.9M
Loading...
Welcome to the Ammonite Repl 2.5.4-33-0af04a5b (Scala 2.13.9 Java 11.0.16)
@ import $ivy.{
org.apache.spark::spark-core:3.1.2,
org.apache.spark::spark-sql:3.1.2
}
Failed to resolve ivy dependencies:Error downloading org.apache.spark:spark-core_2.13:3.1.2
not found: /home/ghc1001/.ivy2/local/org.apache.spark/spark-core_2.13/3.1.2/ivys/ivy.xml
not found: https://repo1.maven.org/maven2/org/apache/spark/spark-core_2.13/3.1.2/spark-core_2.13-3.1.2.pom
Error downloading org.apache.spark:spark-sql_2.13:3.1.2
not found: /home/ghc1001/.ivy2/local/org.apache.spark/spark-sql_2.13/3.1.2/ivys/ivy.xml
not found: https://repo1.maven.org/maven2/org/apache/spark/spark-sql_2.13/3.1.2/spark-sql_2.13-3.1.2.pom
ghc1001
@ghc1001
@lolgab i see what you mean. so i did the following (on the Ammonite REPL installed by Coursier, which I guess is a Scala 2.13 implementation from what you said):

@ import $ivy.{
org.apache.spark::spark-core:3.2.1,
org.apache.spark::spark-sql:3.2.1
}
import $ivy.$

https://repo1.maven.org/maven2/org/apache/spark/spark-sql_2.13/3.2.1/spark-sql_2.13-3.2.1.pom
100.0% [##########] 18.3 KiB (67.6 KiB / s)
https://repo1.maven.org/maven2/org/apache/spark/spark-core_2.13/3.2.1/spark-core_2.13-3.2.1.pom

[snip, snip]

@ import org.apache.spark.sql.
import org.apache.spark.sql.

@ org.apache.spark.sql.
AnalysisException LowPrioritySQLImplicits catalog
Column RelationalGroupedDataset catalyst
ColumnName Row columnar
CreateTableWriter RowFactory connector
DataFrame RuntimeConfig errors
DataFrameNaFunctions SQLContext execution
DataFrameReader SQLImplicits expressions
DataFrameStatFunctions SaveMode functions
DataFrameWriter SparkSession internal
DataFrameWriterV2 SparkSessionExtensions jdbc
Dataset SparkSessionExtensionsProvider sources
DatasetHolder Strategy streaming
Encoder TypedColumn test
Encoders UDFRegistration types
ExperimentalMethods WriteConfigMethods util
ForeachWriter package vectorized
KeyValueGroupedDataset api
@

so that seems to be working, meaning a different version of Spark (3.2.1) running on the Scala 2.13 Ammonite installed by Coursier.
Lorenzo Gabriele
@lolgab
Yes, it seems that the first spark version supporting Scala 2.13 is 3.2.0: https://repo1.maven.org/maven2/org/apache/spark/spark-sql_2.13/
There is also 3.3.0 out :)
Chris Kipp
@ckipp:matrix.org
[m]
Would it be possible to get a new stable release of Ammonite?
especially now with com-lihaoyi/Ammonite#1300 merged
the main reason is that the last stable release for 2.13, which is 2.5.4, was published against 2.13.8, which has a published CVE against it.
so at work when we build our images (which have Ammonite in them) it fails our security check because it's bringing in 2.13.8
it'd be amazing to have a new stable (we're required to use stables) that brings in the new 2.13.x
Tobias Roeser
@tobiasroeser:matrix.org
[m]
Sure, I'll cut it.
Chris Kipp
@ckipp:matrix.org
[m]
amazing, thank you!
Tobias Roeser
@tobiasroeser:matrix.org
[m]
Done
HamishPoole
@HamishPoole

G'day fellas.

Quick question. Having a minor reflection issue that pops up intermittently. "Bad symbolic reference. A signature refers to JFunction1$mcDD$sp/T in package scala.runtime.java8 which is not available."

My best guess is the root cause is I'm using Ammonite 2.5.5 with Scala 3.2.0 from https://github.com/com-lihaoyi/Ammonite/releases/download/2.5.5/3.2-2.5.5 and I've misconfigured something related to the Scala version.

me@pop-os:/usr/local/bin$ scala --version
Scala code runner version 3.2.0 -- Copyright 2002-2022, LAMP/EPFL
me@pop-os:/usr/local/bin$ /usr/local/bin/amm
Loading...
Welcome to the Ammonite Repl 2.5.5 (Scala 3.2.0 Java 11.0.16.1)
@ scala.util.Properties.versionString
res0: String = "version 2.13.10"

Can I just confirm whether the scala.util.Properties.versionString vs my shell's Scala version vs the Ammonite REPL welcome screen Scala version is working as intended? I assume I've made a mismatch along the way.

Lorenzo Gabriele
@lolgab
@HamishPoole Scala 3 is known to return a 2.13 version since it's using the scala-library from 2.13 behind the hood. You can read more here: https://stackoverflow.com/a/6968014
I think this is unrelated with your issue.
HamishPoole
@HamishPoole

Ah thanks, makes sense.
Bad symbolic reference. A signature refers to JFunction1$mcDD$sp/T in package scala.runtime.java8 which is not available. It may be completely missing from the current classpath, or the version on the classpath might be incompatible with the version used when compiling the signature.

I'll open an issue for this then, if it's using an inbuilt runtime.java8.

Joan Goyeau
@joan38
Hi,
Do you know why ammonite-terminal is not published for Scala 3?
https://mvnrepository.com/artifact/com.lihaoyi/ammonite-terminal
Lorenzo Gabriele
@lolgab
@joan38 The Scala3 build for ammonite is actually built using Scala 2.13. I think this is the artifact you're looking for: https://repo1.maven.org/maven2/com/lihaoyi/ammonite-cross-3.2.0-terminal_2.13/
2 replies
Eazzor
@Eazzor
Hi! Is there any way to disable automatic indentation of input in the REPL?
Joan Goyeau
@joan38
This message was deleted
Namsi
@selim-namsi
Hi! is there a way to print the classpath used by ammonite after loading all the dependencies from predef.sc ?