Skip to main content

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
pathreg list

Python API

from pathreg import add_path, remove_path, list_paths

add_path("/some/directory")     # idempotent — skips if already present
remove_path("/some/directory")  # no-op if not found
list_paths()                    # returns list[Path] of current PATH entries

add_path and remove_path modify the shell profile and the current process's PATH immediately.

Behavior

  • Paths are normalized: trailing separators stripped, slashes converted per platform.
  • add_path is idempotent — does nothing if the entry already exists.
  • remove_path is 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


Download files

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

Source Distribution

pathreg-1.0.1.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

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

pathreg-1.0.1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file pathreg-1.0.1.tar.gz.

File metadata

  • Download URL: pathreg-1.0.1.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pathreg-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ff9b6020e8230b35a90b8d6b047059fe69794af26e571b071cfe34bbbcb2565f
MD5 06967cb4bf22aae121a1a41482927e62
BLAKE2b-256 aedf9f3e051103b16db447ef6fe1700c687fc010e6f8798806a0150aa2127f28

See more details on using hashes here.

Provenance

The following attestation bundles were made for pathreg-1.0.1.tar.gz:

Publisher: publish.yml on tn3w/pathreg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pathreg-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pathreg-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pathreg-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 27a430dec50fca96502d98e081877db66199b7cff0ecc345bc0d1ff44859ea24
MD5 71a50f3414c333a0ff70b19af9b93dae
BLAKE2b-256 acf4ff2d30e516191ad5b7605703d3fd48534fd3cb3cc5c093c61da8da46ef0e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pathreg-1.0.1-py3-none-any.whl:

Publisher: publish.yml on tn3w/pathreg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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