I've been making a mistake in setting up Leo and using it for years!
Anyway, I expanded the docstring of setup.py and put in a guard to prevent anyone from using it naively like I did. I've attached below.
Anyway, I expanded the docstring of setup.py and put in a guard to prevent anyone from using it naively like I did. I've attached below.Looks good to me. Matt, any comments?
I've always installed Leo using pip. I still don't understand what "--editable" accomplishes, so I've never used it.
I recall reading that launchLeo acts different somehow than leo.core.runLeo, but I don't remember the differences. For what it's worth, I normally start Leo with python -m leo.core.runLeo
I've always installed Leo using pip. I still don't understand what "--editable" accomplishes, so I've never used it.Pip install puts the package and all the files it says it needs under PYTHONHOME/Lib/site-packages and creates a launch wrapper in PYTHONHOME/Scripts.Pip install --editable doesn't copy anything, puts link files in Lib pointing to the code location, and creates the launch wrapper to code location.
So if I had a clone at d:\leo-clone, I'd use the following?python -m pip install --editable d:\leo-clone
I have been setting PYTHONPATH to d:\leo-clone. This has always seemed to work well, as long as the dependencies have been installed in my main Python install (because of a previous Leo install, for example). This way, I can always switch back to using the previous install just by launching from another terminal without setting PYTHONPATH.
pip install -e d:\leo-clone
pushd d:\leo-clone
git checkout v6.1
python -m leo.core.runLeo
# hack, hack. do stuff in Leo 6.1. exit.
git checkout v6.2
python -m leo.core.runLeo
# hack, hack. do stuff in Leo 6.2. exit.
...etc
So if I had a clone at d:\leo-clone, I'd use the following?python -m pip install --editable d:\leo-cloneYes.I have been setting PYTHONPATH to d:\leo-clone. This has always seemed to work well, as long as the dependencies have been installed in my main Python install (because of a previous Leo install, for example). This way, I can always switch back to using the previous install just by launching from another terminal without setting PYTHONPATH.If your diferent versions are in the same SCM repo (eg. hg, git) then resettng to or checking out your desired version can be done without messing with PYTHONPATH. This is the primary benefit of editable install, it always uses what's in that directory tree right now, allowing you to test code changes immediately.pip install -e d:\leo-clone
pushd d:\leo-clone
git checkout v6.1
python -m leo.core.runLeo
# hack, hack. do stuff in Leo 6.1. exit.
git checkout v6.2
python -m leo.core.runLeo
# hack, hack. do stuff in Leo 6.2. exit.
...etc
If you want to run different versions of Leo side by side then don't pip install Leo at all, editable or not, and set PYTHONPATH the way you have been. I think it's cleaner to not to change PYTHONPATH though and to use `python d:\leo-clone-2\launchLeo.py` for starting. (It might mess with some imports or make them unpredictable as they search in Leo's tree instead of the real python tree.)
Also for sde-byside it's best not to use the same HOME, as files in the .leo folder might get messed up.
Then you could keep your development code entirely out of the repo until you got it to the point it was worth adding it in. I'd like that.
Also for sde-byside it's best not to use the same HOME, as files in the .leo folder might get messed up.That's a problem that I sometimes have, not only with side-by-side. I don't like to use side-by-side anyway except for, let's say, checking that something still works in a different version of Leo. Even virtual environments don't solve this, do they?
Then you could keep your development code entirely out of the repo until you got it to the point it was worth adding it in. I'd like that.A fork would accomplish this and then be easier to add to the main repo later. I think so anyway, but there might be things I'm not considering that could make it more work than is desireable.
With the confusions I've had using github forks, I think I'd like to work in my own Mercurial repo, where I would only need my own code and not the entire Leo distro, and copy the results to my Github fork of Leo. For that to work, the most convenient way would be for Leo to load plugins from the PYTHONPATH instead of its own location.One of the github things that I haven't mastered is when I start a branch for a project - say based off devel - and then that upstream branch changes before I'm ready to merge or do a pull request. Of course, this happens all the time. If I don't update my fork to upstream, then the merge or pull request could involve all those other changed files that I wasn't working on. If I do update to upstream, then the update would step all over my work, and I would have to copy my work back into the fork.Do you know how to make this all work?
b) merge early, merge often: as in daily. This way any given upstream change can (usually) be inspected and accepted/changed in small easy to understand pieces. Use an interactice tool like WinMerge or Kmeld to do the merging. (WinMerge has been easiest for me to understand, the keyboard shortcuts make sense to me.)
Really though if what you're doing now is successful keep doing it! VR3 is awesome. Better you spend your precious attention on building cool things like that than figuring out git arcana. ;-)
-matt