Reputation: 51
I want to use the "newenv" approach, but now I need to make changes to psynet (for example adding a log line or rpdb.set_trace()), where is this local copy? And can I simply change it or I need to reinstall the environment with reenv?
Upvotes: 1
Views: 66
Reputation: 12270
The simplest way to do this is certainly to edit the file in the venv, but as has been pointed out it's easy to lose track of that change and overwrite it. I do that anyway if it's a short term test.
However, my preferred approach when I want to modify a library like this is to clone its source code from Git, do the modifications in my cloned sandbox, and do a pip install -e .
inside the module after having activated the venv. That will make this venv replace the previously installed version of the library with my sandbox version of it.
Upvotes: 1
Reputation: 912
If you want to achieve this, you should edit the source code files within your env
directory, which will be located in your project directory. PsyNet will be located somewhere like this:
env/lib/python3.9/site-packages/psynet
Note that any changes will be reset the next time you run newenv
.
Upvotes: 1
Reputation: 96
I believe this is the right workflow:
newenv
, which currently stands foralias newenv="python3 -m venv env && source env/bin/activate && pip install -r constraints.txt"
This will install all the dependencies in your constraints file, which should include the Psynet version too.
experiment.py
) that do not involve any change in your dependencies/ packaged, then you do not need to do anything. But if your changes involve the packages your are working with in your environment (a change in PsyNet or some of your working packages, like REPP or melody-experiments), then you will need to first push the changes in GITHUB and then reinstall your working environment, using the command reenv
, which stands for:alias reenv="rm -rf env && newenv && source env/bin/activate && pip install -r constraints.txt"
requirements.txt
, such as adding a new package or changing PsyNet's version. In this case, after changing your requirements, you should run dallinger generate-constraints
, which will update your constraints.txt
accordingly Then, run reenv
.Upvotes: 1