Project: contextlib-chdir

Backport of contextlib.chdir stdlib class added in Python3.11.

Project Details

Latest version
1.0.2
Home Page
PyPI Page
https://pypi.org/project/contextlib-chdir/

Project Popularity

PageRank
0.0018425375326831337
Number of downloads
52784

contextlib-chdir

Backport of contextlib.chdir stdlib class added in Python3.11.

Install

pip install contextlib-chdir

Usage

import os
import tempfile
from contextlib_chdir import chdir as chdir_ctx

with chdir_ctx(tempfile.gettempdir()):
    print(os.getcwd())  # /tmp

Note

You'll probably want to migrate to contextlib2 when this change is included.