tag: python

mypy: found module but no type hints or library stubs

0 min read
When linting a Python project, I was puzzled the mysterious "found module but no type hints or library stubs" error from mypy. Mysterious because the module was my own and there were Pydantic definitions everywhere. The cause? I was missing __init__.py files in some parent folders.

Preventing flake8 errors when importing modules in __init__ files

0 min read
When linting a Python project, I was puzzled the mysterious "found module but no type hints or library stubs" error from mypy. Mysterious because the module was my own and there were Pydantic definitions everywhere. The cause? I was missing __init__.py files in some parent folders.
7 min read
I am a big fan of Faker for testing. I find having a random mock data generator keeps tests clean. In fact, I tend to extend Faker with project specific providers. Here's how
45 min read
The python toolchain I use for my small projects doesn't change very often. It makes sense to save it somewhere and the then replicate it whenever I start a project. Or even better, use cookiecutter and a config file to generate it.
8 min read
Thanks to a bug while copying a youtube playlist with a Python script, I ended up with a lot of duplicates videos in the playlist. Surprisingly, the YouTube interface doesn't let you remove them. So I put together another small Python script
28 min read
I wanted to duplicate another user's playlist to one of my free google accounts. But it's no longer possible from the web interface. None of the methods described in various SO answers are functional, they are obsolete. But it can be done with a Python script in your terminal.
2 min read
Prettier autoformatting screws up Django html templates in Visual Studio Code. For example, it puts tags on the same line when they shouldn't be. The fix is pretty simple and involves a couple of different formatting extension.
6 min read
There are many different ways of doing it; my favourite involves using pyenv