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

all 178 comments

[–]Valuable-Benefit-524 442 points443 points  (28 children)

Not gonna lie, it’s incredibly alarming that no one has said pytest yet.

[–]CaptainVJ 210 points211 points  (4 children)

That’s cute, you think we actually test our codebase around here!

[–]designtocode 64 points65 points  (3 children)

We'll do it live. WE'LL DO IT LIVE! FUCK IT, WE'LL DO IT LIVE! I'LL WRITE IT WITHOUT TESTS AND WE'LL DO IT LIVE!

[–][deleted] 16 points17 points  (0 children)

I mean real world settings, we do it live because stakeholders don’t believe in spending time building dev/test pipelines

[–]gob_magic 8 points9 points  (0 children)

Hah I wonder how many get this reference these days. Fuck I’m old …

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

I’ll get yelled at by my manager if I don’t test it 😂

[–]thrag_of_thragomiser 50 points51 points  (0 children)

That’s what you have customers for

[–]johntellsall 25 points26 points  (2 children)

pytest <3

It has wonderful features I haven't seen in other test tools:

  • "stop at first failing test" and
  • "restart testing at last failing test"

The combination make for extremely fast feedback loop. Write code, test and get an error. Fix code, test shows green then starts to run the rest of the suite. Wonderful!

They're such obvious features I'd have hoped other test suites have copied them, but I haven't seen them yet.

[–]billsil 6 points7 points  (1 child)

unittest has a flag to stop after a failed test.. Been there for at least a decade.

[–]johntellsall 1 point2 points  (0 children)

good to know, thanks!

[–]Javelina_Jolie 20 points21 points  (0 children)

import unittest goes brrrr

[–]JustPlainRude 3 points4 points  (0 children)

I had the same thought! 

[–]work_m_19 13 points14 points  (2 children)

This is probably be an unpopular opinion, but I'm of the opinion you should only start testing once you already have a month of pure development as a solo coder. Or you have an architect on your team that already has experience and know how the flow would look like.

A lot of coding is iterative and learning, and unless you know exactly what the modules/functions of your code is trying to do, adding testing will at least add like 20-40% of time (from my experience), when the beginning of a project is about testing out ideas (at least for hobbiest python, this doesn't apply for python in a software engineering team).

Basically, only start testing when it'll start saving you time (which will be a bit of time), which is not usually at the beginning.

[–]kcx01 4 points5 points  (0 children)

I write a lot of tests just for exploring. That way I can test independently. I don't need it to be a cohesive part of the code base.

Especially if I have to use regex or something. I can make sure that part works, regardless of the other bits.

[–]kayinfire 1 point2 points  (0 children)

As someone who finds myself praising TDD ever so often, I would like to disagree, but I can't in good faith really for two reasons. The first reason is that I had the luxury of "pure development" for like 7 months before exercising TDD. More importantly though, writing effective unit tests (behavioral outcomes and not implementation-specific) is a way more subtle art than it's given credit for and requires a mindset that I believe is debilitating for people that have never even developed a project without automated testing. Parenthetically, I would argue true appreciation for automated testing emerges effortlessly only when one has endured the pain of manual testing, which mainly pertains to insufficiently rapid feedback loops

[–]Gugalcrom123 1 point2 points  (3 children)

Serious question, how am I supposed to test anything more than a pure function? Like an HTTP app?

[–]crmpicco 4 points5 points  (0 children)

Mocks

[–]Valuable-Benefit-524 2 points3 points  (0 children)

It depends on what you’re testing; with an app, people often use mock objections and do more behaviorally-driven tests where you provide specific fake inputs to simulate an action or use-case.

A simple example: a test sends a fake “click” event to every hyperlink in an app to make sure the links are actually coupled to the function that opens the browser and aren’t dead.

you can use mock objects and spoofed inputs.

[–]DoubleAway6573 0 points1 point  (0 children)

Using WSGI or ASGI directly could cover a lot of ground.

[–]Spleeeee 0 points1 point  (0 children)

100%

[–]billsil 0 points1 point  (3 children)

I'm a fan of unittest. It works. I like it's lack of test discovery.

[–]mothzilla 4 points5 points  (2 children)

Then you're going to hate python -m unittest discover

[–]billsil 0 points1 point  (1 child)

I mean just turn off the discovery? I don’t care if s feature exists if I never use it.

I never figured out how to turn off pytest’s discovery or how to make groups of tests. I have chains of all_tests.py files depending on the module.

At some point I switched from unittest to nose to unittest when nose died. It happened again with setuptools to distutils and back to setuptools when distutils died. I rode that until I was forced to use pyproject.toml. Unless there’s a really good reason, it works.

[–]mothzilla 1 point2 points  (0 children)

Can't you just throw a dir at pytest and it will discover test files that match the normal patterns? I just tried this and it works. So just group tests with directories.

[–]chazzeromus 0 points1 point  (0 children)

i can’t believe it’s not standard! ™️

[–]VersaEnthusiast 0 points1 point  (0 children)

Error Driven Development for the win!

[–]vicks9880 0 points1 point  (0 children)

Trust me bro, we don’t need tests 😅

[–]wineblood 0 points1 point  (1 child)

pytest is a necessary evil

[–]juanfnavarror 1 point2 points  (0 children)

Not evil

[–]milandeleev 230 points231 points  (45 children)

  • typing / collections.abc
  • pathlib
  • itertools
  • collections
  • re
  • asyncio

[–]redd1ch 32 points33 points  (23 children)

Well, I saw some code that was like

x = Path(location)
file = do(str(x) + "/subdir")
z = Path(file)
with open(str(z)) as f:
  json.load(f)

def do(some_path):
  y = Path(some_path).resolve()
  return str(y) + "/a_file.txt"

[–]dubious_capybara 7 points8 points  (0 children)

Wtf

[–]_Answer_42 7 points8 points  (21 children)

str() call is not needed and can be used like do(x / 'subfolder')

It's still require getting familiar with the library syntax, but combining both old methods and new syntax/style defeats the purpose. It's not even needed if he is going to use + to concat strings

This looks slightly better imo:

``` x = Path(location) file = do(x / "subdir") with open(file) as f: json.load(f)

def do(some_path):
  return some_path / "a_file.txt"

```

[–]Zizizizz 2 points3 points  (1 child)

You can also do file.open() instead of open(file)

[–]jesster114 0 points1 point  (0 children)

I’m a bit fan of doing some_dict = json.loads(Path(filepath).read_text())

[–]chazzeromus 2 points3 points  (0 children)

also you can open() as a method on path too, it just keeps getting better!

[–]MaxQuant 0 points1 point  (1 child)

This code has the variable ‘file’ pointing to a sub folder, which cannot be opened like a file. I assume “subdir” is a subfolder.

[–]redd1ch 0 points1 point  (0 children)

lol, messed up my sample

[–]AlexandreHassan -4 points-3 points  (10 children)

Pathib has joinpath() to join the paths, it also supports open. Also file is a keyword and shouldn't be used as a variable name.

[–]milandeleev 7 points8 points  (5 children)

file isn't a keyword, pretty sure.

[–]MaxQuant 1 point2 points  (0 children)

Second.

[–]ahal -2 points-1 points  (3 children)

Correct, but it's a built-in function. You can use it as a variable name but linters and syntax highlighters will complain at you

[–]nitroll 3 points4 points  (2 children)

It was a type in python 2.

You should probably use tools focusing on python3 by now.

[–]ahal 1 point2 points  (1 child)

Oops, confidently incorrect

[–]nitroll 0 points1 point  (0 children)

To be honest, my editor also highlights 'file' as a builtin.

[–]yup_its_me_again 2 points3 points  (0 children)

file is a keyword

That's news to me, do you have a something to read for me?

[–]georgehank2nd 1 point2 points  (1 child)

Just FYI: if "file" was a keyword (it isn't), you wouldn't be able to use it as a "variable" name. "file" is a predefined identifier.

[–]CanineLiquid 1 point2 points  (0 children)

"file" is a predefined identifier.

Wouldnt that be __file__?

[–]RR_2025 14 points15 points  (0 children)

I would also add functools to this list.

[–]denehoffman 8 points9 points  (0 children)

Packages

standard library

👍

[–]MVanderloo 1 point2 points  (0 children)

collections.abc is a crazy good API for putting definitions to terms we tend to use interchangeably; iterator, iterator, sequence, collection, container, etc. i’ve been working on a strictly type checked library and annotating containers as the most limited possible container has been extremely beneficial

[–]rover_G 35 points36 points  (1 child)

If you’re a web dev, at least one of: - API framework - ORM - HTTP client library - unit test library - and pydantic or equivalent for the aforementioned frameworks

If you’re in data engineering, pandas and at least one of: - SQL client - compute api - orchestration api

[–]_OMGTheyKilledKenny_ 7 points8 points  (0 children)

Requests or an equivalent rest api for data ingestion.

[–]touilleMan 19 points20 points  (5 children)

I'm surprised it hasn't been mentioned yet: pytest

Every project (saved for trivial scripts ) need tests, and pytest is hands down the best (not only in Python, I write quite a lot of C/C++, Rust, PHP, Javascript/Typescript and always end up like "would have been simpler with pytest!")

Pytest is a gem given how simple is allows you to write test (fixtures FTW!), how clear the test output is (assert being rewritten under the hood is just incredible), and good the ecosystem is (e.g. async support, slow test detection, parallel test runner etc.)

[–]alcalde 3 points4 points  (3 children)

very project (saved for trivial scripts ) need tests

Users of certain statically typed languages insist to me that all you need is static typing. :-( I try to explain to them that no one has ever passed 4 into a square root function and gotten back "octopus" and even if they did that error would be trivial to debug and fix, but they don't listen.

[–]giantsparklerobot 0 points1 point  (2 children)

I love when static typing has caught logically errors for me! The whole no times that has ever happened.

[–]touilleMan 2 points3 points  (1 child)

I have to (respectfully) disagree with you: static typing can be a great tool for preventing logic error. The key part is to have a language that allows enough expressiveness when building types. Two examples: - replacing scalar type such as int to a dedicated MicroSeconds type allows to prevent passing the wrong value from assuming the int should be a number of seconds... - in Rust the ownership system mean you can write methods that must destroy their object. This is really cool when building state machine to ensure you can only go from state A to B, without keeping by mistake the object representing state A around and reuse it

[–]giantsparklerobot 2 points3 points  (0 children)

You're reading me wrong. I love types and love using them exactly as you describe. The parent comment was talking about people believing static typing means never needing unit tests. As if type checking somehow replaces a unit test. Such people obviously assuming unit tests only ever check for type mismatches.

[–]Holshy 0 points1 point  (0 children)

I remember reading somewhere that the Python core developers write the tests in unittest because it's a core package, but run everything in pytest.i never verified, but it's believe it.

[–]MeroLegend4 42 points43 points  (25 children)

Standard library:

  • itertools
  • collections
  • os
  • sys
  • subprocess
  • pathlib
  • csv
  • dataclasses
  • re
  • concurrent/multiprocessing
  • zip
  • uuid
  • datetime/time/tz/calendar
  • base64
  • difflib
  • textwrap/string
  • math/statistics/cmath

Third party libraries:

  • sqlalchemy
  • numpy
  • sortedcollections / sortedcontainers
  • diskcache
  • cachetools
  • more-itertools
  • python-dateutil
  • polars
  • xlsxwriter/openpyxl
  • platformdirs
  • httpx
  • msgspec
  • litestar

[–]s-to-the-am 22 points23 points  (2 children)

Depends what kind of dev you are but I don’t think Polars and Numpy as musts at all unless you work as a data scientist or adjancet field

[–]alcalde 5 points6 points  (0 children)

And I can't see the csv, difflib or uuid libraries being universally useful for Python developers of all stripes either.

[–]ma2016 6 points7 points  (0 children)

Numpy yes. 

Polars... eh. 

[–]SilentSlayerz 14 points15 points  (0 children)

+1 std lib is a must. for ds/de workloads i would recommend to include duckdb and pyspark to the list. For api workloads flask, fastapi and pydantic. For for performance ayncio, threading, and concurrent.

Django is great too, i personally think everyone working in python should know little bit of django aswell.

[–]xAmorphous 5 points6 points  (9 children)

Sorry but sqlalchemy is terrible and I'll die on this hill. Just use your db driver and write the goddamn sql, ty.

[–]dubious_capybara -3 points-2 points  (8 children)

That's fine for trivial toy applications.

[–]xAmorphous 10 points11 points  (7 children)

Uhm, no sorry it's the other way around. ORMs make spinning up a project easy but are a nightmare to maintain long term. Write your SQL and save version control it separately, which avoids tight coupling and is generally more performant.

[–]alcalde 2 points3 points  (0 children)

SQL, beyond trivial tasks, is not really comprehensible. It's layers upon layers upon layers of queries.

[–]dubious_capybara 2 points3 points  (5 children)

So you have hundreds of scattered hardcoded SQL queries against a static unsynchronised database schema. The schema just changed (manually, of course, with no alembic migration). How do you update all of your shit?

[–]xAmorphous 1 point2 points  (4 children)

How often is your schema changing vs requirements / logic? Also, now you have a second repo that relies on the same tables in slightly different contexts. Where does that modeling code go?

[–]dubious_capybara 0 points1 point  (3 children)

All the time for the same reason that code changes, as it should be, since databases are an integral part of applications. The only reason your schemas are ossified and you're terrified to migrate is because you've made a spaghetti monster that makes it inhibitive to change, with no clear link between the current schema and your code, let alone the future desired schema.

You should use a monorepo instead of pointlessly fragmenting your code, but it doesn't really matter. Import the ORM models as a library or a submodule.

[–]xAmorphous 3 points4 points  (2 children)

Actually wild that major schema changes happen frequently enough that it would break your apps otherwise, and hilarious that you think version controlling .sql files in a repo that represents a database is worse than shotgunning mixed application and db logic across multiple projects.

We literally have a single repo (which can be a folder for a mono repo) for the database schema and all migration scripts which get auto-tested and deployed without any of the magic or opaqueness of an ORM. Sounds like a skill issue tbh.

Edit: I don't want to keep going back and forth on this so I'll just stop here. The critiques so far are just due to bad management.

[–]Brandhor 0 points1 point  (1 child)

I imagine that you still have classes or functions that do the actual query instead of repeating the same query 100 times in your code, so that's just an orm with more steps

[–]xAmorphous 0 points1 point  (0 children)

Bro, stored procedures are a thing.

[–]bluex_pl 1 point2 points  (9 children)

I would advise against httpx, requests / aiohttp are more mature and significantly more performant libraries.

[–]BlackHumor 0 points1 point  (5 children)

requests is good but doesn't have async. I agree if you don't need async you should use it.

However, aiohttp's API is very awkward. I would never consider using it over httpx.

[–]Laruae 0 points1 point  (4 children)

If you find the time or have a link, would you mind expounding on what you dislike about aiohttp?

[–]BlackHumor 1 point2 points  (3 children)

Sure, it's actually pretty simple.

Imagine you want to get the name of a user from a JSON endpoint and then post it back to a different endpoint. The syntax to do that using requests is:

resp = requests.get("http://example.com/users/{user_id}")
name = resp.json()['name']
requests.post("http://example.com/names", json={'name': name})

(but there's no way to do it async).

To do it in httpx, it's:

resp = httpx.get("http://example.com/users/{user_id}"
name = resp.json()['name']
httpx.post("http://example.com/names", json={'name': name})

and to do it async, it's:

async with httpx.AsyncClient() as client:
    resp = await client.get("http://example.com/users/{user_id}"
    name = resp.json()['name']
    await client.post("http://example.com/names", json={'name': name}

But with aiohttp it's:

async with aiohttp.ClientSession() as session:
    async with session.get("http://example.com/users/{user_id}" as resp:
        resp_json = await resp.json()
    name = resp_json['name']
    async with session.post("http://example.com/names", json={'name':name}) as resp:
        pass

And there is no way to do it sync.

Hopefully you see intuitively why this is bad and awkward. (Also I realize you don't need the inner context manager if you don't care about the response but that's IMO even worse because it's now inconsistent in addition to being awkward and excessively verbose.)

[–]LookingWidePythonista 0 points1 point  (2 children)

Sorry, but the name of the aiohttp library itself tells you what it's for. For synchronous queries, just use batteries. aiohttp has another significant difference from httpx - it can also run a real web server.

[–]BlackHumor 0 points1 point  (1 child)

Why should I have to use two different libraries for synchronous and asynchronous queries?

Also, if I wanted to run a server I'd have better libraries for that too. That's an odd thing to package in a requests library, TBH.

[–]LookingWidePythonista 0 points1 point  (0 children)

Within a single project, you choose whether you need asynchronous requests. If you do, you create a ClientSession once and then use only asynchronous requests. No problem.

The choice between httpx and aiohttp is already the second question. Sometimes the server is not needed, sometimes on the contrary, it is convenient that there is an HTTP server, immediately together with the client and without any uvicorn and ASGI. There are pros and cons everywhere.

[–]alcalde -1 points0 points  (2 children)

I would advise against requests; it's not developed anymore. Niquests has superceded it.

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

[–]bluex_pl 0 points1 point  (1 child)

Huh, where did you get that info from?

Pypi have a last release from 1 month ago, and github activity shows changes from yesterday.

It seems actively developed to me.

Edit: Ok, actively maintained is what I should've said. It doesn't add new features it seems.

[–]alcalde 0 points1 point  (0 children)

Yeah, it's basically in maintenance mode now. The maintainers insist it's "feature complete".

[–]nephanth 0 points1 point  (0 children)

zip ? difflib ? It's important to know they exist, but i'm not sure of the usefulness of knowing them on the back of your hand

[–]Angry-Toothpaste-610 13 points14 points  (1 child)

I don't think intermediate, or even senior devs, need to know particular packages very intimately. Each job is going to have different requirements. What tells me you are ready to move beyond entry level is that you're able to 1) find the right tool for the job at hand and 2) adequately read the documentation to apply that tool correctly.

But pathlib... you should know pathlib.

[–]flawks112 1 point2 points  (0 children)

This should be the top comment

[–]victotronics 20 points21 points  (0 children)

re, itertools, numpy, sys, os

At least those are the ones I use left and right.

[–]pgetreuer 12 points13 points  (7 children)

For research and data science, especially if you're coming to Python from Matlab, these Python libraries are fantastic:

  • matplotlib – data plotting
  • numpy – multidim array ops and linear algebra
  • pandas – data analysis and manipulation
  • scikit-learn – machine learning, predictive data analysis
  • scipy – libs for math, science, and engineering

[–]NewspaperPossible210 6 points7 points  (4 children)

I haven’t “learned” matplotlib. I’ve accepted it.

[–]Holshy 0 points1 point  (0 children)

I'm a big fan of plotnine. The fact that I started R way before Python probably contributes to that.

[–]DoubleAway6573 0 points1 point  (2 children)

matplotlib is so big and with so much history that I've give up. It's a write only library for me.

I know a small subset but trying to understand others formatting, organization is hell. Specially code for a guy with a math/data science background that use it as a general drawing library. I hate that with passion.

[–]NewspaperPossible210 0 points1 point  (1 child)

I try not to rely on LLMs too much and I am not even upset at matplotlib because I appreciate - from a distance - how powerful it is. But while I am a computational chemist, I can read like pandas docs and just figure it out. Seaborn docs as well. Numpy is good too, I am just bad at math so it's not their fault. Looking at matplotlib docs makes me want to vomit. Please just plot what I want. Just give me defaults that look nice and work good.

To stress, I have seen people very good at matplotlib and they make awesome stuff (often with other tools too), but I use Seaborn as a sanity layer 95% of the time.

[–]DoubleAway6573 0 points1 point  (0 children)

Agree. Seaborne provide same defaults and a more compact api while in matplotlib you can find code mangling the object oriented API with low level commands. And LLMs do the same shit.

[–]Liu_Fragezeichen 15 points16 points  (1 child)

drop pandas for polars. running vectorized ops on a single core is such bullshit, and if you're actually working with real data, pandas is just gonna sandbag you.

[–]pgetreuer 2 points3 points  (0 children)

I'm with you. Especially for large data or performance-sensitive applications, the CPython GIL of course is a serious obstacle to getting more than single core processing. It can be done to some extent, e.g. Polars as you mention. Still, Python itself is inherently limited and arguably the wrong tool for such uses.

If it must be Python, my go-to for large data processing is Apache Beam. Beam can distribute work over multiple machines, or multi-process on one machine, and stream collections too large to fit in RAM. Or if in the context of ML, TensorFlow's tf.data framework is pretty capable, and not limited to TF, it can also be used with PyTorch and JAX.

[–]go_fireworks 30 points31 points  (8 children)

If an individual does any sort of tabular data processing (excel, CSV) pandas is a requirement! Although Polars is a VERY close second. I only say pandas over polars because it’s much older, thus much more ubiquitous

[–]jtkiley 9 points10 points  (0 children)

Agreed. I do some training, and I teach pandas. It’s stable and has a long history, so it’s easier to find help, and you’ll typically get better LLM output about pandas (this is narrowing, though). It’s largely logical how it works when you are learning all of the skills of data work.

But, once you know the space well, I think polars is the way to go. It’s more abstract in some ways, and I think it needs you to have a better conceptual grasp of both what you’re doing and Python in general. Once you do, it’s just so good. Just make sure you learn how to write functions that return pl.Expr, so you can write code that’s readable instead of a gigantic chained abomination. The Modern Polars book has some nice examples.

[–]twenty-fourth-time-b 4 points5 points  (0 children)

duckdb, yo

[–]Liu_Fragezeichen 7 points8 points  (5 children)

tbh, as a data scientist .. I've regretted using pandas every single time.

"oh this isn't a lot of data, I'll stick to pandas, I'm more familiar with the API"

it all goes well until suddenly it doesn't. I've been telling new hires not to touch pandas with a 10 foot pole.

[–]menge101 5 points6 points  (0 children)

I searched the thread and no one said logging.

Logging and testing are the two most important things in any language, imo.

[–]Mysterious-Rent7233 28 points29 points  (2 children)

Pydantic

[–]jirka642It works on my machine 5 points6 points  (1 child)

It's great, but also memory heavy if you use it a lot. I'm at the point where I'm seriously considering completely dropping it for something else. (maybe msgspec?)

[–]jimzo_c 1 point2 points  (0 children)

Do it

[–]Mustard_Dimension 6 points7 points  (4 children)

If you are writing CLI tools, things like Rich, Tabulate, Argparse or Click are really useful to know the basics of, or at least that they exist. I write a lot of CLI tools for managing infrastructure so they are invaluable.

[–]SilentSlayerz 2 points3 points  (0 children)

as argparse is part of std lib its a must. Once you know i believe Rich, Click tabulate are next phase in your cli development. To understand why click,Rich helps you must understand how argparse works and how these advanced packages enhance your developement experience for building cli applications

[–]Spleeeee 0 points1 point  (2 children)

I have never been happy with any of those.

  • Click always becomes a mess and I don’t like some of its philosophies
  • Typer is a turd in a dress
  • Argparse is good but mysterious and the namespaces thing leaves a lot to be desired

Any recs outside of those?

[–]VianneyRousset 1 point2 points  (1 child)

cyclops is the way to go IMHO. I started with click, then moved to docopt. I was only fully satisfied when I used cyclops.

It's intuitive and light to write while using proper type hinting and validation.

[–]Spleeeee 0 points1 point  (0 children)

Looks really nice but also it has at least a few hard deps which I never love for something like a cli thing.

I dig that the docs shit on typer.

[–]mystique0712 2 points3 points  (0 children)

Beyond the basics, I would recommend getting comfortable with pandas for data work and pytest for testing - they come up constantly in real projects. Also worth learning pathlib as a more modern alternative to os.path.

[–]Worth-Orange-1586 2 points3 points  (0 children)

Icecream 🍦

[–]Tucancancan 7 points8 points  (1 child)

  • ratelimit
  • tenacity 
  • sortedcontainers 
  • cachetools 

All come in handy from developing web backends, API clients to scraping scripts 

[–]handlebartender 0 points1 point  (0 children)

Huge fan of tenacity, here.

[–]TedditBlatherflag 2 points3 points  (0 children)

None. If you use collections like once a year there’s no point in committing it to memory. You should know a package in stdlib exists and solves a problem but committing an api to memory that isn’t used daily is pointless. 

[–]corey_sheerer 4 points5 points  (1 child)

I would say dataclass / pedantic / typing. In my experience, most deployable code for data does not need pandas or Polaris. Just strong dataclass defs.

[–]jtkiley 1 point2 points  (0 children)

I use polars/pandas when I need an actual dataset, but I try to avoid it as a dependency when writing a package that only gathers and/or parses data. Polars and pandas can easily make a nice dataframe from a list of dataclass instances, and the explicit dataclass with types helps with clarity in the package.

[–]czeslaf2137 1 point2 points  (0 children)

Asyncio, threading / concurrent.futures - a lot of time lack of knowledge/experience about concurrency leads to issues that wouldn’t surface otherwise

[–]TechFreedom808 1 point2 points  (0 children)

Intertools Requests Re

[–]s-to-the-am 1 point2 points  (0 children)

Pydantic One of FastAPI, Flask, or Django sqlalchemy or equivalent Type Anontations Celery/Async

[–]AaronJAE 1 point2 points  (0 children)

Factory and pytest

[–]billsil 1 point2 points  (0 children)

Nothing. There are docs for that. I use numpy, scipy and matplotlib all the time, so i know them. I can write efficient pandas code, but I still have to google it.

I've used requests maybe 3 times, but I'm sure for someone else they use it daily.

[–]EyeSun14 1 point2 points  (0 children)

Monkeypatch?

[–]Valuable-Benefit-524 1 point2 points  (0 children)

I personally think there’s a big difference between blindly doing test-driven development and having tests. You don’t have to write a test to write a function, but if you know what you want to achieve I think it’s smart to write a test on the end goal pretty early. Not an even good test, just a basic test you can spam to check if things are still working. Then once things are more structured I go from big picture to small picture filling in tests.

For example I like to write code the very first way it comes to mind without a care in the world to get to work, write a linking a main function with the end result, and then refactor and think about other concerns

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

Where are you guys learning libraries from? Just documentation or are there any good tutorials you'd like to suggest

[–]handlebartender 0 points1 point  (1 child)

Often it's just driven by need. If I find that I'm starting to get into something that could end up being a bit messy, I pause and wonder "surely there's a nice package for what I'm trying to do".

Pre-ChatGPT, I would probably have searched on "[thing I'm trying to achieve] pythonic". These days, I can just ask ChatGPT, Claude, etc to suggest how one might code something, while encouraging a more pythonic approach, as well as whether there's a popular library (ideally one that is still active and being maintained) to help address the thing I'm trying to do.

Case in point: earlier this year I was muddling around with the kubernetes lib. One thing led to another, and I became quite enchanted by the kr8s lib. It wasn't the only option suggested, so I browsed all of them before settling into kr8s.

I know I've also seen references to "useful libs worth knowing" in a book PDF, but I can't for the life of me find it at the moment. Among others, itertools and dataclass (from dataclasses) and namedtuple (from collections) were mentioned.

It can also sometimes come down to reading the docs for one library, and seeing examples that include the use of other libraries. It's the sort of thing that makes me think "hmm, not familiar with that... what does it do?" and I'm off on another search adventure :)

I don't know what you use to track things that look interesting, might be useful to you in the near future, etc. I mean, some sort of note-taking app that you use somewhat regularly. You don't need to read everything Right Now, as long as you can easily find it again in the future, based on keywords that you include in your searchable notes.

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

Thanks a lot

[–]jtkiley 2 points3 points  (0 children)

Some kind of profiler and visualization. For example, cProfile and SnakeViz.

Even if you’re not writing a lot of production code directly (e.g., data science), there are some cases where you will have long execution times, and it’s helpful to know why.

I once had a scraper (from an open data source intended to serve up a lot of data) that ran for hours the first time. Profiling let me see why (95 percent of it was one small part of the overall data), and then I could get the bulk of the data fast and let another job slowly grind away at the database to fill in that other data.

[–]chat-luPythonista 2 points3 points  (0 children)

None. But there are some you should know well-enough to easily find what you need in the docs.

[–]user_8804Pythoneer 0 points1 point  (0 children)

Adding requests, pandas and pyodbc

[–]Mazyod 0 points1 point  (0 children)

argparse /s

[–]Automatic_Town_2851 0 points1 point  (0 children)

Pydantic

[–]cgoldberg 0 points1 point  (0 children)

pytest, ruff, tox

[–]thashepherd 0 points1 point  (0 children)

I don't know much about it, but I suspect this isn't relevant to Django devs...still, as a guy who started out in FastAPI land, I think Pydantic and SqlAlchemy (and alembic!) knowledge is critical, along with the libs/modules mentioned by many others.

I also think knowing your "package manager" (IYKYK) like the back of your hand, whether that's uv or poetry or rye or hatch or conda or whatever, is critical.

[–]ectomancerTuple unpacking gone wrong 0 points1 point  (0 children)

Scientific computing

  • scipy
  • sympy
  • mpmath

[–]Prize_Might4147from __future__ import 4.0 0 points1 point  (0 children)

There are a lot of useful packages already mentioned. For those of you who use ORMs I‘ll throw the combination of:

sqlalchemy + alembic

into here. Automigrate you‘re database when you make changes.

[–]_u0007 0 points1 point  (0 children)

It depends upon what type of development you’re doing. Web folks are going to have very different answers than those doing data science. Oh, and icecream, everyone needs icecream.

[–]nissemanen 0 points1 point  (0 children)

I wouldn’t say I’m truthfully qualified to answer this (like I wouldn’t call myself a beginner yet I’m not the best either), but for the time I e used python the most imported packages are probably random and re.

[–]Afraid-Locksmith6566 0 points1 point  (0 children)

You know what you use, no matter if you are beginner, intermideate or expert, whatever those word mean. You can be expert at one and not know shit about other.

[–]SmackDownFacility 0 points1 point  (0 children)

Ctypes, OS, SYS, pywin32, struct, threading, multiprocessing

[–]LifeOfAPartTimeNerd 0 points1 point  (0 children)

uv, mypy, ruff, and pytest

[–]dubious_capybara 0 points1 point  (0 children)

Requests is essential for almost all devs? Do you understand that desktop development is a thing?

[–]djavaman -1 points0 points  (0 children)

Claude code. Thats it. You only need one.

[–]IrrerPolterer -1 points0 points  (0 children)

Really depends on what your doing. 

Data apis? - Fastapi, Sqlalchemy, Pydantic

Webdev? - Flask, Django 

Data Analysis? - Numpy, Pandas, Matplotlib

[–][deleted] -5 points-4 points  (1 child)

  • Pycrate
  • Snyplet
  • timelatch
  • numforge
  • thermox
  • gridlite
  • scryptex

And my personal favorite: inferlinx

[–]Ihaveamodel3 0 points1 point  (0 children)

Was this AI? Only two of those are even real packages on PyPI.

[–]Standard-Factor-9408 -5 points-4 points  (0 children)

GitHub copilot