On Thursday, November 27, 2025 at 5:20:15 AM UTC-6 Edward K. Ream wrote:

> Working directly in site-packages/pyflakes is turning out to be an 
excellent (if eccentric) strategy.  It's liberating to use live code 
without cloning or forking a repo.

I've created the ekr-live-pyflakes repo <http://ekr-live-pyflakes> for this 
work. As stated in the readme, this repo will be my private playground for 
the foreseeable future.

> Any changes to the ATTRIBUTE function take effect immediately, without 
calling importlib.reload 

Note that non-patched changes take effect only after reloading Leo (or 
after importlib.reload). So far, the only such change is pylint.__init__.py:

# True only when running the test-pyflakes script.
trace = False

My test script now contains:

try:
    pyflakes.trace = True
    check(test, filename='pyflakes_test.py')
finally:
    pyflakes.trace = False

The patched ATTRIBUTE function is now:

def ATTRIBUTE(self, node) -> None:
    if isinstance(node.value, ast.Name):
        if pyflakes.trace:
            g.trace(
                f"{node.ctx.__class__.__name__}"
                f"{node.value.id}.{node.attr}"
            )
    self.handleChildren(node)

*Summary*

This is a supremely light and flexible framework:

- I expect all experiments will occur in patched code. They have no effect 
on production code such as my pyflakes-leo.cmd script.
- I back up all code with a push from Python's site-packages/pyflakes 
directory.
- Nothing I do will have any effect on pyflakes itself. I can create my own 
issues in my repo.

This is the workflow of my dreams. Onward to the study and improvement of 
pyflakes!

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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/leo-editor/c3f1afcb-59cb-431c-a66d-85cc81127aean%40googlegroups.com.

Reply via email to