0

I am working on a pull request for sympy, so I have cloned the repo and I have modified some code. Now I want to import my own sympy from my git repo. I am very confused by these answers as they seem to apply to modules that are contained in a single .py file. Here, instead, we are dealing with a bigger package which has a __init__.py in a directory called SOMEPATH/sympy ...

The question is how do I import sympy from this particular folder, possibly without having to install it via the setup.py script (which would be needed at every modification of the code, hence very painful).

Thanks

Rho Phi
  • 1,182
  • 1
  • 12
  • 21

1 Answers1

1

You can do an "editable install":

git clone https://github.com/sympy/sympy.git
cd sympy
pip install -e .

When would the -e, --editable option be useful with pip install?

This isn't necessary but personally I would create a specific virtual environment (venv) for working on sympy. Then I install any dependencies in the venv and install sympy from the VCS checkout in editable mode. That way if I want to work a pull request for sympy I have everything ready in the venv and it's all separate from any version of sympy etc that I already have installed somewhere else.

Oscar Benjamin
  • 12,649
  • 1
  • 12
  • 14
  • Using conda I was able to make the venv quite easily. I had to reinstall all up to the jupyter IDE in this venv, but I think this was the simplest way after all. – Rho Phi Jul 17 '20 at 14:27
  • still I have to quit Jupyter to reload edits to my sympy, as `importlib.reload()` seems to not be enough – Rho Phi Jul 17 '20 at 14:28
  • I don't think `reload` has ever really worked properly. It's always best to start a new process. – Oscar Benjamin Jul 17 '20 at 15:59