HACKER Q&A
📣 networked

What lesser-known Python libraries do you wish people knew about?


What lesser-known Python libraries do you wish people knew about?


  👤 lozenge Accepted Answer ✓
q for debugging where you can't set a breakpoint (eg there's a timeout)

Or print debugging where you can't print (eg you're in a pipeline) https://pypi.org/project/q/

Portion - represent intervals. Use this to describe tax bands, calendar appointments, etc. https://pypi.org/project/portion/


👤 asicsp
https://github.com/WyattBlue/auto-editor - command line application for automatically editing video and audio by analyzing a variety of methods, most notably audio loudness

https://github.com/pycompiled/compiled - compiled variants of the Python standard library


👤 xqb64
I really like:

trio: https://trio.readthedocs.io/en/stable/index.html

and a couple of trio-compatible libraries that blend with it nicely:

tractor: https://github.com/goodboy/tractor

trio-parallel: https://trio-parallel.readthedocs.io/en/latest/


👤 wanderingmind
Most people using python for prediction are interested in accuracy and typically use sklearn or NeuralNetwork libraries (TensorFlow, PyTorch). However if you are interested in understanding the data and doing linear models,`statsmodels` is an excellent library. It has a learning curve to interpret results, but that's really something people must use to understand and get a deeper insight into data

👤 jayfk
I can't recommend django-ninja enough. It's an easy to use, extremely fast, typed API for django. I've found it to be better in almost all aspects when compared to djangorestframework.

It's gaining popularity but is still widely unknown.

https://github.com/vitalik/django-ninja


👤 ishandotpage
https://pypi.org/project/dirtyjson/

Using this one a lot nowadays. It's great for getting embedded JSON out of things which are not very consistent.

Extremely useful for extracting JSON from LLM responses, also great for general purpose data munging.

https://dataset.readthedocs.io/en/latest/

Used to love this one when I didn't know SQL: It's kind of like RedbeanPHP, but in Python, and lets you do stuff like this (from link) :

import dataset

db = dataset.connect('sqlite:///:memory:')

table = db['my_table']

table.insert(dict(name='John Doe', age=37))

table.insert(dict(name='Jane Doe', age=34, gender='female'))

john = table.find_one(name='John Doe')


👤 mattbillenstein
Perhaps Mako - everything uses Jinja2, but you have to essentially learn a limited DSL when you could just be using Python in templates.

👤 pizza
- optree

- symbex

- polars

- python-lenses

- nbdev


👤 Phoenix12052023
Sympy. Great alternative to Mathematica.

👤 antman
helium, hrequests (for web crawling)

scalene profiler

pipgrep

pycallflow

rich

ducks,polars,duckdb

transitions for fsm

dash,perspective

smart_open,fsutil,platformdirs

environs

diskcache

datasketch,setsimilaritysearch,more_itertools

act (local github actions)

verbex (for regexp)

keyring

ftfy,chardet,unidecode

ulid,cyksuid

watchdog

dradonfly

tenacity

lox,parsl,dask,ray

delegator

huey