irthomasthomas / undecidability

13 stars 2 forks source link

lesser-known Python libraries | Hacker News #860

Open ShellLM opened 3 months ago

ShellLM commented 3 months ago

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

Snippet: "What lesser-known Python libraries do you wish people knew about?" The suggestions there are worth looking up. Don't miss DiskCache.

I really like xmltodict. Despite the name, it works in both directions. It is the most ergonomic library I have used for creating XML. It has external type stubs: https://pypi.org/project/types-xmltodict/.

Since you have recently discovered Rich, you may want rich-argparse. It colorizes argparse CLIs with little effort from the user.

DeepDiff has helped me with testing. I needed to compare two nested data structures but ignore any differences in floats (timestamps). DeepDiff let me do it:

diff = DeepDiff(
   run_session(config), run_session(config, force=True), exclude_types=(float,)
)

assert not diff

pzp is like fzf in pure Python to use in your programs. Keep in mind it is currently version 0.0.x. I have found bugs, but I think it is just cool that it exists.

Suggested labels

None

ShellLM commented 3 months ago

Related content

808 similarity score: 0.87

734 similarity score: 0.86

762 similarity score: 0.86

743 similarity score: 0.85

678 similarity score: 0.85

386 similarity score: 0.85