Episode #136: A Python kernel rather than cleaning the batteries?
Brought to you by Datadog: pythonbytes.fm/datadog
Brian #1: Voilà!
- “from Jupyter notebooks to standalone applications and dashboards”
- Turn a notebook into a web app with:
- custom widgets
- runnable code (but not editable)
- interactive plots
- different custom grid layouts
Michael #2: Toward a “Kernel Python”
- By Glyph
- Glyph wants to Marie Kondō the standard library (and I think I agree with him)
- We have PEP 594 for removing obviously obsolete and unmaintained detritus from the standard library.
- PEP 594 is great news for Python, and in particular for the maintainers of its standard library, who can now address a reduced surface area.
- Believes the PEP may be approaching the problem from the wrong direction.
- One “dead” battery is the
colorsysmodule: why not remove it? “The module is useful to convert CSS colors between coordinate systems. Today, however, the modules you need to convert colors between coordinate systems are only a
- Every little bit is overhead for the core devs, consider the state of PRs
- Looking at CPython’s keyword-based review queue, we can see that there are 429 tickets currently awaiting review. The oldest PR awaiting review hasn’t been touched since February 2, 2018, which is almost 500 days old.
- By Glyph’s subjective assessment, on this page of 25 PRs, 14 were about the standard library, 10 were about the core language or interpreter code
- We need a “kernel” version of Python that contains only the most absolutely minimal library, so that all implementations can agree on a core baseline that gives you a “python”
- Michael: There will be a cost to beginners. But there is already.
Brian #3: Use __main__.py
- I didn’t know it was that easy to get
python -m [HTML_REMOVED]to work.
Michael #4: The CPython Bytecode Compiler is Dumb
- by Chris Wellons
- Given multiple ways to express the same algorithm or idea, Chris tends to prefer the one that compiles to the more efficient bytecode.
- Fortunately CPython, the main and most widely used implementation of Python, is very transparent about its bytecode. It’s easy to inspect and reason about its bytecode. The disassembly listing is easy to read and understand.
- One fact has become quite apparent: the CPython bytecode compiler is pretty dumb. With a few exceptions, it’s a very literal translation of a Python program, and there is almost no optimization.
- Darius Bacon points out that Guido van Rossum himself said, “Python is about having the simplest, dumbest compiler imaginable.” So this is all very much by design.
- The consensus seems to be that if you want or need better performance, use something other than Python. (And if you can’t do that, at least use PyPy.) ← Cython people, Cython.
def foo(): x = 0 y = 1 return x
Could easily be:
def foo(): return 0
Yet, CPython completely misses this optimization for both x and y:
2 0 LOAD_CONST 1 (0) 2 STORE_FAST 0 (x) 3 4 LOAD_CONST 2 (1) 6 STORE_FAST 1 (y) 4 8 LOAD_FAST 0 (x) 10 RETURN_VALUE
And so on.
- Brett Cannot has expressed performance as a major focus for CPython, maybe there is something here?
Brian #5: You can play with EdgeDB now, maybe
- A Path to a 10x Database
- EdgeDB roadmap
- Alpha 1 is available.
- “EdgeDB is the next generation relational database based on PostgreSQL. It features a novel data model and an advanced query language.”
- I’m excited about what their doing. Looking forward to 1.0.
- Lots of great features listed in the 10x post, but what I’m most intrigued by is their replacement of SQL with a different query language.
- via Waqas Younas
- Worked with a U.S.-based healthcare startup for 7 years. This startup developed a software product that sent appointment reminders to the patients of healthcare facilities; the reminders were sent via email, text, and IVR.
- Paramiko - A Python implementation of SSHv2.
- built-in CSV module
- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper
- Requests - HTTP for Humans™
- BeautifulSoup - Python library for pulling data out of HTML and XML files.
- testscenarios - a pyunit extension for dependency injection
- HL7 - a simple library for parsing messages of Health Level 7 (HL7) version 2.x into Python objects.
- Python-Phonenumbers - Library for parsing, formatting, and validating international phone numbers
- gevent - a coroutine -based Python networking library that uses greenlet to provide a high-level synchronous API on top of the libev or libuv event loop.
- dateutil - powerful extensions to datetime (pip install python-dateutil)
- Matplotlib - a Python 2D plotting library which produces publication quality figures
- python-magic - a python interface to the libmagic file type identification library. libmagic identifies file types by checking their headers according to a predefined list of file types.
- Django - a high-level Python Web framework that encourages rapid development and clean, pragmatic design
- Boto - a Python package that provides interfaces to Amazon Web Services.
- Mailgun Python bindings - helped us send appointment reminders seamlessly
- Twilio’s Python bindings - helped us send appointment reminders seamlessly
Difference between ML & AI? Ans.