Skip to content

Commit 7fcf94e

Browse files
Updated src/README.md to include instructions for using NVM and Python virtual environments for local development. Added requirements.txt to install required Python utils. Added pnpm as a dev dependency.
1 parent 0003e4b commit 7fcf94e

File tree

5 files changed

+56
-4
lines changed

5 files changed

+56
-4
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ src/smc-hub/landing
9595

9696
src/smc_sagews/smc_sagews.egg-info/*
9797
src/smc_sagews/build/*
98+
src/smc_pyutil/smc_pyutil.egg-info/*
99+
src/smc_pyutil/build/*
98100
.eggs
99101
logs
100102
pids
@@ -144,4 +146,7 @@ src/packages/next/lib/software-inventory/*.json
144146

145147
src/compute/compute/dev/conf*
146148
src/g
147-
src/go
149+
src/go
150+
151+
# Python virtual environment
152+
venv

src/.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lts/hydrogen

src/README.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,57 @@ CoCalc is a pretty large and complicated project, and it will only work with the
1212
. /cocalc/nvm/nvm.sh
1313
```
1414

15-
- Make sure to[install the newest version of pnpm as well;](https://pnpm.io/installation) one way to do that is as follows:
15+
Alternatively, if you are already using [Node Version Manager](https://github.com/nvm-sh/nvm), you can simply run the
16+
following command to use a version of Node guaranteed to work with this project:
17+
18+
```sh
19+
~/cocalc/src$ nvm install && nvm use
20+
```
21+
22+
_Note that `nvm install` is only required the first time you run this command or when CoCalc's Node version changes_.
23+
24+
- Make sure to [install the newest version of pnpm as well;](https://pnpm.io/installation) one way to do that is as follows:
1625

1726
```sh
1827
npm install -g pnpm
1928
```
2029

21-
- Python: You must have python3 installed with the pyyaml package, so `import yaml` works. Do `pip3 install pyyaml` if not.
30+
Alternatively, if you do not wish to install `pnpm` globally, you can run `npm install` to install it as a dev
31+
dependency.
32+
33+
**Python virtual environment**
34+
35+
Some features of CoCalc (e.g., file creation) require local Python modules to be installed. To create a [Python virtual
36+
environment](https://docs.python.org/3/library/venv.html) from which to run these modules, run (from the `src`
37+
directory):
38+
39+
```sh
40+
~/cocalc/src$ python3 -m venv venv
41+
```
42+
43+
To activate the virtual environment, run
44+
45+
```sh
46+
~/cocalc/src$ source ./venv/bin/activate
47+
```
48+
49+
To install required dependencies, run
50+
51+
```sh
52+
(venv) ~/cocalc/src$ pip install -r requirements.txt
53+
```
54+
55+
**You must have your virtual environment activated when running the CoCalc Hub (via `pnpm hub`)!** If, on the other
56+
hand, you prefer that development packages be installed globally, you can jump directly to the above `pip install`
57+
command outside the context of a virtual environment.
2258

2359
## Initial Build
2460

2561
Launch the install and build **for doing development:**
2662

63+
**Note**: If you installed `pnpm` locally (instead of globally), simply run `npm run` in place of `pnpm` to execute
64+
these commands via [NPM run scripts](https://docs.npmjs.com/cli/v10/using-npm/scripts).
65+
2766
```sh
2867
~/cocalc/src$ pnpm make-dev
2968
```

src/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,8 @@
3838
"bugs": {
3939
"url": "https://github.com/sagemathinc/cocalc/issues"
4040
},
41-
"homepage": "https://github.com/sagemathinc/cocalc"
41+
"homepage": "https://github.com/sagemathinc/cocalc",
42+
"devDependencies": {
43+
"pnpm": "^8.10.2"
44+
}
4245
}

src/requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pyyaml==6.0.1
2+
3+
./smc_pyutil
4+
./smc_sagews

0 commit comments

Comments
 (0)