Development Environment Setup#
The first step to contributing to the code base is creating your development environment.
SymPy is available on GitHub and uses Git for source control. The workflow is such that code is pulled and pushed to and from the main repository. Install the respective version of Git for your operating system to start development.
Get the SymPy Code#
It is recommended practice to create a fork of the SymPy project for your development purposes. Create your own fork of the SymPy project (if you have not yet). Go to the SymPy GitHub repository:
You will now have a fork at <https://github.com/<your-user-name>/sympy>.
Then, nn your machine browse to where you would like to store SymPy, and clone (download) the latest code from SymPy’s original repository (about 77 MiB):
$ git clone https://github.com/<your-user-name>/sympy
You must configure the remote repositories for collaboration with the upstream project:
$ cd sympy $ git remote add upstream https://github.com/sympy/sympy
After the configuration, your setup should be similar to this:
$ git remote -v origin https://github.com/<your-user-name>/sympy (fetch) origin https://github.com/<your-user-name>/sympy (push) upstream https://github.com/sympy/sympy (fetch) upstream https://github.com/sympy/sympy (push)
For further development, it is recommended to create a development branch.
$ git checkout -b dev-branch
The new branch can be of any name.
Virtual Environment Setup#
You may want to take advantage of using virtual environments to isolate your development version of SymPy from any system wide installed versions, e.g. from
apt-get install python-sympy.
We recommend using
conda to create a virtual environment:
$ conda create -n sympy-dev python=3 mpmath flake8
You now have a environment that you can use for testing your development copy of SymPy. For example, clone your SymPy fork from Github:
$ git clone email@example.com:<your-github-username>/sympy.git $ cd sympy
Now activate the environment:
$ conda activate sympy-dev
Run the Tests#
There are several ways of running SymPy tests but the easiest is to use the
bin/test script, consult ‘the wiki details on running tests <https://github.com/sympy/sympy/wiki/Running-tests>`_.
The script takes a number of options and arguments and then passes them to
sympy.test(*paths, **kwargs). Run
bin/test --help for all supported arguments.
Run all tests by using the command:
To run tests for a specific file, use:
$ bin/test test_basic
test_basic is from file
To run tests for modules, use:
$ bin/test /core /utilities
This will run tests for the
Similary, run quality tests with:
$ bin/test code_quality