For Félix: my thoughts re #1970

35 views
Skip to first unread message

Edward K. Ream

unread,
Jun 11, 2021, 1:59:04 PM6/11/21
to leo-editor
#1970 is presently titled "update leo/core/leoserver.py from leointeg/leobridgeserver.py"

This project isn't as simple as it may seem. This post describes my plans and my thinking.

The goal

Imo, it is becoming urgent to use Leo's server code in leoInteg. In other words, we want exactly one version of Leo's server.

Again imo, that server should be called leoserver.py, and it should live in leo/core.

As I suggested earlier, the user of leoInteg should only have to point to Leo's leo-editor folder.  Once that happens, leoInteg can easily find leo/core/leoserver.py.

BTW, there is an inevitable confusion about the phase "path to the leo-editor folder".  Does that path include leo-editor itself, or does the path end with the parent directory of leo-editor?  So the label to be used on the button that selects the leo-editor folder is a bit fraught.  Happily, behind the scenes the code that sets the setting can ensure that yes, the path does end in /leo-editor.  Clear?

The present code in the ekr-server-imports branch

At present, PR #1971 goes considerably farther than the title of #1970 implies. As a result, the diff is long.

Per the title of #1970, the general idea is that leo/core/leoserver.py is closely based on leointeg/leobridgeserver.py.  However, leointeg.leo uses an `@clean` tree for leobridgeserver.py, but in leo/core/leoserver.py I definitely want to use `@file`. This change adds a lot of sentinels to the diff.  Furthermore, the `@file` node starts with `@first` to get the shebang line at the very start of the file.

My plan

I would like to merge the ekr-server-imports branch into devel in the next day or so. Unless I have made a serious error in the copy/paste process, leoserver.py should be functionally identical to leobridgeserver.py.

As noted in both #1970 and PR #1971, I have also made a few other changes:

- Using __file__, add path to leo-editor folder to sys.path if necessary.
  As we have discussed, this new code should allow leointeg to execute leoserver.py
  regardless of system settings, and regardless of the paths in python's sys.path array.
- Add leo/core/old_leoserver.py for comparison.
  This file will eventually go away, but for now it may be useful.
- Fix some pyflakes complaints by commenting out unused code.

Summary

Right now leoInteg works with leoserver.py in the ekr-server-imports branch.

The diffs for the PR are long because leoserver.py was created from `@file` instead of `@clean`.

Unless there are serious problems with leoserver.py, I would like to merge the ekr-server-imports branch into devel in the next day or three.  I would like to make some additional changes to leoserver.py to make it more pythonic or Leonine, but I want to make all such changes as part of a separate issue and PR.  That way the diffs will be small and focused.

Once leoserver.py becomes part of Leo's devel branch, I recommend deleting leobridgeserver.py from leoInteg as soon as possible.

Félix, I will wait for your comments before merging ekr-server-imports into devel.

Edward

Edward K. Ream

unread,
Jun 11, 2021, 2:03:50 PM6/11/21
to leo-editor
On Friday, June 11, 2021 at 12:59:04 PM UTC-5 Edward K. Ream wrote:

> As noted in both #1970 and PR #1971, I have also made a few other changes:

I forgot to mention that I have added back the TestLeoServer test class to leoserver.py.  I haven't run those tests. I suspect most will fail until I use the new names. That work can and should wait for another issue/PR.

Edward

tbp1...@gmail.com

unread,
Jun 11, 2021, 2:26:18 PM6/11/21
to leo-editor
I am completely in agreement with the program of having the one server instead of two or more.  It seems to be that leointeg's server does not need to contain anything specific to leointeg, except possibly having an incomplete command set that is suitable for leointeg's needs.  If that is correct, then one server should definitely be feasible.

Félix

unread,
Jun 11, 2021, 11:13:56 PM6/11/21
to leo-editor
Hi Edward, Hi Thomas!

Thanks for resuming the whole of what we agreed orally on here in this post :)

Thomas > It seems to be that leointeg's server does not need to contain anything specific to leointeg
I intended since the very start for the server to be totally agnostic of leointeg or vscode :) 

EkR > again imo, that server should be called leoserver.py, and it should live in leo/core.
yes indeed, that is the plan. 

EkR > the user of leoInteg should only have to point to Leo's leo-editor folder.
Yep, it's the least troublesome thing to ask the user (so we're not asking them to set environment variables and other things newbies might not be able to do by themselves.)

EkR > I definitely want to use `@'file. 
Haha! yeah me too! I just recently realized why @file is much better when trying to collaborate with other people in 'gitted' project! omg! (I'll probably switch most files in leointeg to @files too pretty soon!)

EkR >  I would like to make some additional changes to leoserver.py to make it more pythonic or Leonine, but I want to make all such changes as part of a separate issue and PR. 
As I'm writing this, I haven't even taken a look at what you did, but yeah, well adjust with additional branches/commits.

So go indeed ahead and merge into 'devel', in the meantime, tonight, I'll modify leointeg to accept and use a path to the leo-editor folder (instead of an actual script file) on my 'dev' branch. and perhaps along with Leo's 'devel' branch we'll have a combo that 'works' like we ultimately intend. :)

I'll leave the leointeg master branch untouched for now and will commit / merge up into  'dev' until we're both in sync and have tested things out.
--
Félix

Edward K. Ream

unread,
Jun 12, 2021, 6:25:34 AM6/12/21
to leo-editor
On Fri, Jun 11, 2021 at 10:13 PM Félix <felix...@gmail.com> wrote:
Hi Edward, Hi Thomas!

Thanks for [sumarizing] the whole of what we agreed orally on here in this post :)

I'm glad you agree.  I'll merge ekr-server-imports into devel in a few minutes.

EkR > again imo, that server should be called leoserver.py, and it should live in leo/core.
yes indeed, that is the plan. 

This morning I was wondering why I prefer the name leoserver.py to leobridgeserver.py.  The reason, I think, is that there is only ever going to be one server, so the name need not (should not?) refer to implementation strategy.

Similarly, in another branch I'll probably want to change the name of the LeoBridgeIntegController class back to LeoServer. That name change should have no effect on either leoInteg or Leo itself.

EkR > I definitely want to use `@'file. 
Haha! yeah me too! I just recently realized why @file is much better when trying to collaborate with other people in 'gitted' project! omg! (I'll probably switch most files in leointeg to @files too pretty soon!)

Good. All future Leo devs will be using Leo, so @file much more convenient than @clean.

Edward

Edward K. Ream

unread,
Jun 12, 2021, 7:00:00 AM6/12/21
to leo-editor
On Saturday, June 12, 2021 at 5:25:34 AM UTC-5 Edward K. Ream wrote:
On Fri, Jun 11, 2021 at 10:13 PM Félix <felix...@gmail.com> wrote:

 >> Thanks for [summarizing] the whole of what we agreed orally on here in this post :)

> I'm glad you agree.  I'll merge ekr-server-imports into devel in a few minutes.

Done.

I have just created #1975, tweak leoserver.py. Félix, please review the to-do list and let me know if you disagree with any of the items.

I would like to complete #1975 in a day or two so that we can all have a stable base for further work.

Edward
Reply all
Reply to author
Forward
0 new messages