#45: A really small web API and OS-level machine learning
Published Fri, Sep 29, 2017, recorded Wed, Sep 27, 2017
This episode is brought to you by Rollbar: pythonbytes.fm/rollbar
Brian #1: pico
- "a very small web application framework for Python"
- Recommended by Ivan Pejić
- lightning talk from EuroPython 2017
- This would be a good web framework for building internal services and tools that non-web developers need to interact with and modify.
- Very simple.
- Not REST, but not confusing either.
- September 26th macOS High Sierra was released (yay)
- Mostly a foundational release with barely visible changes but awesome things like APFS replacing HFS+, etc.
- Comes with CoreML
- Apple’s intent with the new CoreML framework is to package up prebuilt ML models and execution engines and make them possible for third-party apps to use.
- Developers can take a trained machine learning algorithm, package it up as an MLModel, and integrate it into their apps.
- Apple offers a few default machine learning models that developers can download and use too
- Rather than sharing your data with a central server, grouping it together with a lot of other people's data, and improving machine learning models that way, Apple stresses that everything CoreML does is happening on the device.
- On Macs that support Metal—generally, Macs from 2012 and later—CoreML uses a mix of CPU processing and GPGPU processing, depending on the task.
- Add on the fact that High Sierra has external GPU support now and you have a sweet combo.
Brian #3: A guide to logging in Python
- Simply put, the best logging introduction I've read so far.
Michael #4: Let me introduce: slots
- So what are slots? __slots__ are a different way to define the attributes storage for classes in Python.
- for normal Python classes, a dict is used to store the instance's attributes.
__slots__we don't have an attribute called
__dict__inside our instance. But we have a new attribute called
- But why would you need to use slots when you have a dict? Well the answer is that __slots__ are a lot lighter and slightly faster.
- ~57% less memory usage thanks to just one line of code.
- __slots__ are also slightly faster.
- Covered in depth in my Write Pythonic Code Like a Seasoned Developer course.
Brian #5: pipenv revisited
- Covered in episode 11. However, there are some notable changes since then.
pepenvhandles virtualenv and pip interaction for you
pipenv installcreates a virtualenv (if one doesn't exist) and installs stuff into a virtualenv.
pipenv shelluses the virtualenv
exitallows you to get out of the virtualenv
pipenv lock -rwill generate a requirements.txt file for you, so you can use it even if you need a requirements.txt file.
- Notable changes:
- New 4 minute screencast with Kenneth demonstrating how to use it. Watching him use it makes it very simple to understand.
- Specify multiple package indexes, and even specify a particular index for particular packages. So you can combine both pypi with a company index and a group index and maybe one for your project.
- pipenv check will tell you about any known security vulnerabilities in your installed packages
- 9 months old with 192 releases, so keep an eye on it for new features all the time.
- Tabs and spaces aren't the only things that influence developer pay…
- Some of the broad trends are no big surprise; for example, the chosen cities tend to pay more than their respective nations do, for example.
- DevOps specialists and data scientists both earn well.
- Other aspects of the data are a little more surprising. Graphics programmers, for example, aren't particularly well paid, in spite of having a relatively specialized, complex niche.
- And while earnings in four of the countries are surprisingly similar, those in America are substantially higher, regardless of experience; in fact, the median salary of a developer in the US is comparable to that of someone with 20 years of experience in Canada or Germany and markedly higher than 20-year veterans in France and the UK. Even after taking into account the US' higher healthcare costs, America is the place to be if you're a programmer.
- I do have to wonder how much Silicon Valley skews that salary chart, as the Web 2.0 companies pay HUGE comparatively [ref]
- I asked Stack Overflow's data scientist that question, and she said not much; even without its outlier cities, the US pays much more than the rest of the world. [ref]
- Healthcare cost are only part of it. I got paid about $600/month 9 months a year by my government to study in university. [ref]
- I feel like a lot of IT people lack soft skills, and it caps their salary at a lower end. [ref]