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
Tobias Roeser
@lefou
For Java deps use a single colon before the artifact name
1 reply
Glen Marchesani
@fizzy33
@lihaoyi I figured it all out by staring at the mill code, thanks again for your assistance. I can see in MainRunner how a CustomCodeWrapper is used and then in RunScipt the def millSelf = Some(this) that is provided in the CustomCodeWrapper is called to get the actual modeul insance. that is the pattern I needed.
Glen Marchesani
@fizzy33
once I have the module instance I am off to the races getting the rest of what I need via plain old java.reflect
mvillafuertem
@mvillafuertem
Hi all, Is there a straightforward way of a creating a JAR from a given Ammonite script with $ivy dependencies?
Thomas Dickerson
@elfprince13
is there a standard predef somewhere that I'm missing if I just downloaded the bootstrap script?
I'm seeing:
Welcome to the Ammonite Repl 2.4.0 (Scala 2.13.6 Java 1.8.0_121)
@ wd
cmd0.sc:1: not found: value wd
val res0 = wd
           ^
Compilation Failed
Thomas Dickerson
@elfprince13
hmmm, found the example predef, but can't seem to configure my prompt?
thomas-Downloads@ repl.colors().prompt() = fansi.Attrs.Empty
cmd0.sc:1: value colors in trait FullReplAPI cannot be accessed as a member of ammonite.repl.FullReplAPI from object cmd0 in package $sess
 Access to protected value colors not permitted because
 enclosing object cmd0 in package $sess is not a subclass of
 trait FullReplAPI in package repl where target is defined
val res0 = repl.colors().prompt() = fansi.Attrs.Empty
                ^
Compilation Failed
Thomas Dickerson
@elfprince13
okay, got that figured out, but can't get my colors to actually apply.
@lihaoyi - tried following suggested setup in #399 and I can (a) construct a colored string, (b) reset the prompt color
but I can't actually get the prompt to use the colors in the string
I have this snippet:
interp.colors().prompt() = fansi.Color.Reset
{
  val hostname:String = (%%hostname("-s")).out.string.trim
  val Home = Path(sys.props("user.home"))
  val username = sys.props("user.name")
  import fansi.Color._
  repl.prompt.bind("" + DarkGray("[") + LightBlue(username) + DarkGray("@") + LightMagenta(hostname) + DarkGray("] ") + LightGray(wd match { case Home => "~"; case `root` => "/"; case other => other.baseName }) + DarkGray(" $") + Reset(" "))
}
and Console.println(repl.prompt() shows the correct colors, but the actual prompt is reset to white
Li Haoyi
@lihaoyi
Can you replace fansi.Colors.Reset with fansi.Attrs.Empty
I think the interp.colors.prompt is being applied on top of the repl.prompt and resetting all your colors
Thomas Dickerson
@elfprince13
gotcha
that appears to work =)
Naftoli Gugenheim
@nafg
Is it possible to import a .scala file?
James Kyle
@jameskyle
When I make a change to the build.sbt, I get the error GITHUB REF None fatal: no tag exactly matches 'the ref'. Is there a way to bypass this check?}
James Kyle
@jameskyle
hm, got past that. Trying to figure out how to shade a dependency
James Kyle
@jameskyle

I'm trying to run a spark session in the repl. There's a conflict between the bundled spark version, 2.5, of protobuf and the tertiary dependency pulled in by scalapb of protobuf (3.15). Scalapb says this should be shaded to avoid conflicts with spark.

Not sure how to do this with mill

Naftoli Gugenheim
@nafg
Suppose I want to reuse local bits of code between the SBT build and the mill build, and I don't want to just symlink the same file as .scala and .sc. It occurred to me that it might be possible if Ammonite exposes an API to invoke a method in a script file
That is, suppose I have a Util.sc file like this:
object Util {
  def api(param: Int) = "result"
}
In Mill I can just do import $file.Util; Util.api(7) == "result"
In SBT, perhaps I could access the ammonite script runner as a library, parse Util.sc, and tell it to invoke "Util.api(${7})" somehow?
James Kyle
@jameskyle
Just checking in on any guidance on how to shade a dependency in a ammonite repl build
Zhranklin
@zhranklin
Hi, how to use interp.configureCompiler with scala 3?
Tobias Roeser
@lefou
@lihaoyi / @alexarchambault I'd like to access the input files of a mill build script build.sc which are the build.sc and all the included .sc files and magic imports to make them available via BSP, for a better editing experience. Is there a way to access these info easily?
0xACE
@0xACE
is there a way to get ammonite.ops working from jupyter notebooks?
import ammonite.ops._
ls! pwd
sh: line 1: /dev/tty: No such device or address
java.lang.RuntimeException: Nonzero exit value: 1
  scala.sys.process.ProcessBuilderImpl$AbstractBuilder.slurp(ProcessBuilderImpl.scala:164)
  scala.sys.process.ProcessBuilderImpl$AbstractBuilder.$bang$bang(ProcessBuilderImpl.scala:121)
Florian Schmaus
@Flowdalic
Is there a way to define a @main method as default method if no other is explicitly selected?
Li Haoyi
@lihaoyi
there isnt, but such a feature coupd be added (assuming positional args are disabled)
Florian Schmaus
@Flowdalic
@lihaoyi I wonder if it couldn't even be added with positional arguments
You simply check if the first argument is a known command, and if not, invoke the default method with the positional arguments shifted by one
Wouldn't that work?
thanks for your work on Ammonite :)
Lorenzo Gabriele
@lolgab
I'm trying to understand how the Scala 3 build works in Ammonite but I'm failing miserably :-D
So, the modules are compiled with Scala 2.13 but use the Scala 3 dependencies?
Because using withDottyCompat or not makes no difference if the module is using supports3 = false.
Is that intended?
For example, this PR made no difference: com-lihaoyi/Ammonite#1224
Since the dependencies chosen are still _2.13 since scalaVersion is 2.13
Is ammonite very special or do we miss in Mill the Scala 2.13 3 that Sbt has? 🤔
Lorenzo Gabriele
@lolgab
From what I'm understanding, Ammonite builds its modules twice, one for Scala 2.13 and one for Scala 3. These two modules are both Scala 2.13 modules with the only difference that one depends on Scala 3 dependencies (when available) and the other is the usual Scala 2.13 module.
Is this correct?
Lorenzo Gabriele
@lolgab
I think what's tricking me is a problem in Mill that doesn't support mixing Scala 3 and Scala 2.13 projects as sbt does.
If a 2.13 project depends on a 3 project all the scala 3 dependencies are automatically converted into _2.13 dependencies in Mill, while they maintain the _3 suffix in Sbt.
Tobias Roeser
@lefou
@lolgab I quickly implemented what I think is needed to fix this issue. I haven't done any tests etc., but if you want to try it have a look at PR com-lihaoyi/mill#1574
If you do, let me know it it works
Csaba Kincses
@kincsescsaba
Hello there! I'm new to Ammonite, and I'm trying to figure out how can I display stdout output continuously. As I see in the docks, chunks are stored, but how can I get these in the case when the program runs for long and it's not enough to only display the output at the end of the run but also before it finished?
Lorenzo Gabriele
@lolgab
@kincsescsaba You could use tee https://stackoverflow.com/a/418899
discobaba
@uncleweirdo_twitter
MainArgs is pretty awesome but I think it would be nice to have an option to have a @main that didn't show up in the help. Or maybe I'm just missing how to do it ...
Lorenzo Gabriele
@lolgab
@uncleweirdo_twitter There is an open issue for that com-lihaoyi/mainargs#4
discobaba
@uncleweirdo_twitter
@lolgab sweet
Siddhant Sanyam
@siddhant3s

this version which got added today has a bug: https://repo.maven.apache.org/maven2/com/lihaoyi/ammonite-repl_2.12.12/2.4.1-6-5f9cddf3/

When running ammonite it says "No main method found in ammonite.Main"

Chris Kipp
@ckipp:matrix.org
[m]
looks like there is a pr to fix this already coursier/apps#125