Skip to main content

About

Command Line Application and Python Package to Add/Append/Remove environment variables on Windows systems
Current package allows to precisely control and differentiate user and system variables

Table of Contents

  1. Installation
  2. CLI
    1. Get variable
    2. Create/Replace variable
    3. Append to existing variable
    4. Delete variable
    5. List all variables
  3. Python Package
    1. Get variable
    2. Create/Replace variable
    3. Append to existing variable
    4. Delete variable
    5. List all variables

Installation

To install the package you need to run

python -m pip install py-setenv

How to use as CLI application

Get variable (CLI)

Get value of variable my_var

:: User environment
setenv my_var -u
:: System environment
setenv my_var

Create/replace variable (CLI)

Set variable my_var to 1

:: User environment
setenv my_var -v 1 -u

:: System environment
setenv my_var -v 1

Append to existing variable (CLI)

Append my/test/dir to path variable

:: User environment
setenv path -v my/test/dir -a -u

:: System environment
setenv path -v my/test/dir -a 

Delete variable (CLI)

Delete variable my_var

:: User environment
setenv my_var -d -u

:: System environment
setenv my_var -d

List all variables (CLI)

Lists all variables

:: User environment
setenv -l

:: System environment
setenv -l

How to use as Python package

Get variable

Get value of variable my_var

from py_setenv import setenv
setenv("my_var")

Create/replace variable

Set variable my_var to 1

from py_setenv import setenv
setenv("my_var", value=1, user=True)

Append to existing variable

Append my/test/dir to path variable

from py_setenv import setenv
setenv("path", value="my/test/dir", append=True, user=True)

Delete variable

Delete variable my_var

from py_setenv import setenv
setenv("my_var", delete=True, user=True)

List all variables

Lists all variables

from py_setenv import setenv
setenv(list_all=True)

# to suppress echo to console
setenv(list_all=True, suppress_echo=True)

Metadata

Release files for py-setenv 1.1.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 py-setenv 1.1.0
File Size Uploaded
py_setenv-1.1.0.tar.gz 3.5 kB Details

Release files / py_setenv-1.1.0.tar.gz

Download URL py_setenv-1.1.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f27c46bd60515feb39ef2af83381f5d16849f5b5298490f9a076e7b031cfc69d
BLAKE2b-256 checksum
How to use checksums
277891e53c57ef084d8e70d4e48ed1f5cc175da117ccb0d63d2da79ecc5e92cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.7.8

Release history Release notifications | RSS feed

This release

1.1.0 This release

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

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