You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _overviews/scala3-book/scala-for-python-devs.md
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1293,25 +1293,25 @@ Follow the links below for more details:
1293
1293
1294
1294
## How to setup a virtual environnement in Scala?
1295
1295
1296
-
By default Python and Python modules are installed at system-wide directories or user-wide directories. Virtual environments are a way of obtaining an isolated environment on a per-project basis. Typical flow to configure the virtual environment using for example `venv` module in Python might be something like so
1296
+
In Scala there is no need to explicitly setup an equivalent of Python's virtual environnement. By default, build tools manage project's dependencies such that user does not have to think about site directories. For example using `sbt` build tool we specify dependencies inside `build.sbt` file under `libraryDependencies` setting, then executing
1297
1297
1298
1298
```
1299
1299
cd myapp
1300
-
python3 -m venv myapp-env
1301
-
source myapp-env/bin/activate
1302
-
pip install -r requirements.txt
1300
+
sbt compile
1303
1301
```
1304
1302
1305
-
This installs all the dependencies under project's directory `myapp/myapp-env` and alters the shell environmental variable `PATH`to look up dependencies from `myapp-env`.
1303
+
would automatically resolve all dependencies for that particular project. The location of downloaded dependencies is largely an implementation detail of the build tool that users do not interact with directly. For example, if we were to delete the whole sbt dependencies cache, one the next compilation of the project, sbt will simply re-resolve automatically all the required dependencies.
1306
1304
1307
-
In Scala there is no need to explicitly setup an equivalent of Python's virtual environnement. By default, build tools manage project's dependencies such that user does not have to explicitly think about site directories. For example using `sbt` build tool we specify dependencies inside `build.sbt` file under `libraryDependencies` setting, then executing
1305
+
This differs from Python were by default dependencies are installed at system-wide or user-wide directories, so to obtain an isolated environment on a per-project basis we have to create a corresponding virtual environment. For example, using `venv` module we might create one for a particular project like so
1308
1306
1309
1307
```
1310
1308
cd myapp
1311
-
sbt compile
1309
+
python3 -m venv myapp-env
1310
+
source myapp-env/bin/activate
1311
+
pip install -r requirements.txt
1312
1312
```
1313
1313
1314
-
would automatically resolve all dependencies for that particular project. The location of downloaded dependencies is largely an implementation detail of the build tool that users do not interact with directly. For example, if were to delete the whole sbt dependencies cache, one next compilation of the project, sbt will simply re-resolve automatically all the required dependencies.
1314
+
This installs all the dependencies under project's directory `myapp/myapp-env` and alters the shell environmental variable `PATH`to look up dependencies from `myapp-env`.
1315
1315
1316
1316
1317
1317
[collections-classes]: {% link _overviews/scala3-book/collections-classes.md %}
0 commit comments