cd

This module provides a convenient context manager

class cd.cd(new_path)[source]

Context manager for changing the current working directory. Author: Brian Hunt on Stack Overflow. https://stackoverflow.com/questions/431684/how-do-i-change-directory-cd-in-python/13197763#13197763

>>> import os
>>> from pathlib import Path
>>> import subprocess
>>> from pyfeasst import cd
>>> code = subprocess.call("mkdir -p tmp", shell=True, executable='/bin/bash')
>>> with cd.cd("tmp"): print(Path(os.getcwd()).name)
tmp