Refactoring python environment