A few useful context managers for temporarily changing the environment
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shellcontexts-1.0.0.tar.gz.
File metadata
- Download URL: shellcontexts-1.0.0.tar.gz
- Upload date:
- Size: 39.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59e92aa8e77a3da3a6e824d7d0ef83097c9f8ab1e9550dd06e9941dac41e495b
|
|
| MD5 |
5895935226e25433b6a33d39c8045323
|
|
| BLAKE2b-256 |
aa864dd77274bcf5e577657e62e8e7463ac62e797a16f0e77ff870343af5f6c9
|
File details
Details for the file ShellContexts-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ShellContexts-1.0.0-py3-none-any.whl
- Upload date:
- Size: 27.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbaed243edeb3dcea2b19290f7c0021bf9fe6f2f05d2ce1b9f79a6842c9f17ad
|
|
| MD5 |
301f9e33de0e557bced2ff469b25ecc0
|
|
| BLAKE2b-256 |
2715a045c96efce59fbcd98cf913b9c2858346e321bb01eb9b2f362d759b85d2
|