A lightweight Python library to persistently add or remove directories from PATH.
Project description
pathreg
Persistently add or remove directories from PATH on Windows, Linux, and macOS.
Installation
pip install pathreg
CLI Usage
pathreg add /some/directory
pathreg remove /some/directory
Python API
from pathreg import add_path, remove_path
add_path("/some/directory") # idempotent — skips if already present
remove_path("/some/directory") # no-op if not found
Both functions modify the shell profile and the current process's PATH immediately.
Behavior
- Paths are normalized: trailing separators stripped, slashes converted per platform.
add_pathis idempotent — does nothing if the entry already exists.remove_pathis a no-op if the entry is absent or the profile file does not exist.
Platform support
| Platform | Persistence target |
|---|---|
| Windows | HKCU\Environment via winreg; broadcasts WM_SETTINGCHANGE to notify the shell |
| bash | ~/.bash_profile (falls back to ~/.profile if it exists) |
| zsh | ~/.zshenv |
| sh | ~/.profile |
The active shell is detected from the SHELL environment variable.
No third-party dependencies required.
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 pathreg-1.0.0.tar.gz.
File metadata
- Download URL: pathreg-1.0.0.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f949513c4531230b6950585487e86f0c420aee664fec466042038abd40b242d1
|
|
| MD5 |
6fcb161bae79a71401f0836cc75e8b4e
|
|
| BLAKE2b-256 |
a595e949616b635531e1883cdb91952a5a0c75e748838d7f3dedeba3e481eb28
|
Provenance
The following attestation bundles were made for pathreg-1.0.0.tar.gz:
Publisher:
publish.yml on tn3w/pathreg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pathreg-1.0.0.tar.gz -
Subject digest:
f949513c4531230b6950585487e86f0c420aee664fec466042038abd40b242d1 - Sigstore transparency entry: 1245003795
- Sigstore integration time:
-
Permalink:
tn3w/pathreg@2f5edee2d89f036f62b84126a20ed729b283c3d0 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/tn3w
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2f5edee2d89f036f62b84126a20ed729b283c3d0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pathreg-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pathreg-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
619c0350c5a1430fdc41eaac86fcfe49e3b409fcc0f75e607a7ee0b3aca0983d
|
|
| MD5 |
912d6e499d270e94dcc331a56bef306b
|
|
| BLAKE2b-256 |
fa98fdb205bba76e609d01dd20a0ace35ce785f449add54edf637fad610bdf9b
|
Provenance
The following attestation bundles were made for pathreg-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on tn3w/pathreg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pathreg-1.0.0-py3-none-any.whl -
Subject digest:
619c0350c5a1430fdc41eaac86fcfe49e3b409fcc0f75e607a7ee0b3aca0983d - Sigstore transparency entry: 1245004005
- Sigstore integration time:
-
Permalink:
tn3w/pathreg@2f5edee2d89f036f62b84126a20ed729b283c3d0 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/tn3w
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2f5edee2d89f036f62b84126a20ed729b283c3d0 -
Trigger Event:
push
-
Statement type: