-
Notifications
You must be signed in to change notification settings - Fork 14
Scala distribution replacement proposal #326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Interesting! /CC @heathermiller |
I personally even do not bother installing Scala, as sbt is enough to make Scala projects work and for REPL there is ammonite-shell |
@retronym I am actually working on a smarter mechanism to cache classloaders for sbt plugins, it builds upon the same concepts you describe in the catalogue. Will submit PR soon. |
I routinely download the DEB or RPM files from the website to install Scala on all of my Linux machines. Is it really much work to provide those? I created DEB files of my own apps by SBT Native Packager and it has been quick and easy. |
What are you using the installed Scala distribution for? To do experiments in the REPL? I definitely see the value of packing a Scala app as deb package so that it can easily be installed. But the Scala distribution is quite limited, as it ships only with the standard library. |
Yes, experiments in the REPL. |
Hey @curoli. It's not so much work, but it is work to maintain. What we're hoping to do is pull the deb/rpm/zip/tgz distribution building out of the build and replace them with (proposed) scala-runners project, which is based on coursier's app launching capabilities). Scala Runners would be directly consumable by users, but my thinking is that it could also be used by package maintainers if they want to re-build the deb/rpm packages (also the Homebrew formula for macOS and Chocolately/Scoop packages for Windows). |
@curoli have you considered https://github.com/dwijnand/scala-runners for your REPL needs (if you're not on Windows?) |
Jinx |
Windows/BAT support is a requirement for scala-runners to be a replacement (opened dwijnand/scala-runners#4) |
there's one thing the distribution gives you that none of the other ways of installation provide without glitches: you need connection to the internet exactly once to download it, and from then on it just works, regardless of whether you are connected or not. with e.g. sbt it always feels like playing the lottery when youi try to develop on the train without connectivity: sometimes it works, sometimes it want to download new stuff and fails... those are the times where i pull our my trusty "normal" distribution and find something i can work on using that instead. |
I personally don't see the point in maintaining a "scala distribution" at all. Someone using Scala can get by just fine with SBT-only, or Mill-only, or Bazel-only, or even Intellij-only or Ammonite-only for small tasks. IMO just stopping the publishings of distribution and pointing people directly at the proper tools would be the greatest benefit for the least amount of work. Each tool already has good-enough integrations for scaladoc/scalac/console/etc. I may be the exception in that I do not use SBT in any of my open source projects or work projects, but I do recognize it is widely used enough that for most people the SBT onboarding experience is as much a part of the Scala experience as the language itself. As long as it is the de-facto Scala experience, prominently advertising it and supporting it is the right thing to do I like Coursier as an ivy replacement, but I don't think it's usage as an application-launcher and bootstrap system has been sufficiently proven out in the wild to label it as the "recommended" way of doing things. That opinion might change as coursier-as-a-bootstrap-launcher sees more adoption by people who aren't alex :P |
That use case is important, no doubt. My thoughts is scala-runners would support it and platform packages would use scala-runners to construct such "download one thing once" packages. |
Yeah, absolutely fair. I guess you can call me an early-adopter fanboy, but the viability of scala-runners depends on how well it works. |
I don't agree that this is a reasonable approach for quick REPL experiments. |
One solution isn't writing new Scala tools, but making Scala available on distribution channels that users are already using. The sbt-extras hack and the Apache Spark installation are embarrassing examples of how deficient things are. There's no reason sbt and Scala couldn't be first-class citizens on more distributions. However, this will require the Scala community to follow the conventions and adopt the tooling of these other projects. The gap was evident recently when a Debian contributor was trying to work on getting Scala updated, but ran in to trouble. https://contributors.scala-lang.org/t/question-about-building-scala-and-sbt-proper/2811 For example, if Scala and sbt were available on distributions like Debian or Fedora, it would likely trickle to Ubuntu and Red Hat and Amazon Linux, and therefore to the many Cloud, serverless, container orchestrated, or Continuous Integration services. The work with Scala could also pave the way for packaging other Scala tools like Coursier, mill or Spark. Scala and sbt have long development cycles, so once the pipe is primed, things could work pretty well. As evidence, consider the Macports and Homebrew packages for sbt. They stay updated, and are very reliable in my experience. Most free and open source projects know this, and bake in these guidelines from the beginning. Scala should, too. It doesn't help that the underlying Java ecosystem sometimes doesn't have the best story here, either. It's getting better, though. Scala should catch up, as well. |
@martijnhoekstra I agree and it's why I built Scala Runners. Have you given it a go? It needs improvements, so I'm looking for feedback. 😄 |
@dwijnand due to dayjob reasons, I run Windows, and after not getting it to work for, like, 5 minutes, I gave up. In theory, it's just what I want though. @ashawley IMO a standard scala distribution for more distributions is not as useful as it sounds. You are going to want to use a build tool for anything but repl'ing anyway (and repl experiments, at least for me, are often version dependent) and the build tool will download it's own version. I'm struggling to find a use case for it. A scala library package is even less useful IMO -- linking against a static scala library jar on a fixed classpath is just not how applications tend to run. a scala build tool like sbt, cbt or mill is much more reasonable to want as package IMO. The bootstrap fo such packages is an issue though, at least for Debian. |
I don't disagree. I even mentioned sbt, mill and Coursier in my comment. Even Adriaan's original proposal mentions supporting "legitimate users of the command-line runners in the Scala". We need to provide a lot of different avenues for people to use Scala, though. We need to argue less about picking a single solution. |
You want |
I think the sentiment is people want more options instead of less, and a few people here including myself have expressed our use cases. I would suggest that we provide distributions with
and let the users decide what they want? |
Just to note that users don't know what they want, they just want it to work in whatever context they happen to find themselves. I am one of those users. Edit: to clarify, in the Steve Jobs sense that the visionary provider has to show the way to an outcome that the user could not foresee. I know what I want only in the sense that I know what I do: I download the tarballs for REPL and one-off tests and scripting, and I use sbt, mostly. But, for example, |
IMHO scala-runners—if it works well—seems to strike the perfect balance between having a native binary and going through sbt to launch a REPL. |
I had a different experience. I know which distribution to get and what to do with it. Other devs in my team have the same experience so I wouldn't say users don't know what they want.
That tool looks very nice. I am okay with it if it is the official solution. Does it have dependency management? Sorry I might have missed it because I don't see in the README |
No, it doesn't. But we've started a conversation about that in dwijnand/scala-runners#3. |
Please don't; or rather, please advocate the other tools as well. It's been a while since this ticket was opened, and in that time there have been multiple ocassions where the question of what is Scala's primary build tool is -- or should be -- has been brought up:
I personally am greatly in favor of Gradle. It's more mature, more popular, better maintained, and most importantly - more familiar to Java developers, which are the potential adopters of Scala. Only downside is that it's currently using "the old Zinc", but integration with "the new Zinc" or Bloop is one of the most voted tickets in their repository and on the milestone of their next release (6.0). |
I teach Scala first at Lund University. Compiling in terminal with scalac and see that class-files are created is a second step after gentle My students want sudo apt install scala on ubuntu (dual boot or vm with virtualbox is common) to get the REPL and scalac. And many look for scala in app stores on windows and macos and ask me why its not there... |
(I think) we are not suggesting to kill the |
Yes, that would be really nice! |
I don't think you'll find many compilers or related command line tools which are available via the actual app stores. |
No, but if so it would make it easy to install'em. Programming für alle :) |
I agree. Improving distribution can help newcomers to quickly get hands on. This is definitely something we can do. Pretty much the only dependency for Scala is JRE. Many linux distributions now have repo with OpenJDK. We can add Scala distribution to the repo and add OpenJDK as dependency. |
I'd say that the vast majority of software is not available via the app store in the desktop world. Well, at least not on Windows. The biggest exception that I can think of is games, which are usually available via a game store launcher (Steam, Uplay, Origin, Epic, GoG, etc), but they are an entirely different beast (paid, online multiplayer, extremely large download size, etc). |
It's the 19 year old cs students that are tomorrow's devs. Making it as easy as possible for them to start coding with the real scala tools is crucial for adoption. What is "normal" or "common" today is not what's important, but what makes it easy for tomorrow's scala devs. The IntelliJ Scala bundle is a good step, but we also need a one click experience to get the terminal things going for all newbies. |
It's actually the <9 year old kids that are tomorrow's devs, and I hope their first programming experience will be much simpler than Scala and its ecosystem; be it using an online REPL or via a dedicated learning program, as it has been with Logo's turtle in the past and nowadays with more elaborate apps (I know of CodeMonkey but I'm sure there are more). |
Making a disruptive change like this late in Scala 2.x and it not carrying over into Scala 3.0 is not a great outcome. So, while the ideas here are good, it should be revisited for (perhaps/hopefully) Scala 3.1. scala-runners still exists (and gets lots of use in the Scala Team), but also there have been lots of great improvements in Coursier ( Thank you all for the comments. |
I agree with Dale that this only makes sense to do if it's a coordinated change made to Scala 2 or 3 both. And it seems unlikely that there's time for big changes in this area for 3.0. |
Very nice analysis! |
what's happening instead is scala-cli / SIP-46 https://docs.scala-lang.org/sips/scala-cli.html |
Uh oh!
There was an error while loading. Please reload this page.
By @dwijnand
This proposal seeks to address the problem of new users installing Scala, either with their package manager or with the distribution archives, and getting a setup that doesn't match how the majority of the Scala community consumes and develops in Scala.
The proposed way to address this is by:
scala
,scalac
,scaladoc
, andscalap
).Note that Scala will continue to be distributed as jars to Maven Central, which is how the majority of the ecosystem consumes Scala. A side-benefit of this change would, therefore, be that it would simplify, and thus reduce the maintainance cost of, the Scala project's build and release procedure.
A secondary action that is also proposed is to:
Background
Historically the Scala distribution has been available as: (in addition to api docs and sources archives)
Within the distribution are the Scala projects jars, and any dependencies:
as well as the following runner scripts, as both bash and BAT scripts, presented here with added description of what they allow users to do from the command-line):
scala
: a multifaceted Scala runner, that allows:scala Main.scala
to run a Scala "script", that is compile and run a Scala source file, possibly in a synthetic main method with a syntheticargs
,scala Main
to run a Scala class with a main method,scala main.jar
to run a Scala jar with a Main-Class,scala
to run the Scala REPL,scalac
: the (batch) Scala compiler,scaladoc
: the Scaladoc tool,scalap
: the Scala class file disassembler, and lastlyfsc
: the "fast" Scala compiler, which is disrecommendedwith optionally the ability to define any:
Many years ago, when bootstrapping the Scala language and its subsequent ecosystem, that worked well. However, nowadays the majority of Scala users working on Scala projects will mostly never use the command-line runners or the bundled jars in the Scala distribution. A large number of Scala users will instead mostly interact with sbt, the most commonly used build tool in the Scala community, to:
A lot of tools in the Scala ecosystem provide an integration with sbt in the form of an sbt plugin which users consume by modifying either their build definition or their user-wide sbt settings. However, not every tool in a Scala user's toolkit is strictly part their project's build. So having every Scala tool be accessed through sbt is an avoidable imposition.
Unfortunately, within the larger JVM community there hasn't been any popular, general-purpose tool for downloading, launching, or bootstrapping tools, which has lead the ecosystem to repeatedly creating and maintaining a tangle of bash, BAT scripts and installation docs, with their related system properties, environment variables, and configuration files.
Within the Scala ecosystem, over time, there have been several, disconnected, projects that seeked to address how to launch, and possibly boostrap and/or install, command-line tools in the Scala ecosystems:
sbt.version
key inproject/build.properties
Some of the most popular tools built in Scala and used by the Scala ecosystem, and how they run, are:
sbt
runner scripts in sbt-launcher-package, as both bash and BAT scripts, which noteably relies on the presence of sbt'ssbt-launch.jar
(which is based on sbt/launcher) on the filesystem,Of additional importance sbt's launcher and sbt use a custom, non-standard classloader setup in order, for example, for the sbt launcher to be written in Scala 2.10 but run sbt 1 which is written in scala 2.12. See Jason Zaugg's notes for more details.
Notes and Design Decisions
coursier launch
scalar
?)Participants
Lead: Dale Wijnand (Scala contributor, sbt ex-maintainer)
I propose we invite the people we know in the community have exhibited an interest in this space, and might be interested in being involved:
Let me know if you have any other suggestions.
The text was updated successfully, but these errors were encountered: