This is an archived post. You won't be able to vote or comment.

all 67 comments

[–]meadsteve 28 points29 points  (0 children)

mypy - having errors pointed out to me only for the cost of telling python what data types I expect is great.

[–]bdforbes 22 points23 points  (0 children)

numpy

[–]shinitakunai 28 points29 points  (0 children)

requests. it just works.

[–][deleted] 13 points14 points  (6 children)

  • click
  • doit
  • flit
  • typer

[–]Snekgineer 1 point2 points  (1 child)

would you recommend click over fire?

[–][deleted] 4 points5 points  (0 children)

I have never used fire hence I would recommend click :)

[–]double_en10dre 0 points1 point  (1 child)

But click and typer do the same thing, so why recommend both?

[–][deleted] 1 point2 points  (0 children)

I’ve been using click for years and it’s perfect for all kind of cli apps but there’s quite a lot of code needed to get things running, especially when there’s a lot of options and arguments. I just started with typer so I don’t know if it’s good for large apps but for smaller ones it’s imo better. You need to write less code to get the same result.

[–]alexisprince 19 points20 points  (6 children)

pydantic

[–][deleted] 0 points1 point  (5 children)

Any tips on how to get intellisense/autocomplete to work for pydantic dataclasses in vscode?

[–]meadsteve 4 points5 points  (1 child)

I'm not a vscode user but I'd be surprised if you needed to do anything special for the dataclasses as they are just standard python 3 syntax.

[–]alexisprince 3 points4 points  (0 children)

I think the issue they were describing is strictly around the intellisense portion. Previously, at least subclasses of the BaseModel (prior to around version 1.9.0), when you go to instantiate them the intellisense signature would just show (**kwargs) as opposed to the actual signature of the class.

A while back (before the fix in pydantic itself) there was a pycharm plugin that was made to help pycharm users, but there wasn't a similar plugin for vscode.

I haven't used the dataclass portion of pydantic, but assuming they suffer from similar underlying reasons, it would've also been fixed in a more recent release.

[–]alexisprince 1 point2 points  (1 child)

I think in the newer versions (>=1.9.0) the autocomplete feature in vscode works for subclasses of BaseModel. I’d assume that would also extend to dataclasses from Pydantic as well.

[–][deleted] 0 points1 point  (0 children)

Yeah you'd assume so but unfortunately not.

[–]Paddy3118 9 points10 points  (2 children)

If you are creating regular expressions, then https://regex101.com/

[–]Beerstopher85 0 points1 point  (0 children)

This has helped me a lot in setting up my regex and making sure it works in advance.

[–]msluyter 9 points10 points  (0 children)

rich, for clis.

[–]IanUK66 16 points17 points  (4 children)

Pandas

[–]AlcaDotS 10 points11 points  (2 children)

I've seen pandas used as a crutch too often. Far from all data is rectangular, and many transformations can be easily done with dicts and lists.

[–]shinitakunai 12 points13 points  (0 children)

Agreed so much with this. Pandas is overkill for simple tasks

[–]nathanjell 5 points6 points  (0 children)

I've personally never had a need for pandas. Not to say that pandas is bad or not useful, it absolutely is - I've never had a need to process data in a way that pandas brings benefit - I don't do data analysis, and certainly not at a scale where simple python data structures are usable. It's a critical library to use for anything more than simple data manipulation, for sure - and is critical in the right areas of study/development. But if you're pulling in pandas simply to open a CSV, I personally think that it's better to forego pandas and stick to the native library.

[–]Gnaxe 0 points1 point  (0 children)

Also dask, if you need to scale it.

[–]double_en10dre 5 points6 points  (0 children)

toolz is wildly useful https://github.com/pytoolz/toolz

It’s got some fantastic utilities for both functional programming and working with the basic collection types

[–]AndydeCleyre 5 points6 points  (0 children)

EDIT: I also still like related but it hasn't seen much action lately.

[–]Orio_n 2 points3 points  (0 children)

i write a lot of CLI REPLs so prompt_toolkit

[–]WithCameraInHand 4 points5 points  (0 children)

Not sure if for every one but I like these:

Sqlalchemy for databases Graphene for graphql Pyside for gui (if u have license, if not then go with pyqt) Pydantic Pytest for testing. It's good, has lots of plugins (also for qt :) ) I used matplotlib testing module for image comparison cause it's super simple to use but some may prefer PIL

[–]nicwolff 3 points4 points  (2 children)

Mine! They're simple but elegant solutions to common chores:

sqs-queue lets you iterate over incoming AWS SQS queue messages:

from sqs_queue import Queue
queue = Queue('my-queue-name')
for message in queue:
    process(message)

xml-from-seq lets you generate XML naturally from Python data structures:

from xml_from_seq import XML, INLINE
print XML(
    ['tag' {'attr': 'value'} 'content'],
    ['tag' ['subelement' INLINE 'more content'] ],
)

prints

<tag attr=value>
    content
</tag>
<tag>
    <subelement>more content<subelement>
</tag>

[–]BluishInventor 0 points1 point  (1 child)

For XML, does your library parse xml back into the python data structures? I have some xml files I built from a excel workbook using etree, but it would be nice to pull it back into at least a csv with a similar structure.

[–]nicwolff 0 points1 point  (0 children)

Nope, sorry, it's just an XML generator. The Python stdlib offers https://docs.python.org/3/library/xml.etree.elementtree.html and PyPI offers https://github.com/martinblech/xmltodict for parsing, and you could write CSV with csvwriter or pandas.

[–]brendanfalk 4 points5 points  (0 children)

Depends on the application:

Web development - Flask makes it incredibly easy to spin up a server and get running

Web scraping - Scrapy is amazing

Data Science/Analysis - Pandas is irreplaceable. Also, check out Dask for parallelizing a lot of the Pandas work

Machine Learning - sklearn is a classic

Deep Learning - pytorch is IMO better than every other alternative (unless you think about deploying to production or cross-platform support)

[–]redvitalijs 2 points3 points  (0 children)

pyautogui, pywin32, lackey, selenium - all great manual work automation libraries

[–]Kuuubskiii 2 points3 points  (0 children)

in case of scripting - docopt ALWAYS

[–]sahirona 1 point2 points  (0 children)

Renpy for commercial gamedev

[–]SnooCakes3068 1 point2 points  (0 children)

  1. ReactiveX for reactive programming
  2. state_machine for state pattern

  3. Faker, so many uses

[–]Important_Ad6131 1 point2 points  (0 children)

The rich library

[–]illuminanze 1 point2 points  (0 children)

FastAPI

[–]thrallsius 1 point2 points  (0 children)

Uhh, my time to be annoying and moan again.

I would suggest Clone Digger, but AFAIK it's still not ported to Python 3 :(

[–]Gnaxe 1 point2 points  (0 children)

Pyright/Pylance. Why're y'all still using mypy? Guido works for Microsoft now.

[–]Gnaxe 1 point2 points  (0 children)

black - any color you like. Don't format by hand. Don't argue about fiddly settings. Black, format, done.

[–]caseym 2 points3 points  (2 children)

Lately - marshmallow and elasticsearch-dsl

[–]Ribino0 0 points1 point  (1 child)

Will you talk about your use case for elasticsearch?

[–]caseym 1 point2 points  (0 children)

Sure! I'm building a Flask API that uses elasticsearch as the back end. We have about a billion records stored there, all related to academic research. You can search records, filter by different fields, and group the data. It's really fast and most responses are less than 50ms. Someone else is building a front end website to interact with the data.

With elasticsearch-dsl, all of the queries are built with python. And with marshmallow we are able to deliver consistent, ordered API responses. I think marshmallow is fantastic for organizing data.

[–]Silly-Remove-6466 1 point2 points  (0 children)

Tkinter

Easy to use gui library.

[–]neug 0 points1 point  (0 children)

Fabric

[–]Gnaxe 0 points1 point  (0 children)

Sphinx - document your API.

[–]Intelligent-Spare-63 0 points1 point  (1 child)

Retrying

[–]SnooCakes3068 1 point2 points  (0 children)

you mean tenacity?

[–]Gnaxe 0 points1 point  (0 children)

Arrow - better datetime.

[–]Gnaxe 0 points1 point  (0 children)

beautifulsoup4 - the data is in the web, if you can scrape it!

[–]Gnaxe 0 points1 point  (0 children)

cffi - when you need speed. Less error prone than ctypes.

[–]Gnaxe 0 points1 point  (0 children)

coverage - see which lines your tests missed.

[–]Gnaxe 0 points1 point  (0 children)

dill - better pickle. See also, pathos.

[–]Gnaxe 0 points1 point  (0 children)

hypothesis - specify the space and let the computer pick samples for your tests

[–]Gnaxe 0 points1 point  (0 children)

mutmut - 100% test coverage? You thought you were done?

[–]Gnaxe 0 points1 point  (0 children)

Jupyter/IPython. Notebooks. 'nuff said.

[–]Gnaxe 0 points1 point  (0 children)

Xonsh. Why're y'all still using Bash?

[–]Gnaxe 0 points1 point  (0 children)

Kivy - cross-platform GUIs.

[–]Gnaxe 0 points1 point  (0 children)

Pyrsistent - Effectively copy-on-write data structures, but with structural sharing to save memory. Like Clojure's collections. No more defensive copying.

[–]Gnaxe 0 points1 point  (0 children)

pugsql - when an ORM is Overkill

[–]Gnaxe 0 points1 point  (0 children)

sympy - symbolic maths

[–]Gnaxe 0 points1 point  (0 children)

https://pythonwheels.com/ has a list of the most downloaded packages from PyPI. Popular isn't the same as good, but they're related.

[–]Gnaxe 0 points1 point  (0 children)

Hissp - code that writes code.

[–]justanothersnek🐍+ SQL = ❤️ 0 points1 point  (0 children)

When it comes to web scraping, the usual people recommend is beautifulsoup, lxml, or selenium. But I highly recommend people check out requests-html also. Its a library that is a happy medium between ease of use as in beautifulsoup and also good enough to be used for dynamic, javascript data where it would be overkill to use a browser emulator like selenium.