question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make cs setup include scala-cli

See original GitHub issue

(*) Edit + TLDR This issue started out by discussing how scala-cli and coursier should align installation and also discussed the gettingstarted experience and the official download instructions. The consensus seem to be that coursier’s cs setup should include installation of scala-cli as a first step, before scala-cli eventually becomes the new official scala runner. (scroll down to the end and see conclusions)


(Initial issue kick-off text:)

Is your feature request related to a problem? Please describe. The current official Scala Getting-started-instructions are based on coursier, because cs can install stuff like sbt and what not. But scala-cli is more beginner-friendly and could replace cs as the official install method to make the getting-started experience even better.

Describe the solution you’d like Enhance scala-cli with install abilities similar to cs so that scala-cli can install stuff like sbt, sbtn, scalac, scalafmt, and other useful stuff.

Additional context scala-cli already wraps coursier under the hood so this should be a low-hanging-fruit if I have understood it correctly.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:42 (34 by maintainers)

github_iconTop GitHub Comments

6reactions
lrytzcommented, May 12, 2022

To me this sounds more complicated than it should be. The coursier website says:

Coursier is the Scala application and artifact manager. It can install Scala applications and setup your Scala development environment. These instructions will install the coursier CLI cs itself, as well as a typical Scala development environment. By default, they will install the following applications: scala, sbt, …

scala-cli is a scala tool / application that should be installed by cs setup (as noted before on this thread). Especially if it will become the default scala at some point. Then there doesn’t need to be any packages or separate installation instructions for scala-cli.

What are the issues with this approach?

6reactions
adpi2commented, May 2, 2022

The solution described by @alexarchambault seems a bit odd to me. It makes things easier for the Scala beginners, they only see scala-cli and they don’t need to interact with anything else. But then if they want to discover more in the existing Scala ecosystem they need to install another thing, called cs, and use that thing to manage other tools like sbt and mill. So the path from beginner to intermediate level programmer is still quite tortuous.

It is also a bit confusing. Because it can be interpreted as: scala-cli is the getting started tool but then if I want to become expert I must setup my workspace, use cs and the tools made available by cs. I was writing some Scala but my environment was not yet “set up”.

In order to make things equally good for beginners and experts, I think there are two ways forward, etiher 1 or 2.

1. The “one-click install” installs both cs and scala-cli

The “one-click install” installs cs and then uses cs to install scala-cli. scala-cli is always managed by Coursier and can be updated by Coursier. There is no scala-cli setup.

It is clear for beginners and experts what the roles of cs and scala-cli are:

  • cs is the Scala applications manager
  • scala-cli is the main Scala runner

In all our documentations and tutorials (in docs.scala-lang.org, but also in the sbt and Mill websites or any other Scala related website) we can assume that cs is already installed and can safely be used to install sbt, mill

2. Merge Coursier CLI into scala-cli

scala-cli is the main Scala runner and the Scala applications manager. cs is deprecated.

In terms of usage that means we will add a dozen commands into scala-cli. It will looks like this:

$ scala-cli
Usage: /home/piquerez/.local/share/coursier/bin/.scala-cli.aux <COMMAND>
Scala CLI is a command-line tool to interact with the Scala language. It lets you compile, run, test, and package your Scala code.

Other commands:
  export                                    Export current project to sbt or Mill
  help                                      Print help message
  install completions, install-completions  Installs completions into your shell
  setup-ide                                 Generate a BSP file that you can import into your IDE
  shebang                                   Like `run`, but more handy from shebang scripts

Doctor commands:
  doctor  Print details about this application

Main commands:
  clean                  Clean the workspace
  compile                Compile Scala code
  fmt, format, scalafmt  Format Scala code
  console, repl          Fire-up a Scala REPL
  package                Compile and package Scala code
  publish
  run                    Compile and run Scala code.
  test                   Compile and test Scala code

Resolution commands:
  fetch    Transitively fetch the JARs of one or more dependencies or an application.
  resolve  Resolve and print the transitive dependencies of one or more dependencies or an application.

Application commands:
  install    Install an application from its descriptor.
  list       List all currently installed applications.
  setup      Setup a machine for Scala development.
  uninstall  Uninstall one or more applications.
  update     Update one or more applications.
  channel  Manage additional channels, used by coursier to resolve application descriptors.
  search   Search application names from known channels.
  bootstrap  Create a binary launcher from a dependency or an application descriptor.
  launch     Launch an application from a dependency or an application descriptor.

Miscellaneous commands:
  about    Print details about this application
  version  Print `scala-cli` version

See 'scala-cli <command> --help' to read about a specific subcommand. To see full help run 'scala-cli <command> --help-full'.
To run another Scala CLI version, specify it with '--cli-version' before any other argument, like 'scala-cli --cli-version <version> args'.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting started | Scala CLI
In this article we show how to use Scala CLI to create a basic script, followed by small project with features like dependencies,...
Read more >
setup - Coursier
The setup command aims at making it easier to setup a machine for Scala development, be it your own development machine, or CI...
Read more >
Single command Scala setup - Alex Archambault
You can now set up your machine for Scala development with a single command via the coursier CLI: $ cs setup. This command...
Read more >
Getting Started - Scala Documentation
Install Scala on your computer ... Installing Scala means installing various command-line tools such as the Scala compiler and build tools. We recommend...
Read more >
ONE COMMAND set-up for Scala development - Shivani Thorat
This command checks whether JVM and standard scala CLI tools are installed on your machine, if not it goes ahead to install them....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found