Creating a Python CLI with Go(lang)-comparable startup times

This page summarizes the projects mentioned and recommended in the original post on /r/Python

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • gefyra

    Blazingly-fast :rocket:, rock-solid, local application development :arrow_right: with Kubernetes.

  • Background: I started a new project called Gefyra, a tool for local application development directly with Kubernetes. Check it out the website https://gefyra.dev or have a glance at the code https://github.com/gefyrahq/gefyra/tree/main/client

  • Nuitka

    Nuitka is a Python compiler written in Python. It's fully compatible with Python 2.6, 2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, and 3.11. You feed it your Python app, it does a lot of clever things, and spits out an executable or extension module.

  • Nuitka: https://nuitka.net/

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • Docker Compose

    Define and run multi-container applications with Docker

  • On MacOS I faced startup times of more than 10 s with internet connection and about 3 s without internet connection. Interestingly, the former docker-compose command was also created from PyInstaller and Mac users complained about the startup performance, too: https://github.com/docker/compose/issues/6956 :)

  • tuna

    :fish: Python profile viewer

  • I started to examine the output of python -X importtime -m gefyra 2> import.log just to check the imports. There is an awesome tool to analyze the Python imports: tuna (see: https://github.com/nschloe/tuna). tuna allows analyzing the import times from the log. Run it like so tuna import.log. It opens a browser window and visualizes the import times. With that I was able to manually move all imports to the functions in which they are needed (and bring in some other optimizations). This greatly violates PEP 8 (https://peps.python.org/pep-0008/#imports) but leads to very fast startup times.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts