#139 f"Yes!" for the f-strings
Python Bytes - Podcast tekijän mukaan Michael Kennedy and Brian Okken - Maanantaisin
Kategoriat:
Sponsored by DigitalOcean: pythonbytes.fm/digitalocean
Special guest: Ines Montani
Brian #1: Simplify Your Python Developer Environment
- Contributed by Nils de Bruin
- “Three tools (pyenv, pipx, pipenv) make for smooth, isolated, reproducible Python developer and production environments.”
- The tools:
- pyenv - install and manage multiple Python versions and flavors
- pipx - install a Python application with it’s own virtual environment for use globally
- pipenv - managing virtual environments, dependencies, on a per project basis
- Brian note: I’m not sold on any of these yet, but honestly haven’t given them a fair shake either, but also didn’t really know how to try them all out. This is a really good write up to get started.
Ines #2: New fast.ai course: A Code-First Introduction to Natural Language Processing
- fast.ai is a really popular, free course for deep learning by Rachel Thomas and Jeremy Howard
- Also comes with a Python library and lots of notebooks
- Some influential research developed alongside the course, e.g. ULMFiT (popular algorithm for NLP tasks like text classification)
- New course on Natural Language Processing:
- Practical introduction to NLP covering both modern neural network approaches and traditional techniques
- Highlights:
- NLP background: topic modeling and linear models
- Rule-based approaches and real-world problem solving
- Focus on ethics – videos on bias and disinformation
Michael #3: Cloning the human voice
- In 5 minutes, with Python
- via Brenden
- Clone a voice in 5 seconds to generate arbitrary speech in real-time
- An implementation of Transfer Learning from Speaker Verification to Multispeaker Text-To-Speech Synthesis (SV2TTS) with a vocoder that works in real-time.
- Watch the video: https://www.youtube.com/watch?v=-O_hYhToKoA
- Also: Fake voices 'help cyber-crooks steal cash’
Brian #4: Ab(using) pyproject.toml and stuffing pytest.ini and mypy.ini content into it
- Contributed by Andrew Spittlemeister
- My first reaction is horror, but this is kinda my thought process with this one
- toml is not ini (but they look close)
- neither pytest nor mypy support storing configuration in pyproject.toml
- they both do support using setup.cfg (but flit and poetry projects don’t use that file, or try not to)
- they both support passing in the config file as a command line argument
- you can be careful and write a pyproject.toml file that is both toml and ini compliant
- drat, this is a reasonable idea, if not a little wacky
- no guarantee that it will keep working
- one thing to note: use quotes for stuff you normally wouldn’t need to in ini file.
Example ini:
[pytest]
addopts = -ra -v
if stuffed in pyproject.toml
[pytest]
addopts = "-ra -v"
to run:
> mypy --config-file pyproject.toml module_name
> pytest -c pyproject.toml
- A platform for reproducing and managing the whole life cycle of machine learning and deep learning applications.
- We talked to lots of research groups and everyone works with just their GPU on desktop. Super slow – you need to wait for results, schedule next job etc.
- Polyaxon is a free open source library built on Kubernetes. Really easy to set up, especially on Google Kubernetes Engine.
- Especially good for hyper-parameter search, where you might not need GPU experiments if you can run lots of experiments in parallel
- Release v0.5 just came today. Big improvements:
- Plugins system
- Local runs, for much easier debugging
- New workflow engine for chaining things together and run experiments with lots of steps
Michael #6: Flynt for f-strings
- A tool to automatically convert old string literal formatting to f-strings
- F-Strings: Not only are they more readable, more concise, and less prone to error than other ways of formatting, but they are also faster!
- Converted over 500 lines / expressions in Talk Python Training and Python Bytes.
- Get started with a pipx install:
pipx install flynt
- Then point it at
- A file:
flynt somefile.py
- A directory (recursively):
flynt ./
- A file:
- Converts code like this:
print(``"``Greetings {}, you have found {:,} items!``"``.format(name, count))
- To code like this:
print(f"Greetings {name}, you have found {count:,} items!")
- Beware of the digit grouping bug.
- Good project to jumping in and contributing to open source
Extras:
- Thanks to André Jaenisch for pointing the existence of ReDoS attacks and a good video explaining them.
Michael:
- Python httptoolkit
- Python Magic’s name via David Martínez
- Flying Fractals (video and code)
- Python 3.7.4 is out
Ines:
- Explosion (?)
- spaCy IRL 2019
- our very first conference held on July 6 in Berlin
- many amazing speakers from research, applied NLP and the community
- all talks were recorded and will be up on our YouTube channel very soon
- FastAPI core developer Sebastián Ramírez is joining our team
- FastAPI was presented by Brian in episode 123 of this podcast
- we’re big fans and have been switching all our APIs over to FastAPI
- we’ll keep supporting the project and will definitely give Sebastián enough time to keep working on it
Joke:
- A programmer walks into a bar and orders 1.38 root beers. The bartender informs her it's a root beer float. She says 'Make it a double!’
- What do you call a developer without a side project?
- Well rested.