Skip to main content

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

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

contextlib-chdir-1.0.2.tar.gz (1.9 kB view hashes)

Uploaded source

Built Distribution

contextlib_chdir-1.0.2-py3-none-any.whl (2.2 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page