There has been a massive malware push with repos from PyPi..
https://www.theregister.co.uk/2018/11/26/npm_repo_bitcoin_stealer/
And strictly speaking, this problem exists with all software distribution, not just npm or pypi packages Unless you audit the source code and compile it yourself, there's no way to be 100% certain the code isn't compromised in some way, even if the binaries/packages themselves are signed. You can compile Linux from scratch if you want, but it takes a while: http://www.linuxfromscratch.org/ (oh and some hardware these days requires binary firmware blobs without any source code, such as wireless drivers)