| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
LPython is a Python compiler. It is in heavy development, currently in alpha stage. LPython works on Windows, macOS and Linux. Some of the goals of LPython include:
And more.
LPython has been sponsored by GSI Technology. Our summer students were sponsored by Google Summer of Code via Python Software Foundation. The intermediate representation and backends are shared with LFortran, see that project for a list of sponsors.
Here is the list of requirements needed to build LPython:
For Windows, these are additionally required:
Please follow the steps for your desired platform.
This step involves installing Conda using a conda-forge distribution called Miniforge.
Please follow the instructions here to install Conda on your platform:
Miniforge download link (for Linux, MacOS and Windows): https://github.com/conda-forge/miniforge/#download
This step involves setting up the required configuration to run the programs in LPython.
Run the below command to install binutils-dev package on Linux.
sudo apt install binutils-devPlease follow the below steps for Windows:
Install Visual Studio, for example the version 2022.
Launch the Miniforge prompt from the Desktop.
In the MiniForge Prompt, initialize the MSVC compiler using the below command:
call "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd" -arch=x64You can optionally test MSVC via:
cl /?
link /?Both commands must print several pages of help text.
Clone LPython using the following commands
git clone https://github.com/lcompilers/lpython.git
cd lpythonYou may also use GitHub Desktop to do the same.
Create a Conda environment using the pre-existing file:
conda env create -f environment_unix.yml
conda activate lpGenerate prerequisite files; build in Debug Mode:
# if you are developing on top of a forked repository; please run following command first
# ./generate_default_tag.sh
./build0.sh
./build1.shCreate a Conda environment using the pre-existing file:
conda env create -f environment_win.yml
conda activate lpGenerate prerequisite files; build in Release Mode:
call build0.bat
call build1.batTests and examples
ctest
src\bin\lpython examples\expr2.py
src\bin\lpython examples\expr2.py -o a.out
a.outWhenever you are updating a test case file, you also need to update all the reference results associated with that test case:
python run_tests.py -u --skip-run-with-dbg
To see all the options associated with LPython test suite, use:
python run_tests.py --help
Run tests:
ctest
./run_tests.pyRun integration tests:
cd integration_tests
./run_tests.pyTroubleshooting on MacOS latest version:
In case of recently updated MacOS, you may get a warning like below in some test cases:
ld: warning: object file (test_list_index2.out.tmp.o) was built for newer macOS version (14.0) than being linked (13.3)This leads to mismatch of hashes with expected output in some test cases, this can be resolved by updating command line tools. Below is a snippet for the same.
git clean -dfx
sudo rm -rf /Library/Developer/CommandLineTools # make sure you know what you're doing here
sudo xcode-select --install
./build.sh
./run_tests.pyRun integration tests
python run_tests.py --skip-run-with-dbgUpdate reference tests
python run_tests.py -u --skip-run-with-dbgIntegration tests run slowly because Apple checks the hash of each executable online before running.
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 to run software locally that does not meet the system's security policy."
You can run the following examples manually in a terminal:
./src/bin/lpython examples/expr2.py
./src/bin/lpython examples/expr2.py -o expr
./expr
./src/bin/lpython --show-ast examples/expr2.py
./src/bin/lpython --show-asr examples/expr2.py
./src/bin/lpython --show-cpp examples/expr2.py
./src/bin/lpython --show-llvm examples/expr2.py
./src/bin/lpython --show-c examples/expr2.pyWe welcome contributions from anyone, even if you are new to compilers or to open source. It might sound daunting to contribute to a compiler at first, but please do, it is not complicated. We will help you with technical issues and help improve your contribution so that it can be merged.
To contribute, submit a Pull Request (PR) against our repository at:
https://github.com/lcompilers/lpython
and don't forget to clean your history, see example.
Please report any bugs you may find at our issue tracker: https://github.com/lcompilers/lpython/issues. Or, even better, fork the repository on GitHub and create a PR. We welcome all changes, big or small, and we will help you make a PR if you are new to git.
If you have any questions or need help, please ask us at Zulip ()
or our mailinglist.
See the CONTRIBUTING document for more information.
| Back | FazBrowse Home | New Git URL |