A tiny helper to attach PyCharm’s debugger from Spark executors (e.g., mapPartitions, foreachPartition, UDFs) without hard-coding a port.
It walks up the parent process tree, finds the --port that PyCharm’s debug server started with, and connects executors to it. You can also override via env vars.