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
This guide shows the quickest and easiest way to install the project in a virtual environment
5
+
This guide shows a couple of ways to install the project in a virtual environment.
6
+
7
+
## project files
8
+
9
+
Install the project files by cloning the GitHub repository. If you intend to contribute to the project, or run your own instance, you will likely want to clone your own fork
pyenv allows easy installation of multiple versions of Python on the same machine. It allows the version of python used to be defined at the user and project level. It is a great tool, easy to use, and does its one job very well. It is worth reading the introduction to have an overview of how it works at a high level. It's not necessary to understand the technical internals
24
+
### pyenv
25
+
26
+
pyenv is a tool that makes it easy to manage multiple versions of Python on the same machine. It allows the version of python used to be defined at the user and project level. It is a great tool, easy to use, and does its one job very well. It is worth reading the introduction to have an overview of how it works at a high level. It's not necessary to understand the technical internals
11
27
12
28
https://github.com/pyenv/pyenv#how-it-works
13
29
14
30
Installation instructions for pyenv are here:
15
31
16
32
https://github.com/pyenv/pyenv#installation
17
33
18
-
## Python 3.10
19
34
20
-
pysystemtrade currently requires Python 3.10, so once pyenv is installed, the first step is to get that. Get the latest 3.10.x version, at the time of writing it is 3.10.13
35
+
First install Python itself. pysystemtrade currently requires Python 3.10 or newer
21
36
22
37
```
23
38
$ pyenv install 3.10
@@ -31,170 +46,153 @@ $ pyenv versions
31
46
3.7.14
32
47
3.8.5
33
48
3.8.6
34
-
3.8.10
35
-
3.8.13
36
-
3.8.15
37
49
3.8.16
38
50
3.9.6
39
51
3.9.13
40
52
3.10.4
41
-
* 3.10.13
53
+
* 3.10.15
42
54
```
43
55
44
56
Your output will be different, it's just an example
45
57
58
+
### venv
46
59
47
-
## project files
60
+
https://docs.python.org/3.10/library/venv.html
48
61
49
-
Once we have the correct version of Python, it's time to get the project files.
62
+
Now we want to create a virtual environment (venv) for the project. Doing this will keep all the dependencies for pysystemtrade separate from your other python projects
50
63
51
-
If you intend to contribute to the project, or run your own instance, you will likely want to clone your own fork
64
+
```
65
+
$ cd pysystemtrade
66
+
$ python -m venv .venv
67
+
```
68
+
69
+
This will create a brand new, isolated Python environment *inside the pysystemtrade project* at the directory
70
+
`<your_path>/pysystemtrade/.venv`. You can give your environment any name (the *.venv* bit).
This reminds you that your venv is active. You can exit the venv at any time by running `deactivate`
62
84
63
85
Now we will want to let pyenv know that we want to use Python 3.10 for this project
64
86
65
87
```
66
-
cd pysystemtrade
67
-
pyenv local 3.10.13
88
+
pyenv local 3.10.15
68
89
```
69
90
70
-
this creates a file at the top level of the project `.python-version` that lets the Python execution environment know to use version 3.10.13. We can check this by running python
91
+
this creates a file at the top level of the project `.python-version` that lets the Python execution environment know to use version 3.10.15. We can check this by running python
71
92
72
93
```
73
94
$ python
74
-
Python 3.10.13 (main, Nov 27 2023, 11:13:49) [Clang 14.0.0 (clang-1400.0.29.202)]
95
+
Python 3.10.15 (main, Nov 27 2023, 11:13:49) [Clang 14.0.0 (clang-1400.0.29.202)]
75
96
Type "help", "copyright", "credits" or "license" for more information.
76
97
>>>
77
98
< ctrl-D to exit >
78
99
```
79
100
80
-
##venv
101
+
### dependencies
81
102
82
-
https://docs.python.org/3.10/library/venv.html
83
-
84
-
Now we want to create a virtual env (venv) for the project. Doing this will keep all the dependencies for pysystemtrade separate from your other python projects
103
+
Now it's time to start setting up the venv. First update the basic tools
85
104
86
105
```
87
-
$ python -m venv venv/3.10.13
106
+
(.venv) $ pip install --upgrade pip setuptools
88
107
```
89
108
90
-
This will create a brand new, isolated Python environment *inside the pysystemtrade project* at the directory
91
-
`<your_path>/pysystemtrade/venv/3.10.13`. You can give your environment any name (the *venv/3.10.13* bit).
92
-
93
-
Now activate the virtual environment
109
+
And now install the project and its dependencies
94
110
95
111
```
96
-
source venv/3.10.13/bin/activate
112
+
(.venv) $ python -m pip install .
97
113
```
98
114
99
-
Once your virtual env is activated, the prompt will change. It will look something like
115
+
Or, if you intend to contribute to the project, you will need the optional development dependencies too, and will want to install in *editable* mode
This reminds you that you're in a venv. (You can exit the venv at any time by running `deactivate`)
105
-
106
-
107
-
## dependencies
108
-
109
-
Now it's time to start setting up the venv. First check to see what is there
110
-
111
-
```
112
-
(3.10.13) $ pip list
113
-
```
114
-
115
-
You will probably be prompted to update pip at this time. Do whatever command it suggests.
116
-
117
-
And now install the dependencies
118
-
119
-
```
120
-
(3.10.13) $ pip install -r requirements.txt
121
-
```
122
-
123
-
### MacOS (ARM)
124
-
125
-
If you're running MacOS on one of the new ARM chips, the process is more complex. You'll need Homebrew and the Apple XCode Commandline Development Tools, configured for ARM. Doing that is beyond the scope of this document, type `homebrew apple xcode command line tools` into your favourite search engine. Once installed and configured, run installation script:
126
-
127
-
```
128
-
chmod u+x install_dependencies_apple_silicon.sh
129
-
./install_dependencies_apple_silicon.sh
130
-
131
-
```
132
-
Note: this may (unfortunately) become out of date and require some tweaking.
133
-
134
-
### Check dependencies
135
120
136
121
Check what is installed, should look something like
137
122
138
123
```
139
-
(3.10.13) % pip list
140
-
Package Version
141
-
--------------- ------------
142
-
blinker 1.7.0
143
-
click 8.1.7
144
-
contourpy 1.2.0
145
-
cycler 0.12.1
146
-
eventkit 1.0.3
147
-
exceptiongroup 1.2.0
148
-
Flask 3.0.1
149
-
fonttools 4.47.2
150
-
ib-insync 0.9.86
151
-
iniconfig 2.0.0
152
-
itsdangerous 2.1.2
153
-
Jinja2 3.1.3
154
-
joblib 1.3.2
155
-
kiwisolver 1.4.5
156
-
MarkupSafe 2.1.4
157
-
matplotlib 3.8.2
158
-
nest-asyncio 1.6.0
159
-
numpy 1.26.3
160
-
packaging 23.2
161
-
pandas 2.1.3
162
-
patsy 0.5.6
163
-
pillow 10.2.0
164
-
pip 23.3.2
165
-
pluggy 1.3.0
166
-
psutil 5.6.6
167
-
pyarrow 15.0.0
168
-
pymongo 3.11.3
169
-
pyparsing 3.1.1
170
-
PyPDF2 3.0.1
171
-
pytest 7.4.4
172
-
python-dateutil 2.8.2
173
-
pytz 2023.3.post1
174
-
PyYAML 5.3.1
175
-
scikit-learn 1.4.0
176
-
scipy 1.12.0
177
-
setuptools 65.5.0
178
-
six 1.16.0
179
-
statsmodels 0.14.0
180
-
threadpoolctl 3.2.0
181
-
tomli 2.0.1
182
-
tzdata 2023.4
183
-
Werkzeug 3.0.1
184
-
```
185
-
186
-
## pysystemtrade
187
-
188
-
And finally, install the project itself
189
-
190
-
```
191
-
(3.10.13) $ python setup.py develop
192
-
```
124
+
(.venv) % pip list
125
+
Package Version
126
+
----------------- -----------
127
+
black 23.11.0
128
+
blinker 1.8.2
129
+
click 8.1.7
130
+
contourpy 1.3.0
131
+
cycler 0.12.1
132
+
decorator 5.1.1
133
+
enum-compat 0.0.3
134
+
eventkit 1.0.3
135
+
exceptiongroup 1.2.2
136
+
Flask 3.0.3
137
+
fonttools 4.54.1
138
+
ib-insync 0.9.86
139
+
iniconfig 2.0.0
140
+
itsdangerous 2.2.0
141
+
Jinja2 3.1.4
142
+
joblib 1.4.2
143
+
kiwisolver 1.4.7
144
+
lz4 4.3.3
145
+
MarkupSafe 2.1.5
146
+
matplotlib 3.9.2
147
+
mock 5.1.0
148
+
mockextras 1.0.2
149
+
mypy-extensions 1.0.0
150
+
nest-asyncio 1.6.0
151
+
numpy 1.26.4
152
+
packaging 24.1
153
+
pandas 2.1.3
154
+
pathspec 0.12.1
155
+
patsy 0.5.6
156
+
pillow 10.4.0
157
+
pip 24.3.1
158
+
platformdirs 4.3.6
159
+
pluggy 1.5.0
160
+
psutil 5.6.7
161
+
pyarrow 17.0.0
162
+
pymongo 3.11.3
163
+
pyparsing 3.1.4
164
+
PyPDF2 3.0.1
165
+
pysystemtrade 1.8.2
166
+
pytest 8.3.3
167
+
python-dateutil 2.9.0.post0
168
+
pytz 2023.3
169
+
PyYAML 6.0.1
170
+
scikit-learn 1.5.2
171
+
scipy 1.14.1
172
+
setuptools 65.5.0
173
+
six 1.16.0
174
+
statsmodels 0.14.0
175
+
threadpoolctl 3.5.0
176
+
tomli 2.0.1
177
+
typing_extensions 4.12.2
178
+
tzdata 2024.2
179
+
tzlocal 5.2
180
+
Werkzeug 3.0.4
181
+
```
182
+
183
+
## Option 2: uv
184
+
185
+
[uv](https://github.com/astral-sh/uv) is packaging tool that combines the functionality of pip, pyenv, venv and more; read about it [here](https://docs.astral.sh/uv/). It is written in Rust and **extremely** fast
186
+
187
+
TBD
188
+
189
+
190
+
## test
193
191
194
192
Check stuff works
195
193
196
194
```
197
-
(3.10.13) $ python
195
+
(.venv) $ python
198
196
>>>
199
197
>>> from sysdata.sim.csv_futures_sim_data import csvFuturesSimData
0 commit comments