ENB: The os.path wrapper mess

2023-04-10 Thread Edward K. Ream
This Engineering Notebook post reviews the present state of Leo's g.os_path 
functions and discusses various ideas for improving them.

*tl;dr*: Leo's g.os_path wrappers should be deprecated, but they will 
remain in Leo's core. 

*Background*

Leo's g.os_path wrappers contain redundant and confusing code, but cleaning 
up this mess will be dangerous. PR #3264 
 broke @path 
expressions because of an invalid rewrite of expand_path_expression. This 
method must *not* *finalize *the path by calling (directly or indirectly) 
os.path.abspath or os.path.normpath.

PR #3275  makes the 
minimum changes necessary to make @path work again. This PR retains all 
other calls to the os.path wrappers, even when redundancies are apparent. 

*Removing redundancy*

The challenge: remove the redundancies while ensuring that Leo:
- calls os.path.expanduser and os.path wherever needed.
- never calls os.path.normpath inappropriately.
  Finalizing a path too soon can cause bugs. 

*Deprecating the wrappers*

These wrappers are faux helpers. Leo's core can tolerate the g.os_path 
wrappers because they enforce standards. Plugins and scripts will likely be 
easier to understand if they call os.path functions directly.

*Summary*

Leo's core can tolerate the g.os_path wrappers because they enforce 
standards. I plan to deprecate these wrappers for general use.

Revising these wrappers is dangerous. The work might not become part of Leo 
6.7.3.

Your comments, please.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/bf7197b1-a14c-42c4-a01c-4c306875bce5n%40googlegroups.com.


Re: Pydantic - Type Hints For Validating Data

2023-04-10 Thread Edward K. Ream
On Mon, Apr 10, 2023 at 8:06 AM Thomas Passin  wrote:

> I just learned of the Pydantic   project.  It
> uses Python's type hints to validate structured data at the point of use.
> It sounds interesting.


Thanks for the link.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAMF8tS3xBQuLFk8PKEFRk0aJ2N3rbSNLixo4k4xqaPmipnzYhQ%40mail.gmail.com.


Pydantic - Type Hints For Validating Data

2023-04-10 Thread Thomas Passin
I just learned of the Pydantic   project.  It 
uses Python's type hints to validate structured data at the point of use.  
It sounds interesting.

"Data validation and settings management using Python type annotations.

*pydantic* enforces type hints at runtime, and provides user friendly 
errors when data is invalid.

Define how data should be in pure, canonical Python; validate it with 
*pydantic*."


-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/59215e0b-aad7-47e8-9523-8837e1986a47n%40googlegroups.com.


Re: Leo 6.7.3 coming soon

2023-04-10 Thread Thomas Passin
On Monday, April 10, 2023 at 8:04:23 AM UTC-4 Edward K. Ream wrote:

The fix appears to be straightforward, but it points out the folly of 
rushing to release major changes.


+10! 

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/82d69f1f-9877-42b7-82f2-9031c8d5a807n%40googlegroups.com.


Re: Leo 6.7.3 coming soon

2023-04-10 Thread Edward K. Ream
On Saturday, April 8, 2023 at 12:13:36 PM UTC-5 Edward K. Ream wrote:

I shall release Leo 6.7.3 as soon as possible after we test PR #3264 
.


Maybe still true, but we must all test 6.7.3 for at least two weeks after 
all path-related PRs have been merged into devel.

Many thanks to Thomas for his excellent testing. He discovered that PR #3264 
 broke @path!

The fix appears to be straightforward, but it points out the folly of 
rushing to release major changes.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/ff22a3b9-53cd-4210-b6e6-c55532c20929n%40googlegroups.com.