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 14:37
    bhaskarmelkani starred lihaoyi/Ammonite
  • Jan 29 04:27
    JYInMyHeart starred lihaoyi/Ammonite
  • Jan 29 04:27
    JYInMyHeart starred lihaoyi/Ammonite
  • Jan 28 15:07
    ishubelko starred lihaoyi/Ammonite
  • Jan 25 22:38
    borissmidt starred lihaoyi/Ammonite
  • Jan 25 17:12

    alexarchambault on 1.6.3

    (compare)

  • Jan 25 17:11

    alexarchambault on master

    1.6.3 (compare)

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

    lihaoyi on gh-pages

    5ad9ae5538f23cab92ccd8c6b1617d8… (compare)

  • Jan 25 00:50

    alexarchambault on master

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

  • Jan 25 00:50
    alexarchambault closed #923
  • Jan 25 00:50
    alexarchambault closed #920
  • Jan 25 00:50
    alexarchambault closed #922
  • Jan 24 23:13
    lihaoyi commented #923
  • Jan 24 22:39
    alexarchambault closed #921
  • Jan 24 22:39
    alexarchambault commented #921
  • Jan 24 22:39
    alexarchambault edited #923
  • Jan 24 22:38
    alexarchambault opened #923
  • Jan 24 22:37
    david-bouyssie commented #919
  • Jan 24 21:33
    nksureshkumar commented #922
Paul S.
@pshirshov
Hi guys. Could you give me a hint if I workaround dependency convergence in ammonite somehow? My script depends on scopt v4 and seems clashes with the version shipped with ammonite. --thin doesn't help for some reason
Paul S.
@pshirshov
@here: could someone tell me if I can somehow override magic import behaviour so it would load a file with .scala extension?..
2efper
@2efPer
Does ammonite has paste mode?
jvr-ks
@jvr-ks
@2efPer Put the code inside { ... }
Tim Harper
@timcharper
Does ammonite have the equivalent of $0 (i.e. from bash SCRIPT_DIR=$(dirname "$0")) ? I'd like my script to be relatively invocable
Li Haoyi
@lihaoyi
I think you can use sourccode.File
Tim Harper
@timcharper
neat, that does it!
oh... no :(
does not include the path
// lol.sc
println(sourcecode.File())
$ amm lol.sc
lol.sc

$ cd ..
$ amm tim/lol.sc
lol.sc
Tim Harper
@timcharper
so, no, unfortunately this does not work. The docs for sourcecode say it gives the full path but something magic must be happening
Li Haoyi
@lihaoyi
probably a bug in ammonite
can you open an issue?
it should be the full path everywhere
Srepfler Srdan
@schrepfler
the homebrew casks are no longer getting published ?
Bassel
@Shokodemon
hey ho is there a way to set ammote repl prompt from the build.sbt ?
Tim Harper
@timcharper

@lihaoyi I found this issue, looks like the same one; should I reopen it? lihaoyi/Ammonite#493

I've confirmed the bug in 1.5.x Ammonite and also in 1.7.1

Li Haoyi
@lihaoyi
sure
Can anyone take a look at this question on shell script
Matthew de Detrich
@mdedetrich

So I just upgraded to Amm 1.7.1 and I am getting the following

Logistics.sc:6: not found: value coursier
import coursier.core.Authentication, coursier.MavenRepository
       ^
Logistics.sc:6: not found: value coursier
import coursier.core.Authentication, coursier.MavenRepository

when trying to specify authentication settings for a repository

for some reason the coursier variable is no longer visible?
ahhh its coursierapi now
Matthew de Detrich
@mdedetrich
Hmm actually I am having a problem here, for some reason Authentication is not visible in the coursier api
Matthew de Detrich
@mdedetrich
In fact it seems to be impossible to add a repository to interp.repositories() that requires authentication?
Brian Maso
@bmaso
I literally had a dream last night of being able to plot out visualizations in a scala REPL (a la a jupyter notebook with matplot). With regard to that, can anyone offer a rough sketch of what modifications would be necessary in Ammonite to support outputting an image as the response to a line of code in Ammonite?
Sören Brunk
@sbrunk
@bmaso perhaps not exactly the same but you can use Ammonite with support for embedded plots in an actual Jupyter notebook via https://almond.sh
Brian Maso
@bmaso
@sbrunk Thanks. I hadn't realized jupyter-scala had advanced somewhat -- last time I had tried to use it it, it was a bit krufty.
Anton Kulaga
@antonkulaga
Stupid question: how one can pre-compile ammonite script without running it?
In my docker container I have a script with one @main() method, I want to precompile when I build docker container so the user will not wait much, but I do not want the main function to be run.
ReiReiRei
@ReiReiRei
Hi all, is it any workaround for lihaoyi/Ammonite#763 ?
Alexandre Archambault
@alexarchambault
@ReiReiRei The workaround described in the issue should work with the latest releases of Ammonite.
ReiReiRei
@ReiReiRei
@alexarchambault the problem is I am using spark 2.3.1/scala 2.11 and almond-spark The highest version for scala 2.11 almond-spark is 0.6.0 and uses old version of ammonite
hmf
@hmf
I have asked this question in the Mill channel but I think it is more of a Ammonite question. How can I get the path of a class define in the a script (defined in an external file script)? I need to add this to a classpath for dynamic class loading. TIA
ReiReiRei
@ReiReiRei
@lihaoyi @alexarchambault so does it mean that ammonite does not support most stable version of spark correctly? beacase spark is officially still on 2.11 scala
Alexandre Archambault
@alexarchambault
@hmf Not 100% sure I understand your question, but repl.sess.frames.flatMap(_.classloader.inMemoryClasses) gives a list of class names / class byte code generated by the repl.
@ReiReiRei I'm afraid so, as it stands currently. 2.11 is getting quite old, 2.12 has been out for almost 3 years now(!)
ReiReiRei
@ReiReiRei
@alexarchambault but a lot of spark libs a based on only 2.11 spark ) hadoop distributions( cloudera hortonworks does not support spark based on scala 2.12 yet)
is it possible to say to old version of ammonite not to add sources to classpath ? something like this ? interp.resolutionHooks += { fetch => fetch.withClassifiers(fetch.classifiers.filter(_ != "sources")) }
hmf
@hmf
@alexarchambault Thanks for the feedback. Don't think that will do - I am running a Mill script. I need to get hold of the .class file of an object (extends PostModifier) and place it on the classpath for dynamic loading by another library (MDoc). Is this doable?
trepidacious
@trepidacious
Is it possible to disable the "extra" printing in the ammonite repl (e.g. imports, defining variables etc.)? I'm using it from almond and it's great, but I don't need the extra output, just the results of println and explicitly sending plots etc. to the worksheet.
Crosson David
@dacr

Hi, any idea why I get java.lang.ClassNotFoundException: scala.jdk.CollectionConverters$ issues with amm-2.12-1.7.4 and not with amm-2.13-1.7.4, and not at all within the test (sbt +test) of my project which cross-compiles 2.11, 2.12, 2.13 (https://github.com/dacr/drools-scripting) using scala-collection-compat library.

10:46 $ amm-2.12-1.7.4 drools-hello-world.sc 
Compiling (synthetic)/ammonite/predef/interpBridge.sc
Compiling (synthetic)/ammonite/predef/sourceBridge.sc
Compiling (synthetic)/ammonite/predef/frontEndBridge.sc
Compiling (synthetic)/ammonite/predef/DefaultPredef.sc
Compiling /home/dcr/notes/scripts/drools-hello-world.sc
drools$minushello$minusworld$HelloTest:
Drools
ammonite.$file.drools$minushello$minusworld$HelloTest$ *** ABORTED ***
...
10:48 $ amm-2.13-1.7.4 drools-hello-world.sc 
Compiling (synthetic)/ammonite/predef/interpBridge.sc
Compiling (synthetic)/ammonite/predef/sourceBridge.sc
Compiling (synthetic)/ammonite/predef/frontEndBridge.sc
Compiling (synthetic)/ammonite/predef/DefaultPredef.sc
Compiling /home/dcr/notes/scripts/drools-hello-world.sc
drools$minushello$minusworld$HelloTest:
Drools
- should say hello

I'm not sure it is a bug, if it is I'll fill a dedicated issue, the executed code is the following : https://gist.github.com/dacr/6921d569fd33182da358d6a8e383aa0a :

import $ivy.`org.scalatest::scalatest:3.0.8`
import $ivy.`fr.janalyse::drools-scripting:1.0.1`

import org.scalatest._, org.scalatest.OptionValues._
import fr.janalyse.droolscripting._

object HelloTest extends FlatSpec with Matchers {
  "Drools" should "say hello" in {
    val drl =
      """package testdrools
        |rule "hello" when
        |then
        |  insert("HELLO WORLD");
        |end
        |""".stripMargin
    val engine = DroolsEngine(drl)
    engine.fireAllRules()
    engine.getObjects.headOption.value shouldBe "HELLO WORLD"
  }
}
HelloTest.execute()
May be because ammonite is using an old release of ("org.scala-lang.modules" %% "scala-collection-compat") "2.0.0" while the latest is "2.1.2" ?
Crosson David
@dacr
Yes I've just checked it and it was coming from this old release :)
Pull request sent. lihaoyi/Ammonite#1011
nsram
@nsram_twitter
Just started using Li Haoyi's work. Needed to load jars from a local folder due to limited internet access. The following worked.
@  val jarpath = pwd / 'dev / 'jar  // local folder with jars
@  ls! jarpath | interp.load.cp
Brian Maso
@bmaso
:thumbsup: That's pretty cool
nsram
@nsram_twitter
On ubuntu, I am not seeing the color syntax highlighting for error stack trace (its all red). Colors are working normally otherwise. Amm 1.7.1
Milan Satala
@msatala

Hi guys,
ammonite-sshd doesn't run predef when running inside docker container.
I'm running ammonite embedded in play server. When I start play via runProd and connect to ammonite via ssh I get this

Compiling /home/milan/dev/traceability/traceability/server/playserver/target/universal/stage/(console)
Setting front-end. // My println in predef
Welcome to the Ammonite Repl 1.7.4

However when I run the same play server inside alpine-java docker container I only get this:

Password: 
Welcome to the Ammonite Repl 1.7.4

Any ideas?

Glen Marchesani
@fizzy33
anyone know of a simple way to use ammonite as a server side scripting language ?
Olivier Mélois
@Baccata
@fizzy33 can you refine your question ? ammonite provides you with a way to access a repl over ssh, and you can can embed it in a server : http://ammonite.io/#RemoteREPL , but that might not be what you need
@msatala chances your docker container doesn't see your predef. It's likely a docker problem, not an ammonite problem.