Python Bytes is a weekly podcast hosted by Michael Kennedy and Brian Okken. The show is a short discussion on the headlines and noteworthy news in the Python, developer, and data science space.

#289 Textinator is coming for your text, wherever it is

June 21, 2022 00:46:14 38.96 MB Downloads: 0

Watch the live stream:

Watch on YouTube

About the show

Sponsored by us! Support our work through:

Special guest: Gina Häußge, creator & maintainer of OctoPrint

Michael #1: beanita

  • Local MongoDB-like database prepared to work with Beanie ODM
  • So, you know Beanie - Pydantic + async + MongoDB
  • And you know Mongita - Mongita is to MongoDB as SQLite is to SQL
  • Beanita lets you use Beanie, but against Mongita rather than a server-based MongoDB server

Brian #2: The Good Research Code Handbook

  • Patrick J Mineault
  • “for grad students, postdocs and PIs (principle investigator) who do a lot of programming as part of their research.”
  • lessons
    • setup
      • git, virtual environments, project layout, packaging, cookie cutter
    • style
      • style guides, keeping things clean
    • coding
      • separating concerns, separating pure functions and those with side effects, pythonic-ness
    • testing
      • unit testing, testing with side effects, …
      • (incorrect definition of end-to-end tests, but a good job at covering the other bits)
    • documentation
      • comments, tests, docstrings, README.md, usage docs, tutorials, websites
      • documenting pipelines and projects
    • social aspects
      • various reviews, pairing, open source, community
    • sample project
    • extras
      • testing example
      • good tools to use

Gina #3: CadQuery

  • Python lib to do build parametric 3D CAD models
  • Can output STL, STEP, AMF, SVG and some more
  • Uses same geometry kernel as FreeCAD (OpenCascade)
  • Also available: desktop editor, Jupyter extension, CLI
    • Would recommend the Jupyter extension, the app seems a bit behind latest development
  • Jupyter extension is easy to set up on Docker and comes with a nice 3D preview pane
  • Was able to create a basic parametric design of an insert for an assortment box easily
  • Python 3.8+, not yet 3.11, OpenCascade related

Michael #4: Textinator

  • Like TextSniper, but in Python
  • Simple MacOS StatusBar / Menu Bar app to automatically detect text in screenshots
  • Built with RUMPS: Ridiculously Uncomplicated macOS Python Statusbar apps
  • Take a screenshot of a region of the screen using ⌘ + ⇧ + 4 (Cmd + Shift + 4).
  • The app will automatically detect any text in the screenshot and copy it to your clipboard.
  • How Textinator Works

Brian #5: Handling Concurrency Without Locks

  • "How to not let concurrency cripple your system”
  • Haki Benita
  • “…common concurrency challenges and how to overcome them with minimal locking.”
  • Starts with a Django web app
  • A url shortener that generates a unique short url and stores the result in a database so it doesn’t get re-used.
  • Discussions of
    • collision with two users checking, then storing keys at the same time.
    • locking problems in general
    • utilizing database ability to make sure some items are unique, in this case PostgreSQL
    • updating your code to take advantage of database constraints support to allow you to do less locking within your code

Gina #6: TatSu

  • Generates parsers from EBNF grammars (or ANTLR)
  • Can compile the model (similar to regex) for quick reuse or generate python source
  • Many examples provided
  • Active development, Python 3.10+

Extras

Michael:

  • Back on 285 we spoke about PEP 690. Now there is a proper blog post about it.
  • Expedited release of Python3.11.0b3 - Due to a known incompatibility with pytest and the previous beta release (Python 3.11.0b2) and after some deliberation, Python release team have decided to do an expedited release of Python 3.11.0b3 so the community can continue testing their packages with pytest and therefore testing the betas as expected. (via Python Weekly)
  • Kagi search
    • via Daniel Hjertholm
    • Not really python related, but if I know Michael right, he'll love the new completely ad free and privacy-respecting search engine kagi.com. I've used kagi.com since their public beta launched, mainly to search for solutions to Python issues at work. The results are way better than DuckDuckGo's results, and even better than Googles! Love the Programming-lens and the ability to up/down prioritize domains in the results.
    • Their FAQ explains everything you need to know: https://kagi.com/faq
    • Looks great but not sure about the pricing justification (32 sec of compute = $1), that’s either 837x more than all of Talk Python + Python Bytes or more than 6,700x more than just one of our sites/services. (We spend about $100/mo on 8 servers.) But they may be buying results from Google and Bing, and that could be the cost.
    • Here's a short interview with the man who started kagi.

Gina:

  • rdserialtool: Reads out low-cost USB power monitors (UM24C, UM25C, UM34C) via BLE/pybluez. Amazing if you need to monitor the power consumption/voltage/current of some embedded electronics on a budget. Helped me solve a very much OctoPrint development specific problem. Python 3.4+
  • nodejs-bin:
    • by Sam Willis: https://twitter.com/samwillis/status/1537787836119793667
    • Install nodejs via pypi/as dependency, still very much an Alpha but looks promising
    • Makes it easier to obtain a full stack environment
    • Very interesting for end to end testing with JS based tooling, or packaging a frontend with your Python app
    • See also nodeenv, which does a similar thing, but with additional steps

Joke: Rejected Github Badges