Back to Basics after My Code Chokes from Bloat
Simplicity (KISS)
Frugality.
They are some of the principles we are taught to keep in mind as we add more and more code to our projects.
Alas. I strayed off this trail-marked path.
And now my initial Xpander project modules are crashing during compilation due to a host of never ending syntax errors.
So it's time to start all over with a clean slate.
Back to Basics.
Return to Roots.
A New Beginning.
But wait.
I hear that "UV" is the superior way to launch a new project.
How do you install and use UV as a beginner? ( <-- YouTube search results)
^^^-- Astral install site here
^^^-- TwT's answer here
^^^-- Corey Schafer's answer here
^^^-- Josh's answer here
^^^-- Indently search results ::: UV here (includes TOML)
^^^-- How to Use UV in PyCharm
Shaw ::: The Fastest Way to Install (and Use) Python
Indently's advanced UV commands here
LATER IN TIME ......
Eureka, it worked !!
The download and install of UV from the Astral site (above) worked.
The latest version of PyCharm already had a UV option for creating a new (a starting afresh) Project. It worked flawlessly.
Have no fear.
I suddenly felt good about my coding ability rather than hopelessly lost in the clutter of my over-bloated previous project folder.
Below is a draft (not a final) version of my "Simple Typer" code
As can be seen, it's not exactly "simple".
More explanation will follow below the shown code.
# Date 09/24/2026 funcs_06 module == Xpander-1 restart
import keyboard # https://www.google.com/search?client=opera&q=python+keyboard+module+documentation&sourceid=opera&ie=UTF-8&oe=UTF-8
def get_keystroke():
key_read = ''
keyrd = keyboard.read_event(suppress = True)
keyrd = keyboard.read_event(suppress=True)
key_read = key_read.join(keyrd.name)
return key_read
def simple_typer(xit_trigs: list, pretext: list):
stop = False; indx = -1; spacex = -1; wasc = [0, 0, 0, 0] # prefixes = Window, Alt, Shift, Ctrl
convert = {'space': " ", 'enter': f"\n"}
while stop == False:
indx += 1 # start counting new chars to append to pretext
hit = str(get_keystroke())
if hit.lower() == '`':
stop = True; mssg = "P3 was detected"
return mssg
elif hit.lower() == 'space':
hit = " "; pretext.append(hit); print(hit, end = '') ; spacex = indx
elif hit.lower() == 'enter':
hit = f"\n"; pretext.append(hit); print(hit, end = '')
elif hit.lower() == 'tab':
hit = f"\t"; pretext.append(hit); print(hit, end = '')
elif hit.lower() == 'shift':
wasc[2] += 1; indx -= 1
else:
pretext.append(hit); print(hit, end = '')
continue
return pretext, indx, spacex, wasc
print(f'\n\nBegin simple typer. Hit Enter to quit\n\n')
mssg = simple_typer(['`', '~'], [])
print(f'\n\nEnd of simple typer. mssg = {mssg}\n\n')
Functions are just another way of hiding the lower level codes, as are modules, packages and classes. D'oh. Why was I so blind to that obvious theme?
match situation[hit_key_name]:
MORE TO EXPLORE
QAB-g ::: Use UV to set up your Python environment
QAB-y ::: Use UV to set up your Python environment
QAB-r ::: How to use UV to set up your Python environment
Dave Ebbelaar -- Why Python Developers Are Switching to UV
Real Python -- Advanced UV versus PiP
Timnology -- UV - A modern python project and dependency manager







Comments
Post a Comment