Search

Home > Python Bytes > #257 Python Launcher - Launching Python Everywhere
Podcast: Python Bytes
Episode:

#257 Python Launcher - Launching Python Everywhere

Category: Technology
Duration: 00:40:25
Publish Date: 2021-11-04 08:00:00
Description:

Watch the live stream:

Watch on YouTube

About the show

Sponsored by Shortcut

Special guest: Morleh So-kargbo

Michael #1: Django 4.0 beta 1 released

  • Django 4.0 beta 1 is now available.
  • Django 4.0 has an abundance of new features
    • The new *expressions positional argument of UniqueConstraint() enables creating functional unique constraints on expressions and database functions.
    • The new scrypt password hasher is more secure and recommended over PBKDF2.
    • The new django.core.cache.backends.redis.RedisCache cache backend provides built-in support for caching with Redis.
    • To enhance customization of Forms, Formsets, and ErrorList they are now rendered using the template engine.

Brian #2: py - The Python launcher

  • py has been bundled with Python for Windows only since Python 3.3, as py.exe
    • See Python Launcher for Windows
    • I’ve mostly ignored it since I use Python on Windows, MacOS, and Linux and don’t want to have different workflows on different systems.
  • But now Brett Cannon has developed python-launcher which brings py to MacOS and various other Unix-y systems or any OS which supports Rust.
  • Now
    • py is everywhere I need it to be, and I’ve switched my workflow to use it.
  • Usage
    • py : Run the latest Python version on your system
    • py -3 : Run the latest Python 3 version
    • py -3.9 : Run latest 3.9 version
    • py -2.7 : Even run 2.x versions
    • py --``list : list all versions (with py-launcher, it also lists paths)
    • py --``list-paths : py.exe only - list all versions with path
  • Why is this cool? - I never have to care where Python is installed or where it is in my search path. - I can always run any version of Python installed without setting up symbolic links. - Same workflow works on Windows, MacOS, and Linux
    • Old workfow
      • Make sure latest Python is found first in search path, then call python3 -m venv venv
      • For a specific version, make sure python3.8, for example, or python38 or something is in my Path. If not, create it somewhere.
    • New workflow.
      • py -m venv venv - Create a virtual environment with the latest Python installed.
      • After activation, everything happens in the virtual env.
    • Create a specific venv to test something on an older version:
      • py -3.8 venv venv --``prompt '``3.8``'
    • Or even just run a script with an old version
      • py -3.8 script_name.py
    • Of course, you can run it with the latest version also
      • py script_name.py
  • Note: if you use py within a virtual environment, the default version is the one from the virtual env, not the latest.

Morleh #3: Transformers As General-Purpose Architecture

Total Play: 0

Some more Podcasts by Michael Kennedy

500+ Episodes
Talk Python .. 300+     50+