Skip to main content

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


Download files

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

Source Distribution

shellcontexts-1.0.0.tar.gz (39.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ShellContexts-1.0.0-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

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

Hashes for shellcontexts-1.0.0.tar.gz
Algorithm Hash digest
SHA256 59e92aa8e77a3da3a6e824d7d0ef83097c9f8ab1e9550dd06e9941dac41e495b
MD5 5895935226e25433b6a33d39c8045323
BLAKE2b-256 aa864dd77274bcf5e577657e62e8e7463ac62e797a16f0e77ff870343af5f6c9

See more details on using hashes here.

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

Hashes for ShellContexts-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fbaed243edeb3dcea2b19290f7c0021bf9fe6f2f05d2ce1b9f79a6842c9f17ad
MD5 301f9e33de0e557bced2ff469b25ecc0
BLAKE2b-256 2715a045c96efce59fbcd98cf913b9c2858346e321bb01eb9b2f362d759b85d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page