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
@@ -32,11 +32,11 @@ This README describes the steps involved in installing and running Optima. **Fol
32
32
33
33
## 2.1 Quick start installation
34
34
35
-
To install, run `python setup.py develop` in the root repository directory. This will add Optima to the system path. Optima can then be used via Python.
35
+
To install, run `python setup.py develop` in the root repository directory. This will add Optima to the system path. Optima can then be used via Python.
36
36
37
37
To uninstall, run `python setup.py develop --uninstall`.
38
38
39
-
Note: do **not** use `python setup.py install`, as this will copy the source code into your system Python directory, and you won't be able to modify or update it easily.
39
+
Note: do **not** use `python setup.py install`, as this will copy the source code into your system Python directory, and you won't be able to modify or update it easily.
40
40
41
41
42
42
## 2.2 Detailed instructions
@@ -64,25 +64,25 @@ The last step is to make sure that Optima is available on the Python path. There
64
64
0. Under the “Tools” (Linux and Windows) or “python” (under Mac) menu, go to “PYTHONPATH Manager”
65
65
0. Select the Optima folder (e.g. `C:\Users\Alice\GitHub\Optima` on Windows) and click OK.
66
66
0. **Option 2: modify system path**
67
-
0. **Option 2A** (all operating systems): Go to the Optima root folder (in a terminal on Mac or Linux; in a command prompt [cmd.exe] in Windows) and run
68
-
`python setup.py develop`
67
+
0. **Option 2A** (all operating systems): Go to the Optima root folder (in a terminal on Mac or Linux; in a command prompt [cmd.exe] in Windows) and run
68
+
`python setup.py develop`
69
69
Note: if Spyder does not use the system Python (which can happen in some cases), this will not work. In this case:
70
-
0. Inside a Spyder console, type
70
+
0. Inside a Spyder console, type
71
71
`import sys; sys.executable`
72
-
0. Replace the above command with the location of this executable, e.g.
72
+
0. Replace the above command with the location of this executable, e.g.
73
73
`/software/anaconda/bin/python setup.py develop`
74
-
0. **Option 2B** (Linux, Mac only): Add the Optima folder to `~/.bashrc` or `~/.bash_profile`, e.g.
[NB: if you don't use `bash`, you are probably a hacker and don't need these instructions.]
77
-
0. **Option 2C** (Windows only): search for “variables” from the Start Menu; the option should be called something like “Edit environment variables for your account”. Under “user variables”, you should see “PYTHONPATH” listed. Add the folder for the Optima repository, e.g.
78
-
`C:\Users\Alice\GitHub\Optima`
79
-
If there are already things on the Python path, add this to the end separated by a semicolon and no space, e.g.
77
+
0. **Option 2C** (Windows only): search for “variables” from the Start Menu; the option should be called something like “Edit environment variables for your account”. Under “user variables”, you should see “PYTHONPATH” listed. Add the folder for the Optima repository, e.g.
78
+
`C:\Users\Alice\GitHub\Optima`
79
+
If there are already things on the Python path, add this to the end separated by a semicolon and no space, e.g.
If you followed the steps correctly, you should be able to run
85
-
`import optima`
84
+
If you followed the steps correctly, you should be able to run
85
+
`import optima`
86
86
from a Python console (either the system console or the Spyder console)
87
87
88
88
For usage examples, see the scripts in the `tests` folder. In particular, `testworkflow.py` shows a typical usage example.
@@ -101,7 +101,7 @@ On mac, install the `postgres` software with:
101
101
102
102
brew install postgres
103
103
104
-
On Linux, use
104
+
On Linux, use
105
105
106
106
sudo apt-get install install postgres
107
107
@@ -114,7 +114,7 @@ To run the `postgres` daemon in a terminal:
114
114
```bash
115
115
postgres -D /usr/local/var/postgresbrew
116
116
```
117
-
117
+
118
118
If you want to, you can run the `postgres` daemon with the Mac system daemon manager `launchctl`, or via the ruby wrapper for `lunchy`.
119
119
120
120
@@ -141,7 +141,7 @@ You will first need to install the python database migration tools:
141
141
```bash
142
142
pip install sqlalchemy-migrate psycopg2
143
143
```
144
-
144
+
145
145
Then to create the optima database, use these commands *from the root Optima directory* as `migrate` needs to find the migration scripts:
146
146
147
147
```bash
@@ -225,7 +225,9 @@ _On Mac_:
225
225
lunchy start redis
226
226
227
227
228
-
Run the server in two separate terminals. These scripts will start Python in a `virtualenv` isolated Python environments. First in one terminal:
228
+
Run the server in two separate terminals. These scripts will start Python in a `virtualenv` isolated Python environments.
229
+
If you wish to use system installed packages, append `--sitepackages` and it will not reinstall things that are already installed in the Python site packages.
230
+
First in one terminal:
229
231
230
232
tox -e celery
231
233
@@ -270,10 +272,10 @@ This section contains random pieces of wisdom we have encountered along the way.
270
272
## 7.1 Workflows
271
273
272
274
- Make sure you pull and push from the repository regularly so you know what everyone else is doing, and everyone else knows what you're doing. If your branch is 378 commits behind develop, you're the sucker who's going to have to merge it.
273
-
- There is very unclear advice about how to debug Python. It's actually fairly simple: if you run Python in interactive mode (e.g. via Spyder or via `python -i`), then if a script raises an exception, enter this in the console just after the crash:
274
-
`import pdb; pdb.pm()`
275
-
You will then be in a debugger right where the program crashed. Type `?` for available commands, but it works like how you would expect. Alternatively, if you want to effectively insert a breakpoint into your program, you can do this with
276
-
`import pdb; pdb.set_trace()`
275
+
- There is very unclear advice about how to debug Python. It's actually fairly simple: if you run Python in interactive mode (e.g. via Spyder or via `python -i`), then if a script raises an exception, enter this in the console just after the crash:
276
+
`import pdb; pdb.pm()`
277
+
You will then be in a debugger right where the program crashed. Type `?` for available commands, but it works like how you would expect. Alternatively, if you want to effectively insert a breakpoint into your program, you can do this with
278
+
`import pdb; pdb.set_trace()`
277
279
No one knows what these mysterious commands do. Just use them.
278
280
- For benchmarking/profiling, you can use `tests/benchmarkmodel.py`. It's a good idea to run this and see if your changes have slowed things down considerably. It shows how to use the line profiler; Spyder also comes with a good function-level (but not line) profiler.
279
281
@@ -291,7 +293,7 @@ def myfunc(args=None):
291
293
if args is None: args = []
292
294
print(args)
293
295
```
294
-
- It's dangerous to use `type()`; safer to use `isinstance()` (unless you _really_ mean `type()`). For example,
295
-
`type(rand(1)[0])==float`
296
-
is `False` because its type is `<type 'numpy.float64'>`; use `isinstance()` instead, e.g. `isinstance(rand(1)[0], (int, float))`
296
+
- It's dangerous to use `type()`; safer to use `isinstance()` (unless you _really_ mean `type()`). For example,
297
+
`type(rand(1)[0])==float`
298
+
is `False` because its type is `<type 'numpy.float64'>`; use `isinstance()` instead, e.g. `isinstance(rand(1)[0], (int, float))`
297
299
will catch anything that looks like a number, which is usually what you _really_ want.
0 commit comments