5 tips to learn any new Python library faster

By on 19 April 2023

This was a Pybites email first. To always get the latest and greatest content, subscribe here.

Lately I have been learning some new libraries for weekly PDM Code Clinic demo sessions (e.g. PyScript, Flet, PySimpleGUI, Playwright, htmx, Redis, Leaflet, etc.)

There is a general approach I take that makes this less painful and more fun.

Of course having done development for quite a while makes things easier, but even after years of experience this craft does not come easy per se.

The following tips are still generic enough that they help developers of all levels.

Let’s also time the steps to have Parkinson’s law kick in (“the old adage that work expands to fill the time allotted for its completion.“)

1. Quickly read the main docs (15-20 minutes)

I mean any decently sized project should not only have docs, but also some sections to quickly familiarize yourself with the library.

Do realize that you can only keep so many things in your head at once and a lot might not make sense yet (aka cognitive overload), so don’t spend too much time here.

Update April 2023: since this piece appeared as an email, we increasingly use ChatGpt (prompt engineering) as a more efficient way than Google + docs to play with external libraries and code.

2. Install the library (ideally minutes)

This should be pretty straight forward if the library is packaged on PyPI: create a virtual environment and pip install it. If this does not work for some reason, you might get into a lot of trouble, but that might be valuable learning in and of itself.

3. Explore the library (30 minutes)

I highly recommend using a Jupyter notebook to have a way to interactively play with the library (better for history / persistence than the plain REPL).

This is a safe place where you can go wild. Experiment with common functions and see how the library behaves. You can also easily access the docs and inspect the objects with help() or dir() respectively.

4. Make your use more deliberate (10-15 minutes)

We generally don’t learn new libraries for the sake of learning them.

It is only a valuable use of your time if you can apply it to a real world need or problem. So after the more theoretical (yet still practical) steps 1-3, it’s time to link this library to the reason you’re actually learning it. This usually boils down to setting a specific goal on what to build with it.

5. Build something (2-3 hours)

This is where you get the best bang for your buck!

This forces you to not only grasp the library at a deeper level, but make it work for a particular need and this changes everything.

It forces you to conceptually understand it. You’ll get relatively quickly which is exactly the point (“oh this does not work in this scenario”, “why is this not working on my machine as opposed to the docs claiming it would?”, “it breaks with Python version x.y”, etc. – don’t shy away from this, it’s where the most and best learning happens!)

It’s here where you really will leverage the library’s documentation, but also your extended debugging knowledge to try to get unstuck.

6. Bonus: teach it (1-2 hours)

Now you hopefully have something cool running using the library, which solidified your understanding, at least a bit.

Plus you have something to show for your time which is a nice bonus because that can be the root of more content (we’re all thinking about not only building, but also promoting it I hope? …)

But there is one more step. You will still have gaps, or you might think you know some parts but you really don’t (aka Dunning–Kruger Effect).

The best way to face that reality is to teach it to somebody else. You don’t have to do live coding (although that is the most engaging), you can also pre-record a video or just write a blog post about it.

We’ve done this from the start, check out first 100 Days of Code repo, our collection of articles, and more recently activity on our YouTube channel.

This will force you to rethink what you just learned, nothing like having to explain it to somebody else, it requires so much more understanding! And expect people to be curious and ask some really good questions which again will challenge your thinking about the tech at hand.


So there you go, some tips to effectively learn a new library, Python or anything really, this is pretty generic stuff.

I hope this helps you to not stay stuck in tutorial paralysis and build more because it’s where you can learn to embrace imposter syndrome (no, it never goes away!)

– Bob

Feel free to reach out to me on our Slack – I am @pybob there and I am happy to hear if this helped you or what’s still holding you back.

Want a career as a Python Developer but not sure where to start?