[D] What is some cool python magic(s) that you've learned over the years?

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
  • ubelt

    A Python utility library with a stdlib like feel and extra batteries. Paths, Progress, Dicts, Downloads, Caching, Hashing: ubelt makes it easy!

  • My ubelt library https://github.com/Erotemic/ubelt contains a collection of pure Python tools I've written over the years that I found to be highly reusable. The code and docs highlight a lot of what I've learned about Python in the last decade, and also where I think current stdlib features fall a bit short and they could use some extra batteries.

  • bython

    Python with braces. Because python is awesome, but whitespace is awful.

  • And then of course there's this insanity.

  • 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
  • mypy

    Optional static typing for Python

  • Typehints + mypy

  • black

    The uncompromising Python code formatter

  • Black for code formatting.

  • mkinit

    Auto-generate explicit readable __init__.py files without `import *`

  • One thing that can help with making such a package is the mkinit package, which is what I use in ubelt to autogenerate code that explicitly exposes the entire public API at the top-level (although you can specify subsets of what to expose).

  • utool

    Useful Utility Tools For You!

  • Also be careful not to put the kitchen sink in it, that's what happened with my first attempt at such a module. Try to avoid bringing in any non pure-python package. It's important to keep the dependency footprint small so its easy to include your utilities in larger projects. For tools dealing with specific bigger packages (e.g. numpy, opencv), either make a standalone utility for that package or perhaps you could incorporate it into the main package as an optional dependency. Just be careful of accumulating too much import-time cost.

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