refactor pip caching and add cache git integration

Please, recheck this on you side before merging.