Skip to content

Commit e8f7d21

Browse files
Add and update documentation for Windows (#1656)
Co-authored-by: Thirumalai Shaktivel <[email protected]>
1 parent 071dd40 commit e8f7d21

File tree

1 file changed

+125
-80
lines changed

1 file changed

+125
-80
lines changed

README.md

Lines changed: 125 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,147 +1,192 @@
11
# LPython
22

3-
LPython is a Python compiler. It is in heavy development, currently in
4-
pre-alpha stage. Some of the goals of LPython:
5-
6-
* The best possible performance for numerical, array-oriented code
7-
* Run on all platforms
8-
* Compile a subset of Python yet be fully compatible with Python
9-
* Explore designs so that LPython eventually can compile all Python code
10-
* Fast compilation
11-
* Excellent user-friendly diagnostic messages: error, warnings, hints, notes,
3+
LPython is a Python compiler. It is in heavy development, currently in pre-alpha stage. LPython works on Windows, macOS and Linux. Some of the goals of LPython include:
4+
5+
- The best possible performance for numerical, array-oriented code
6+
- Run on all platforms
7+
- Compile a subset of Python yet be fully compatible with Python
8+
- Explore designs so that LPython eventually can compile all Python code
9+
- Fast compilation
10+
- Excellent user-friendly diagnostic messages: error, warnings, hints, notes,
1211
etc.
13-
* Ahead-of-Time compilation to binaries, plus interactive usage (Jupyter
14-
notebook)
15-
* Transforming Python code to C++, Fortran and other languages
12+
- Ahead-of-Time compilation to binaries, plus interactive usage (Jupyter notebook)
13+
- Transforming Python code to C++, Fortran and other languages
1614

1715
And more.
1816

1917
# Installation
2018

21-
LPython works on Windows, macOS and Linux.
19+
## Step 0: Prerequisites
2220

23-
## Install Conda
21+
Here is the list of requirements needed to build LPython:
22+
23+
- Python (3.10+)
24+
- Conda
25+
26+
For Windows, these are additionally required:
27+
28+
- Miniforge Prompt
29+
- Visual Studio (with "Desktop Development with C++" workload)
30+
31+
Please follow the steps for your desired platform.
32+
33+
## Step 1: Install Conda
34+
35+
This step involves installing Conda using a conda-forge distribution called Miniforge.
2436

2537
Please follow the instructions here to install Conda on your platform:
2638

27-
https://github.com/conda-forge/miniforge/#download
39+
Miniforge download link (for Linux, MacOS and Windows): https://github.com/conda-forge/miniforge/#download
40+
41+
## Step 2: Setting up
42+
43+
This step involves setting up the required configuration to run the programs in LPython.
2844

2945
### Linux
3046

47+
Run the below command to install `binutils-dev` package on Linux.
48+
3149
```bash
3250
sudo apt install binutils-dev
3351
```
3452

3553
### Windows
36-
Install Visual Studio (MSVC), for example the version 2022, you can download the
37-
Community version for free from: https://visualstudio.microsoft.com/downloads/.
3854

39-
Launch the Miniforge prompt from the Desktop.
55+
Please follow the below steps for Windows:
4056

41-
In the shell, initialize the MSVC compiler using:
57+
- Install Visual Studio, for example the version 2022.
4258

43-
```bash
44-
call "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd" -arch=x64
45-
```
59+
- You can download the
60+
Community version for free from: https://visualstudio.microsoft.com/downloads/.
61+
- After installing Visual Studio and running the Visual Studio Installer, you must install the "Desktop Development with C++" workload which will install Visual C++ Compiler (MSVC).
4662

47-
You can optionally test MSVC via:
63+
- Launch the Miniforge prompt from the Desktop.
4864

49-
```bash
50-
cl /?
51-
link /?
52-
```
65+
- It is recommended to use MiniForge instead of Powershell as the main terminal to build and write code for LPython.
5366

54-
Both commands must print several pages of help text.
67+
- In the MiniForge Prompt, initialize the MSVC compiler using the below command:
5568

56-
## Build LPython
69+
```bash
70+
call "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd" -arch=x64
71+
```
5772

58-
Clone LPython
73+
- You can optionally test MSVC via:
5974

60-
```bash
61-
git clone https://github.com/lcompilers/lpython.git
62-
cd lpython
63-
```
75+
```bash
76+
cl /?
77+
link /?
78+
```
79+
80+
Both commands must print several pages of help text.
81+
82+
## Step 3: Build LPython
83+
84+
- Clone LPython using the following commands
85+
86+
```bash
87+
git clone https://github.com/lcompilers/lpython.git
88+
cd lpython
89+
```
90+
91+
You may also use GitHub Desktop to do the same.
6492

6593
### Linux and MacOS
6694

6795
- Create a Conda environment using the pre-existing file:
6896

69-
```bash
70-
conda env create -f environment_unix.yml
71-
conda activate lp
72-
```
97+
```bash
98+
conda env create -f environment_unix.yml
99+
conda activate lp
100+
```
73101

74102
- Generate prerequisite files; build in Debug Mode:
75103

76-
```bash
77-
./build0.sh
78-
./build1.sh
79-
```
104+
```bash
105+
./build0.sh
106+
./build1.sh
107+
```
80108

81109
### Windows
82110

83111
- Create a Conda environment using the pre-existing file:
84112

85-
```bash
86-
conda env create -f environment_win.yml
87-
conda activate lp
88-
```
113+
```bash
114+
conda env create -f environment_win.yml
115+
conda activate lp
116+
```
89117

90118
- Generate prerequisite files; build in Release Mode:
91119

92-
```bash
93-
call build0.bat
94-
call build1.bat
95-
```
120+
```bash
121+
call build0.bat
122+
call build1.bat
123+
```
96124

97125
- Tests and examples
98126

99-
```bash
100-
ctest
101-
inst\bin\lpython examples\expr2.py
102-
inst\bin\lpython examples\expr2.py -o a.out
103-
a.out
104-
```
127+
```bash
128+
ctest
129+
inst\bin\lpython examples\expr2.py
130+
inst\bin\lpython examples\expr2.py -o a.out
131+
a.out
132+
```
105133

106-
- After you update a test case file, you also need to update all the reference results associated with that test case:
134+
- Whenever you are updating a test case file, you also need to update all the reference results associated with that test case:
107135

108-
```
109-
python run_tests.py -u --skip-run-with-dbg
110-
```
136+
```
137+
python run_tests.py -u --skip-run-with-dbg
138+
```
111139

112140
- To see all the options associated with LPython test suite, use:
113-
```
114-
python run_tests.py --help
115-
```
116141

117-
## Tests (Linux or MacOs):
142+
```
143+
python run_tests.py --help
144+
```
118145

119-
Run tests:
146+
## Tests:
120147

121-
```bash
122-
ctest
123-
./run_tests.py
124-
```
148+
### Linux or MacOS
125149

126-
Run integration tests:
150+
- Run tests:
127151

128-
```bash
129-
cd integration_tests
130-
./run_tests.py
131-
```
152+
```bash
153+
ctest
154+
./run_tests.py
155+
```
156+
157+
- Run integration tests:
158+
159+
```bash
160+
cd integration_tests
161+
./run_tests.py
162+
```
163+
164+
### Windows
132165

133-
### Speed up Integration Test on Macs
166+
- Run integration tests
167+
168+
```bash
169+
python run_tests.py --skip-run-with-dbg
170+
```
171+
172+
- Update reference tests
173+
174+
```bash
175+
python run_tests.py -u --skip-run-with-dbg
176+
```
177+
178+
## Speed up Integration Tests on MacOS
134179

135180
Integration tests run slowly because Apple checks the hash of each
136-
executable online before running. You can turn off that feature
137-
in the Privacy tab of the Security and Privacy item of System
138-
Preferences, Developer Tools, Terminal.app, "allow the apps below
181+
executable online before running.
182+
183+
You can turn off that feature in the Privacy tab of the Security and Privacy item of System Preferences > Developer Tools > Terminal.app > "allow the apps below
139184
to run software locally that does not meet the system's security
140185
policy."
141186

142-
## Examples (Linux or MacOs)
187+
## Examples (Linux or MacOS)
143188

144-
You can run the following examples by hand in a terminal:
189+
You can run the following examples manually in a terminal:
145190

146191
```bash
147192
./src/bin/lpython examples/expr2.py

0 commit comments

Comments
 (0)