Skip to content

Commit cb92ff6

Browse files
committed
Update README with verification instructions
1 parent e21a4e9 commit cb92ff6

File tree

1 file changed

+65
-43
lines changed

1 file changed

+65
-43
lines changed

README.md

Lines changed: 65 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,103 @@
1+
12
# SymEngine Python Wrappers
23

3-
Python wrappers to the C++ library [SymEngine](https://github.com/symengine/symengine),
4+
Python wrappers to the C++ library [SymEngine](https://github.com/symengine/symengine),
45
a fast C++ symbolic manipulation library.
56

6-
[![Build Status](https://travis-ci.org/symengine/symengine.py.svg)](https://travis-ci.org/symengine/symengine.py) [![Build status](https://ci.appveyor.com/api/projects/status/sl189l9ck3gd8qvk/branch/master?svg=true)](https://ci.appveyor.com/project/symengine/symengine-py/branch/master)
7+
[![Build Status](https://travis-ci.org/symengine/symengine.py.svg)](https://travis-ci.org/symengine/symengine.py)
8+
[![Build status](https://ci.appveyor.com/api/projects/status/sl189l9ck3gd8qvk/branch/master?svg=true)](https://ci.appveyor.com/project/symengine/symengine-py/branch/master)
79

810
## Installation
911

1012
### Pip
1113

1214
See License section for information about wheels
1315

14-
pip install symengine --user
16+
```bash
17+
pip install symengine --user
18+
```
1519

1620
### Conda package manager
1721

18-
conda install python-symengine -c symengine -c conda-forge
22+
```bash
23+
conda install python-symengine -c symengine -c conda-forge
24+
```
1925

20-
optionally, you may choose to install an early [developer preview](https://github.com/symengine/python-symengine-feedstock):
26+
Optionally, you may choose to install an early [developer preview](https://github.com/symengine/python-symengine-feedstock):
2127

22-
conda install python-symengine -c symengine/label/dev -c conda-forge
28+
```bash
29+
conda install python-symengine -c symengine/label/dev -c conda-forge
30+
```
2331

2432
### Build from source
2533

2634
Install prerequisites.
2735

28-
CMake >= 2.8.12
29-
Python3 >= 3.8
30-
Cython >= 0.29.24
31-
SymEngine >= 0.7.0
36+
```bash
37+
CMake >= 2.8.12
38+
Python3 >= 3.8
39+
Cython >= 0.29.24
40+
SymEngine >= 0.7.0
41+
```
3242

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.
43+
For **SymEngine**, only a specific commit/tag (see `symengine_version.txt`) is supported.
44+
The latest git master branch may not work as there may be breaking changes in **SymEngine**.
3545

3646
Python wrappers can be installed by,
3747

38-
python setup.py install
48+
```bash
49+
python setup.py install
50+
```
51+
52+
Additional options to `setup.py` are:
53+
54+
```bash
55+
python setup.py install build_ext
56+
--symengine-dir=/path/to/symengine/install/dir # Path to SymEngine install directory or build directory
57+
--compiler=mingw32|msvc|cygwin # Select the compiler for Windows
58+
--generator=cmake-generator # CMake Generator
59+
--build-type=Release|Debug # Set build-type for multi-configuration generators like MSVC
60+
--define="var1=value1;var2=value2" # Give options to CMake
61+
--inplace # Build the extension in source tree
62+
```
63+
64+
Standard options to `setup.py` like `--user`, `--prefix` can be used to configure install location.
65+
NumPy is used if found by default, if you wish to make your choice of NumPy use explicit: then add e.g. `WITH_NUMPY=False` to `--define`.
66+
67+
### Notes on Dependencies
3968

40-
Additional options to setup.py are
69+
If you intend to evaluate floating-point expressions (using **lambdify**), you should consider linking against **LLVM**. Many users might also benefit from linking against **FLINT**, as it is now LGPL-licensed.
4170

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
71+
In general, **sudo** is only required if you are installing to the default prefix (`/usr/local`). We recommend specifying a custom prefix (`--prefix=$HOME/.local`) to avoid requiring administrative privileges, which most users can do without using **sudo**.
4972

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
52-
to make your choice of NumPy use explicit: then add
53-
e.g. ``WITH_NUMPY=False`` to ``--define``.
73+
If you're uncomfortable specifying the prefix manually, we suggest using **Conda** or installing the pre-built wheels via **pip** instead of building from source.
5474

55-
Use SymEngine from Python as follows:
75+
## Verification
5676

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
77+
You can verify the installation of **SymEngine** by using the provided code snippet in this README. This snippet ensures that the installation works as expected and that basic functionality is available.
6378

64-
You can read Python tests in `symengine/tests` to see what features are
65-
implemented.
79+
```python
80+
from symengine import var
81+
x, y, z = var('x y z')
82+
e = (x + y + z)**2
83+
expanded_e = e.expand()
84+
print(expanded_e)
85+
```
86+
This will output:
87+
```python
88+
x**2 + y**2 + z**2 + 2*x*y + 2*x*z + 2*y*z
89+
```
6690

91+
Note: The verification code provided above checks the functionality of SymEngine. For additional verification specific to SymEngine, please refer to the [official SymEngine Python bindings repository](https://github.com/symengine/symengine.py) for further tests and examples.
6792

6893
## License
6994

70-
symengine.py is MIT licensed and uses several LGPL, BSD-3 and MIT licensed libraries
95+
symengine.py is MIT licensed and uses several LGPL, BSD-3, and MIT licensed libraries.
7196

72-
Licenses for the dependencies of pip wheels are as follows,
97+
Licenses for the dependencies of pip wheels are as follows:
7398

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
99+
- pip wheels on Unix use **GMP** (LGPL-3.0-or-later), **MPFR** (LGPL-3.0-or-later), **MPC** (LGPL-3.0-or-later), **LLVM** (Apache-2.0), **zlib** (Zlib), **libxml2** (MIT), **zstd** (BSD-3-Clause), and **symengine** (MIT AND BSD-3-Clause).
100+
- pip wheels on Windows use **MPIR** (LGPL-3.0-or-later) instead of **GMP** above and **pthreads-win32** (LGPL-3.0-or-later) additionally.
101+
- **NumPy** (BSD-3-Clause) and **SymPy** (BSD-3-Clause) are optional dependencies.
102+
- Sources for these binary dependencies can be found on [symengine-wheels](https://github.com/symengine/symengine-wheels/releases).
81103

0 commit comments

Comments
 (0)