Here's a somewhat simplified way to setup python-mode/python-ts-mode with eglot with automatic venv discovery not using emacs pet-mode, pyenv, pyvenv, etc. and does not require a specific version of eglot. It utilizes emacs built-in project package. If need projectile instead, let me know.
(use-package python
:hook (python-base-mode . my/python-shared-hook-load)
:config
(defun my/get-python-venv (&optional dir)