|
3 | 3 | Python wrappers to the C++ library [SymEngine](https://github.com/symengine/symengine),
|
4 | 4 | a fast C++ symbolic manipulation library.
|
5 | 5 |
|
6 |
| -[](https://travis-ci.org/symengine/symengine.py) [](https://ci.appveyor.com/project/symengine/symengine-py/branch/master) |
| 6 | +[](https://travis-ci.org/symengine/symengine.py) |
| 7 | +[](https://ci.appveyor.com/project/symengine/symengine-py/branch/master) |
7 | 8 |
|
8 | 9 | ## Installation
|
9 | 10 |
|
10 | 11 | ### Pip
|
11 | 12 |
|
12 | 13 | See License section for information about wheels
|
13 | 14 |
|
14 |
| - pip install symengine --user |
| 15 | +```bash |
| 16 | +pip install symengine --user |
| 17 | +``` |
15 | 18 |
|
16 | 19 | ### Conda package manager
|
17 | 20 |
|
18 |
| - conda install python-symengine -c symengine -c conda-forge |
19 |
| - |
20 |
| -optionally, you may choose to install an early [developer preview](https://github.com/symengine/python-symengine-feedstock): |
21 |
| - |
22 |
| - conda install python-symengine -c symengine/label/dev -c conda-forge |
| 21 | +```bash |
| 22 | +conda install python-symengine -c conda-forge |
| 23 | +``` |
23 | 24 |
|
24 | 25 | ### Build from source
|
25 | 26 |
|
26 | 27 | Install prerequisites.
|
27 | 28 |
|
28 |
| - CMake >= 2.8.12 |
29 |
| - Python3 >= 3.8 |
30 |
| - Cython >= 0.29.24 |
31 |
| - SymEngine >= 0.7.0 |
| 29 | +```bash |
| 30 | +CMake >= 2.8.12 |
| 31 | +Python3 >= 3.8 |
| 32 | +Cython >= 0.29.24 |
| 33 | +SymEngine >= 0.7.0 |
| 34 | +``` |
32 | 35 |
|
33 |
| -For SymEngine, only a specific commit/tag (see symengine_version.txt) is supported. |
34 |
| -Latest git master branch may not work as there may be breaking changes in SymEngine. |
| 36 | +For **SymEngine**, only a specific commit/tag (see `symengine_version.txt`) is |
| 37 | +supported. The latest git master branch may not work as there may be breaking |
| 38 | +changes in **SymEngine**. |
35 | 39 |
|
36 | 40 | Python wrappers can be installed by,
|
37 | 41 |
|
38 |
| - python setup.py install |
| 42 | +```bash |
| 43 | +python setup.py install |
| 44 | +``` |
39 | 45 |
|
40 |
| -Additional options to setup.py are |
| 46 | +Additional options to `setup.py` are: |
41 | 47 |
|
42 |
| - python setup.py install build_ext |
43 |
| - --symengine-dir=/path/to/symengine/install/dir # Path to SymEngine install directory or build directory |
44 |
| - --compiler=mingw32|msvc|cygwin # Select the compiler for Windows |
45 |
| - --generator=cmake-generator # CMake Generator |
46 |
| - --build-type=Release|Debug # Set build-type for multi-configuration generators like MSVC |
47 |
| - --define="var1=value1;var2=value2" # Give options to CMake |
48 |
| - --inplace # Build the extension in source tree |
| 48 | +```bash |
| 49 | +python setup.py install build_ext |
| 50 | + --symengine-dir=/path/to/symengine/install/dir # Path to SymEngine install directory or build directory |
| 51 | + --compiler=mingw32|msvc|cygwin # Select the compiler for Windows |
| 52 | + --generator=cmake-generator # CMake Generator |
| 53 | + --build-type=Release|Debug # Set build-type for multi-configuration generators like MSVC |
| 54 | + --define="var1=value1;var2=value2" # Give options to CMake |
| 55 | + --inplace # Build the extension in source tree |
| 56 | +``` |
49 | 57 |
|
50 |
| -Standard options to setup.py like `--user`, `--prefix` can be used to |
51 |
| -configure install location. NumPy is used if found by default, if you wish |
| 58 | +Standard options to `setup.py` like `--user`, `--prefix` can be used to |
| 59 | +configure install location. NumPy is used if found by default, if you wish |
52 | 60 | to make your choice of NumPy use explicit: then add
|
53 |
| -e.g. ``WITH_NUMPY=False`` to ``--define``. |
54 |
| - |
55 |
| -Use SymEngine from Python as follows: |
56 |
| - |
57 |
| - >>> from symengine import var |
58 |
| - >>> var("x y z") |
59 |
| - (x, y, z) |
60 |
| - >>> e = (x+y+z)**2 |
61 |
| - >>> e.expand() |
62 |
| - 2*x*y + 2*x*z + 2*y*z + x**2 + y**2 + z**2 |
63 |
| - |
64 |
| -You can read Python tests in `symengine/tests` to see what features are |
65 |
| -implemented. |
66 |
| - |
| 61 | +e.g. `WITH_NUMPY=False` to `--define`. |
| 62 | + |
| 63 | +### Notes on Dependencies |
| 64 | + |
| 65 | +If you intend to evaluate floating-point expressions (using **lambdify**), |
| 66 | +you should consider linking against **LLVM**. Many users might also benefit |
| 67 | +from linking against **FLINT**, as it is now LGPL-licensed. |
| 68 | + |
| 69 | +In general, **sudo** is only required if you are installing to the default |
| 70 | +prefix (`/usr/local`). We recommend specifying a custom prefix |
| 71 | +(`--prefix=$HOME/.local`) to avoid requiring administrative privileges, |
| 72 | +which most users can do without using **sudo**. |
| 73 | + |
| 74 | +If you're uncomfortable specifying the prefix manually, we suggest using |
| 75 | +**Conda** or installing the pre-built wheels via **pip** instead of building |
| 76 | +from source. |
| 77 | + |
| 78 | +## Verification |
| 79 | + |
| 80 | +You can verify the installation of **SymEngine** by using the provided code |
| 81 | +snippet in this README. This snippet ensures that the installation works as |
| 82 | +expected and that basic functionality is available. |
| 83 | + |
| 84 | +```python |
| 85 | +from symengine import var |
| 86 | +x, y, z = var('x y z') |
| 87 | +e = (x + y + z)**2 |
| 88 | +expanded_e = e.expand() |
| 89 | +print(expanded_e) |
| 90 | +``` |
| 91 | +This will output: |
| 92 | +```python |
| 93 | +x**2 + y**2 + z**2 + 2*x*y + 2*x*z + 2*y*z |
| 94 | +``` |
| 95 | + |
| 96 | +Note: The verification code provided above checks the functionality of |
| 97 | +SymEngine. For additional verification specific to SymEngine, please refer to |
| 98 | +the [official SymEngine Python bindings repository](https://github.com/symengine/symengine.py) |
| 99 | +for further tests and examples. |
67 | 100 |
|
68 | 101 | ## License
|
69 | 102 |
|
70 |
| -symengine.py is MIT licensed and uses several LGPL, BSD-3 and MIT licensed libraries |
71 |
| - |
72 |
| -Licenses for the dependencies of pip wheels are as follows, |
73 |
| - |
74 |
| -pip wheels on Unix use GMP (LGPL-3.0-or-later), MPFR (LGPL-3.0-or-later), |
75 |
| -MPC (LGPL-3.0-or-later), LLVM (Apache-2.0), zlib (Zlib), libxml2 (MIT), |
76 |
| -zstd (BSD-3-Clause) and symengine (MIT AND BSD-3-Clause). |
77 |
| -pip wheels on Windows use MPIR (LGPL-3.0-or-later) instead of GMP above and |
78 |
| -pthreads-win32 (LGPL-3.0-or-later) additionally. |
79 |
| -NumPy (BSD-3-Clause) and SymPy (BSD-3-Clause) are optional dependencies. |
80 |
| -Sources for these binary dependencies can be found on https://github.com/symengine/symengine-wheels/releases |
| 103 | +symengine.py is MIT licensed and uses several LGPL, BSD-3, and MIT licensed |
| 104 | +libraries. |
| 105 | + |
| 106 | +Licenses for the dependencies of pip wheels are as follows: |
| 107 | + |
| 108 | +- pip wheels on Unix use **GMP** (LGPL-3.0-or-later), |
| 109 | + **MPFR** (LGPL-3.0-or-later), **MPC** (LGPL-3.0-or-later), |
| 110 | + **LLVM** (Apache-2.0), **zlib** (Zlib), **libxml2** (MIT), |
| 111 | + **zstd** (BSD-3-Clause), and **symengine** (MIT AND BSD-3-Clause). |
| 112 | +- pip wheels on Windows use **MPIR** (LGPL-3.0-or-later) instead of **GMP** |
| 113 | + above and **pthreads-win32** (LGPL-3.0-or-later) additionally. |
| 114 | +- **NumPy** (BSD-3-Clause) and **SymPy** (BSD-3-Clause) are optional |
| 115 | + dependencies. |
| 116 | +- Sources for these binary dependencies can be found on |
| 117 | + [symengine-wheels](https://github.com/symengine/symengine-wheels/releases). |
81 | 118 |
|
0 commit comments