Skip to main content

ShellContexts

A few useful context managers for temporarily changing the environment.

ModificationContext
`- chdir
`- set_umask
`- increase_umask
`- decrease_umask
`- seteuid
`- setegid

They are simple wrappers around the syscalls in their names. Therefore they are not thread-safe, so use them sanely. They are however reentry safe :)

chdir serves the same purpose as contextlib.chdir. It is here for completion-ist sake, and to demonstrate the abstraction provided by ModificationContext.

We decided to not add the rest to the standard library, in shutil or contextlib, whence I decided to make this package.

Installing

Available on PyPI as ShellContexts

$ pip install ShellContexts

Metadata

Release files for ShellContexts 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ShellContexts 1.0.0
File Size Uploaded
shellcontexts-1.0.0.tar.gz 39.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ShellContexts 1.0.0
File Interpreter ABI Platform
ShellContexts-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 67.3 kB

Release files / shellcontexts-1.0.0.tar.gz

Download URL shellcontexts-1.0.0.tar.gz
Size 39.4 kB
Tags Source
SHA-256 checksum
How to use checksums
59e92aa8e77a3da3a6e824d7d0ef83097c9f8ab1e9550dd06e9941dac41e495b
BLAKE2b-256 checksum
How to use checksums
aa864dd77274bcf5e577657e62e8e7463ac62e797a16f0e77ff870343af5f6c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.1

Release files / ShellContexts-1.0.0-py3-none-any.whl

Download URL ShellContexts-1.0.0-py3-none-any.whl
Size 27.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fbaed243edeb3dcea2b19290f7c0021bf9fe6f2f05d2ce1b9f79a6842c9f17ad
BLAKE2b-256 checksum
How to use checksums
2715a045c96efce59fbcd98cf913b9c2858346e321bb01eb9b2f362d759b85d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.1

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page