#212 SQLite as a file format (like docx)

Python Bytes - A podcast by Michael Kennedy and Brian Okken - Lunedì

Categorie:

Catch the video edition live stream on YouTube: youtube.com/watch?v=oKgAsjiJqMs Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast Patreon Supporters Special guest: Shari Eskenas Be part of the episode by subscribing and “smashing that bell” over at pythonbytes.fm/youtube Brian #1: pytest 6.2 is out pytester fixture for plugin testing. Like testdir, but a better name, and uses pathlib.Path objects. verbose mode now shows the reason a test was skipped in the terminal line after the SKIPPED, XFAIL, or XPASS Can use monkeypatch as a context manager with .context() and it’s available both in test and fixture functions, but also in helper functions by using pytest.Monkeypatch.context(). import os from contextlib import contextmanager import pytest def test_foo_1(monkeypatch): with monkeypatch.context() as mp: mp.setenv("foo", "bar") assert os.getenv("foo") == "bar" @contextmanager def some_func(): with pytest.MonkeyPatch.context() as mp: mp.setenv("foo", "bar") yield def test_foo_2(): with some_func(): assert os.getenv("foo") == "bar" Lots of other goodies. related: pytest-check, my only released plugin for pytest, was updated to support pytest 6.x Michael #2: SQLite as a file format (like docx) via Jon Bultmeyer An SQLite database file with a defined schema often makes an excellent application file format. Here are a dozen reasons why this is so: Simplified Application Development. No new code is needed for reading or writing the application file. Single-File Documents. An SQLite database is contained in a single file, which is easily copied or moved or attached. High-Level Query Language. SQLite is a complete relational database engine, which means that the application can access content using high-level queries. Accessible Content. Information held in an SQLite database file is accessible using commonly available open-source command-line tools - tools that are installed by default on Mac and Linux systems and that are freely available as a self-contained EXE file on Windows. Cross-Platform. SQLite database files are portable between 32-bit and 64-bit machines and between big-endian and little-endian architectures and between any of the various flavors of Windows and Unix-like operating systems. Atomic Transactions. Writes to an SQLite database are atomic. They either happen completely or not at all, even during system crashes or power failures. Incremental And Continuous Updates. When writing to an SQLite database file, only those parts of the file that actually change are written out to disk. This makes the writing happen faster and saves wear on SSDs. Easily Extensible. As an application grows, new features can be added to an SQLite application file format simply by adding new tables to the schema or by adding new columns to existing tables. Adding columns or tables does not change the meaning of prior queries. Performance. In many cases, an SQLite application file format will be faster than a pile-of-files format or a custom format. Concurrent Use By Multiple Processes. SQLite automatically coordinates concurrent access to the same document from multiple threads and/or processes. Multiple Programming Languages. Though SQLite is itself written in ANSI-C, interfaces exist for just about every other programming language you can think of. Better Applications. If the application file format is an SQLite database, the complete documentation for that file format consists of the database schema, with perhaps a few extra words about what each table and column represents. Shari #3: A Day in Code: Python – A picture book written in code Brian #4: PythonLabs is now hosted by Azure. and “Yes, Barry, there is a PythonLabs” I can’t believe we haven’t covered this in the last 211 episodes. But it seems like good timing now. Now resides at azure.pythonlabs.com By Tim Peters (originally posted on January 6th, 2004 to the PSF members list) Barry (I’m assuming Barry Warsaw) asked the question: “… what /is/ Pythonlabs now? Or /is/ there a Pythonlabs now? I dunno -- Guido owns the domain name which is probably the biggest claim to Pythonlabhood there is.” Tim replies with a very “Yes, Virginia, there is a Santa Clause”-esque answer: Snippets include: Barry, your little friends are wrong. They have been affected by the skepticism of a skeptical age. … Yes, Barry, there is a PythonLabs. It exists as certainly as love and generosity and devotion exist, … Alas! how dreary would be the world if there were no PythonLabs! It would be as dreary as if there were no Barrys. … Not believe in PythonLabs! You might as well not believe in fairies. … Nobody sees PythonLabs, but that is no sign that there is no PythonLabs. … A thousand years from now, Barry, nay 10 times 10,000 years from now, it will continue to make glad the heart of childhood. Michael #5: Extra, extra, extra, extra, extra, extra, hear all about it #1 Numpy version pinning via Grice Just catching up on Ep 208. Note in part 2 about the Numpy issue, folks can pin versions by platform with environment markers: numpy==1.19.3; platform_system == 'Windows' numpy==1.19.4; platform_system == 'Linux' #2 Stylesheet for PySide2 and PyQt5, this time looks like Material Design - via William Jamir Silva #3 Talk Python hits 20M downloads. Python Bytes is almost 6M too. #4 Pyramid 2.0 is coming. #5 Python 3.9.1 is out with 282 changes. Ships as a universal binary (Intel + M1) on macOS. #6 Python + Mac Mini + M1 video #7 Python Steering Council selected Shari #6: OpenMV Extras Brian: agrs, kwargs (quargs), and community a silly discussion on twitter Nocole Carlson: “Huge debate … about whether you say “quargs” or “keyword arguments” for “kwargs”. Obviously “quargs” is correct.” It never occurred to me to say “quargs”, but I like it. Vicki Boykis replied that she’s “… never said anything but “quargs”. This is like a parallel universe.” Some other amusing responses. This reminded me of a conversation I might have over beer at PyCon. or at a booth, or just standing around in the hallway. I miss so much the in person community. I’m grateful that little bits of it are intact on twitter. Joke: Pizza delivery fail Second joke: Why do you many developers use dark mode? Because bugs are attracted to light.

Visit the podcast's native language site