#329: Creating very old Python code
Published Thu, Mar 30, 2023,
recorded Thu, Mar 30, 2023
About the show
Sponsored by Microsoft for Startups Founders Hub.
Michael #1: Prefix-cache
- via Brendan Hannigan
- You can set an environment variable or use it as a command line argument and then instead of creating tons of
__pycache__
folders to store your*.pyc
files right next to the source code, it puts them in some specified folder. - Introduced in python 3.8.
Brian #2: NiceGUI
- Suggested by several listeners
- Browser based GUI
- “NiceGUI is an easy-to-use, Python-based UI framework, which shows up in your web browser. You can create buttons, dialogs, Markdown, 3D scenes, plots and much more. It is great for micro web apps, dashboards, robotics projects, smart home solutions and similar use cases. You can also use it in development, for example when tweaking/configuring a machine learning algorithm or tuning motor controllers.” - from the README
Michael #3: flask-ngrok
- A simple way to demo Flask apps from your machine.
- Makes your Flask apps running on localhost available over the internet via ngrok.
- Great for testing API consumers too.
app = Flask(__name__) run_with_ngrok(app) # Start ngrok when app is run # Endpoints ... if __name__ == '__main__': app.run()
Brian #4: No-async async with Python
- Will McGugan
- Allowing async while not requiring async
- Await me (maybe)
- borrowed from Simon Willison’s The “await me maybe” pattern for Python asyncio
- Optionally awaitable
- Providing API methods that can be called by both async and non-async code.
- The called method really is async, but if a caller doesn’t want to know when the code is done, it can ignore the return value and not await.
- MK: I had to solve a similar problem in fastapi-chameleon
- MK: Syncify async functions.
Extras:
Brian:
Jokes:
- Long-lived software
- Mysteries make life more interesting
- last paragraph, discussing the
cov
fixture ofpytest-cov
- last paragraph, discussing the