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
Li Haoyi
@lihaoyi
I support two major versions :)
feel free to bump whatever failing mill tests to 2.12
Olivier Mélois
@Baccata
Okeydo 👍
Bassel
@Shokodemon

trying to parse docker logs, and im getting the following throwbale

java.lang.IllegalArgumentException: Unknown ansi-escape at index 3083 inside string cannot be parsed into an fansi.Str
 fansi.ErrorMode$Throw$.handle(Fansi.scala:417)
  fansi.ErrorMode$Throw$.handle(Fansi.scala:405)
  fansi.Str$.apply(Fansi.scala:270)
  fansi.Str$.implicitApply(Fansi.scala:225)
  pprint.Renderer.$anonfun$rec$27(Renderer.scala:136)
  pprint.Result$.fromString(Result.scala:53)
  pprint.Renderer.rec(Renderer.scala:136)
  pprint.Renderer.$anonfun$rec$15(Renderer.scala:97)
  scala.collection.Iterator$$anon$10.next(Iterator.scala:448)
  pprint.Util$ConcatIterator.check(Util.scala:32)
  pprint.Util$ConcatIterator.hasNext(Util.scala:40)
  pprint.Util$ConcatIterator.check(Util.scala:29)
  pprint.Util$ConcatIterator.hasNext(Util.scala:40)
  pprint.Util$ConcatIterator.check(Util.scala:29)
  pprint.Util$ConcatIterator.hasNext(Util.scala:40)
  pprint.Util$ConcatIterator.check(Util.scala:29)
  pprint.Util$ConcatIterator.hasNext(Util.scala:40)
  pprint.Util$ConcatIterator.check(Util.scala:29)
  pprint.Util$ConcatIterator.hasNext(Util.scala:40)
  pprint.Util$ConcatIterator.check(Util.scala:29)
  pprint.Util$ConcatIterator.hasNext(Util.scala:40)
  scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:500)
  pprint.Truncated.next(Truncated.scala:93)
  pprint.Truncated.next(Truncated.scala:11)
  scala.collection.Iterator$$anon$10.next(Iterator.scala:448)
  scala.collection.Iterator.foreach(Iterator.scala:929)
  scala.collection.Iterator.foreach$(Iterator.scala:929)
  scala.collection.AbstractIterator.foreach(Iterator.scala:1406)
  ammonite.repl.ReplApiImpl.show(ApiImpls.scala:105)
  ammonite.repl.ReplApiImpl.show$(ApiImpls.scala:92)
  ammonite.repl.Repl$$anon$1.show(Repl.scala:76)
  ammonite.repl.ReplApiImpl.show(ApiImpls.scala:88)
  ammonite.repl.ReplApiImpl.show$(ApiImpls.scala:88)
  ammonite.repl.Repl$$anon$1.show(Repl.scala:76)
  ammonite.$sess.cmd125$.<init>(cmd125.sc:1)
  ammonite.$sess.cmd125$.<clinit>(cmd125.sc)

is there any way i could preprocess the strings and get rid of those characters?

Bassel
@Shokodemon
i realized i can circumvent the errors using lines.map(line => (printf("s", line))
Li Haoyi
@lihaoyi
easiest would be to just println them yourself
you could also customize repl.pprinter to not try to be clever with strings, but that's more work (not that much more tho)
Andrew Richards
@ajrnz

Does the ammonite/mill's import $ivysyntax have anything equivalent to sbts classpathTypes which lets you import extra types of artifacts (just just jar/source etc)?
I am unable to use:

import $ivy.`org.vafer:jdeb:1.7`

because it declares its artifact to be type maven-plugin (not jar) and is ignored by coursier.

In sbt you can fix this with:

classpathTypes += "maven-plugin"

Any workaround?

Olivier Mélois
@Baccata
@ajrnz if you manage to download the artifact "manually" (there might be an option in the coursier API, otherwise you'll have to build the http request by hand), then you can call upon the interp api to load stuff into the classpath. That artifact is then taken into account for the compilation of the next stage of your script (or the downstream scripts) : http://ammonite.io/#Multi-stageScripts
Andrew Richards
@ajrnz

@Baccata Yeah that works. Not pretty though:

coursier fetch org.vafer:jdeb:1.7

and then

import $ivy.`org.vafer:jdeb:1.7`
interp.load.cp(Seq(os.Path(coursier.cache.CacheDefaults.location + "/https/repo1.maven.org/maven2/org/vafer/jdeb/1.7/jdeb-1.7.jar")))
@

It not obvious how/where you would insert this into the ammonite code

Vladyslav Pekker
@agilesteel

hi I just downloaded ammonite for the first time and am trying out the source command which doesn't seem to work at all

@ source(Some(1).map(identity)) 
Unable to find sourcecode for class scala.Option

is this a known issue? I'm on Ubuntu 18.04 in case that matters

Alexandros Bantis
@ambantis
Hi, I'm running ammonite 1.6.6 (2.11.12). How do I have the ammonite script exit with a non-zero exit code?
Olivier Mélois
@Baccata
@ambantis you can always call System.exit(1)
Bassel
@Shokodemon
hello all

i would like to use repl.sess.save and repl.sess.load in my scala code, - they are visible from the predef, but i would like to use them inside a class that belongs to a different package.

from what i understand, they become available after the shell is started with Main(), but id like the following piece of code to compile as well"

//  def getArtificats(
//                                                        service: String,
//                                                        serviceVersion: String,
//                                                        serviceDependencyVersion: String,
//                                                        namespace: String
//                                                      ) {
//
//
//    val sessionTag = s"$service:$serviceVersion:$serviceDependencyVersion"
//    repl.sess.save(sessionTag)
//
//    val dep = coursier.
//      Dependency(
//        coursier.Module(namespace, service),
//        serviceVersion,
//        attributes = coursier.Attributes(classifier = "fat")
//      )
//
//    printf(s"finished fetching dependencies for $service-$serviceVersion with dependencies from version $serviceDependencyVersion")
//    repl.sess.load(sessionTag)
//    printf(s"session $sessionTag restored ")
//  }
Bassel
@Shokodemon
not found: value repl
[error]     repl.sess.save(sessionTag)
[error]     ^
i am using ammonite 1.3.3 and importing as a dependency in SBT, and initializing it via Main(). .
Christopher Davenport
@ChristopherDavenport
Is there a trick to run this with 2.13 presently that I’m missing?
Li Haoyi
@lihaoyi
no? the default instructions are for 2.13
it’s on maven central for 2.13
no tricks required
Yann Moisan
@YannMoisan
hello. I have some .sc files. What do you suggest to unit test code in these files ?
aappddeevv
@aappddeevv
Is there a way to have ammonite automatically reload from a classpath changed files? I was looking through the docs but did not see anything that mentions this. My scenarios is similar to that using jupyter. I typically need to develop a library but need to test and play with the data interactively while building it out--a bit like TDD but more exploratory. So there is a separate continuous build task running on the library code but I am working at the repl. Python has something like this where it re-evaluates all imported packages prior to evaluating a user-entered expression.
Dan Di Spaltro
@dispalt
is there a 2.12.9 version available?
Binh Nguyen
@ngbinh
I remember there is a way to use ammonite version that was published for scala 2.12.8 with build that set scala version to 2.12.9 but I do not recall now
Amr Hassan
@superamr_twitter
Hello. Can we get a release for 2.12.9 please? :)
Victor Ivri
@vivri
Hi there, I'm using Ammonite 1.6.9 and Scala 2.13. For some reason, Futures seem to hang, as well as the (ported) parallel collections. I saw old posts about it; has this been fixed? If so, how?
Paul Snively
@paul-snively
Does anyone know how I would go about embedding Ammonite in an app, loading a .sc file from a directory, and ensuring definitions in the .sc are visible (by name) to the app? In other words, a classic “dynamic linking” scenario.
It looks like some combination of instantiateInterpreter and processModule heads in the right direction, but the details seem hazy, especially around accessing bindings in the .sc.
Li Haoyi
@lihaoyi
@PaulAtFormation I don’t think there’s any builtin way to do that, you have to poke around the internal-ish code. Look at how Mill does it (RunScript.scala or something like that)
basically you evaluate the script and get an untyped reference to the wrapper object. Mill then uses reflection to call stuff on the wrapper object, but you could just as easily cast the wrapper object to an interface (you’ll need to make it extend the interface via a custom CodeWrapper) and then call methods directly
Piotr Jander
@mhonadh_twitter
Hi, how do I refer to the last result? Something like _ in Python or it in ghci?
Piotr Jander
@mhonadh_twitter
Ok now I see it's res0 etc
After adding ammonite to my project's build sbt, I can run ammonite with sbt test:run. However, when I do sbt test, which previously would run my unit tests, I get java.util.NoSuchElementException: None.get. Did anyone encounter this?
Li Haoyi
@lihaoyi
@superamr_twitter the latest unstable release should be on 2.12.9
Quafadas
@Quafadas

Hoping someone can give me a pointer - I'm sat behind a corporate proxy trying to use ammonite. We have nexus setup between us and maven. I have successfully downloaded some ivy's into ammonite - import $ivy.com.lihaoyi::scalatags:0.7.0 works, which I think proves proves my predefs and coursier resolvers appear to be setup correctly.

I'd like to use com.github.seratch::awscala-s3:0.8.2, but that fails with an error that looks like; download error: Caught javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: . The same import (correctly formatted!) works (inside an sbt project), so I think the problem is that somehow ammonite is missing my corporate certificate.

Does this sound right? Is there a place I could attempt to add the cert so that ammonite knows about it? Any other hints or ideas?

Alexandre Archambault
@alexarchambault
@Quafadas coursier downloads these artifacts, the error originates from it.

Are you able to reproduce that error with the coursier CLI?
Calling it like

$ coursier resolve \
    --no-default \
    -r https://your-corporate-repo \
    com.github.seratch::awscala-s3:0.8.2

should result in an error IIUC your issue.

If that's the case, open an issue in the coursier repo
Also, the latest version of the coursier CLI shouldn't trap the stacktrace, it'll be helpful if you could add it in the issue.
Jon Keatley
@jckeatley
@Quafadas I have a similar situation at work. I set this environment variable before I run amm:
JAVA_OPTS='-Xmx1G -Djavax.net.ssl.keyStore=/etc/ssl/certs/java/cacerts -Djavax.net.ssl.keyStorePassword=changeit -Djavax.net.ssl.trustStore=/etc/ssl/certs/java/cacerts -Djavax.net.ssl.trustStorePassword=changeit'
I'm running an Ubuntu system, and I put any local certificates into /usr/local/share/ca-certificates/<my-cert-dir>, then I run update-ca-certificatesas root.
Jon Keatley
@jckeatley
On my Windows machine, I run Cygwin64, and I put the local certs into /etc/pki/ca-trust/source/anchors, then run 'update-ca-trust'. I then use the Windows path for the cacerts, like this: C:/cygwin64/etc/pki/ca-trust/extracted/java/cacerts
Quafadas
@Quafadas
@alexarchambault @jckeatley Thankyou both very much - I realised my biggest problem was that when I was trying to add the cert to the keystore, I had forgotten to elevate privelges, but hadn't spotted keytool erroring out...
You put no on the right path to testability, and @jckeatley your config works great. Thanks again.
Marvin Ward Jr.
@choct155
Hello All, I'm a big fan of the project, and I'd love to use it at work. Is it possible to launch the REPL using only the ammonite jar (as opposed to the executable)?
Andy Czerwonka
@andyczerwonka
@choct155 you can probably crib that from the launch script in the distro
Li Haoyi
@lihaoyi
the executable is a jar. Search the docs for “embed”
Marvin Ward Jr.
@choct155
Thanks for the replies @andyczerwonka and @lihaoyi . Apologies as well for being unclear. I know I can list the jar as a dependency and use it within a project (we have been doing this via SBT on toy projects). I'd like to be able to launch the repl from the command line with a "java" call, but I'm running into dependency issues (for example, running Ammonite.Main depends on os-lib). In general, it is more difficult than might be obvious to get new software approved and into our organization. This actually hangs up our use of SBT for the time being, because we need to generate fat JARs and we are without sbt-assembly in the short run. (I know about the Mill project, which looks super cool. Ultimately, however, it hangs up for the same reasons in the short run.) Since the ammonite JAR is available for use, I was wondering if I was just missing some obvious way to call the repl from the command line that does not require additional dependencies.