Skip to main content

Some environment related functions.

Latest release 20230407: getenv: new parse callable parameter to parse the value.

  • LOGDIR, VARRUN, FLAGDIR: lambdas defining standard places used in other modules

  • envsub: replace substrings of the form '$var' with the value of 'var' from environ.

  • getenv: fetch environment value, optionally performing substitution

Function envsub(s, environ=None, default=None)

Replace substrings of the form '$var' with the value of 'var' from environ.

Parameters:

  • environ: environment mapping, default os.environ.
  • default: value to substitute for unknown vars; if default is None a ValueError is raised.

Function getenv(var, default=None, environ=None, dosub=False, parse=None)

Fetch environment value.

Parameters:

  • var: name of variable to fetch.
  • default: default value if not present. If not specified or None, raise KeyError.
  • environ: environment mapping, default os.environ.
  • dosub: if true, use envsub() to perform environment variable substitution on default if it used. Default value is False.
  • parse: optional callable to parse the environment variable; NOTE: if this raises ValueError and there is a default, issue a warning and return default

Function LOGDIR(environ=None)

various standard locations used in the cs.* modules

Release Log

Release 20230407: getenv: new parse callable parameter to parse the value.

Release 20190103:

  • Drop getLogin and getHomeDir, unused.
  • Make get_standard_var private as _get_standard_var.

Release 20170905.1: Tweak doco and DISTINFO.

Release 20170905: Add LOGDIR, VARRUN, FLAGDIR wrappers for new get_standard_var function to provide standard policy variables.

Release 20160828: Update metadata with "install_requires" instead of "requires".

Release 20150118: Initial PyPI release.

Release files for cs.env 20230407

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

Source distribution (sdist)

Source distribution for cs.env 20230407
File Size Uploaded
cs.env-20230407.tar.gz 3.3 kB Details

Built distribution (wheel)

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

Total release size: 6.6 kB

Release files / cs.env-20230407.tar.gz

Download URL cs.env-20230407.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0f1af8c1d5de63b705ebde8cf0ee9755b836b5516427e89298debea0ae07b8ec
BLAKE2b-256 checksum
How to use checksums
12e062ef45f7a8cbe00956c9686b0a83e9ac49ed8f0edc29146f5807541d2647
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / cs.env-20230407-py3-none-any.whl

Download URL cs.env-20230407-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f44fb78adc286b7bd93ae01337e6e5c1669a48ba564928c887c4162d459c9502
BLAKE2b-256 checksum
How to use checksums
7f669d3aeaf06120240e5d0c54d7a50ae27ecbaea49082bed315e93a02b23216
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release history Release notifications | RSS feed

This release

20230407 This release

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