Is there any framework or method that will allow to use browser to run a 2D game made in python with pygame graphical library?
Since mid-2022, pygame has partial support for WebAssembly as upcoming python3.11 and allows for running the same pygame code on desktops and mobile/web.
You can publish your game on itch.io or github pages as some people have already done.
use pygbag from https://pypi.org/project/pygbag , some documentation is available from pygame-web.github.io
read documentation to adjust your main loop for async, and then use
python3 -m pygbag game_folder_with_all_extra_modules_and_assets/main.py
use replit https://replit.com/~. if you want to make your own website with your game iframe a replit in html