Skip to content

Commit 57d99cf

Browse files
authored
Merge pull request #13 from domschl/install_fix
Fix python module versions via preferences.txt and venv
2 parents 976e1fe + 84619e3 commit 57d99cf

File tree

4 files changed

+58
-31
lines changed

4 files changed

+58
-31
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,10 @@ mchess/web/node_modules
1111
mchess/mchess.log
1212
mchess/web/package-lock.json
1313
mchess/turquoise.log
14+
mchess/bin
15+
mchess/lib64
16+
mchess/lib
17+
mchess/include
18+
mchess/pyvenv.cfg
1419
.DS_Store
20+

README.md

Lines changed: 38 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,60 @@ Currently, the following platforms are under development:
2020
| USB | x | x | x | x |
2121
| Bluetooth LE | x | x | |
2222

23-
## Alpha installation instructions
23+
## Installation instructions
2424

25-
This project is under heavy development, and basically everything described below might change at some point.
25+
The project requires Python 3.7 and later (tested with 3.11). Please use a Python virtual environment to install the dependencies:
2626

27-
### Dependencies
28-
29-
`python-mchess` is written for Python >= 3.7.
30-
If UCI-engine support (python-chess dependency) is not used, any Python 3.x works. (python-mchess makes use of latest async features of Python 3.7 and later)
27+
```bash
28+
git clone https://github.com/domschl/python-mchess
29+
cd python-mchess
30+
# In folder python-mchess:
31+
python -m venv mchess
32+
cd mchess
33+
# Windows: Scripts\activate.bat
34+
source bin/activate
35+
# Now install dependencies:
36+
python -m pip install -r requirements.txt
37+
# On Linux, install bluepy, skip for macOS and Windows:
38+
python -m pip install bluepy
39+
```
3140

32-
`python-mchess` board driver for Chess Link depends on `PySerial` and (Linux/Raspberry Pi only) `BluePy`
41+
### Notes on venv usage
3342

34-
#### Optional UCI engine support
43+
When stopping to use the virtual environment, use `deactivate` to deactivate the virtual environment, each time you come back to the project, use `source bin/activate` to activate the virtual environment.
3544

36-
In order to use UCI engines with mchess, additionally `python-chess` is used, the Tkinter-GUI prototype uses `Pillow`.
45+
To check, if you are running a `venv` environment:
3746

3847
```bash
39-
pip3 install pyserial [bluepy] [python-chess] [Pillow]
48+
pip -V
49+
# should show something like:
50+
# <some-path>//python-mchess/mchess/lib/python3.11/site-packages/pip (python 3.11)
51+
# path should contain 'python-mchess/mchess'
4052
```
4153

42-
Then clone the repository
54+
```bash
55+
- On Windows, use `Scripts\activate.bat` instead of `bin/activate` to activate the environment. On Linxu/macOS use `source bin/activate`.
56+
- On Windows, the `Scripts` folder is hidden by default. Use `dir /a` to list all files and folders.
57+
- To deactivate the virtual environment, use `deactivate` on Linux/macOS, or `Scripts\deactivate.bat` on Windows.
58+
59+
#### Web client
60+
61+
Node JS packet manager `npm` is needed to install the javascript dependencies:
4362

4463
```bash
45-
git clone https://github.com/domschl/python-mchess
64+
# In folder python-mchess:
65+
cd mchess/web
66+
npm install
4667
```
4768

69+
This installs the dependencies `cm-chessboard` and `charts.js`.
70+
71+
## Configuration
72+
4873
Now configure some engines:
4974

5075
```bash
76+
# In folder python-mchess:
5177
cd mchess/engines
5278
```
5379

@@ -66,23 +92,6 @@ A sample content for stockfish in Linux would be:
6692

6793
Note: Windows users need to use paths with `\\` or `/` for proper json encoding.
6894

69-
#### Web client
70-
71-
The web agent requires python modules `Flask`, `Flask-Sockets` and `gevent`.
72-
73-
```bash
74-
pip3 install flask flask-sockets gevent
75-
```
76-
77-
Node JS packet manager `npm` is needed to install the javascript dependencies:
78-
79-
```bash
80-
cd mchess/web
81-
npm install
82-
```
83-
84-
This installs the dependencies `cm-chessboard` and `charts.js`.
85-
8695
### Start
8796

8897
Then in directory `mchess`, simply start from console:

mchess/requirements.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# https://docs.python.org/3/tutorial/venv.html
2+
3+
pyserial
4+
chess
5+
pillow
6+
# bluepy
7+
8+
markupsafe==2.0.1
9+
Flask==1.1.4
10+
Flask-Sockets==0.2.1
11+
gevent # ==21.12.0
12+
gevent-websocket # ==0.10.1

mchess/web/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"lockfileVersion": 1,
33
"dependencies": {
4-
"cm-chessboard": "^2.15.3",
5-
"chart.js": "^2.9.3"
4+
"chart.js": "^2.9.3",
5+
"cm-chessboard": "^2.15.7"
66
}
77
}

0 commit comments

Comments
 (0)