Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

env_path

XulbuX edited this page Jan 6, 2026 · 5 revisions

EnvPath

This class includes methods to work with the PATH environment variable.


paths()

This method will return the PATH variable as a string or a list with the separated paths.
Param: as_list: bool = False whether to return the paths as a list or a string
Returns: the PATH variable as a single pathlib.Path object or a list of pathlib.Path objects


has_path()

This method will check if a path is present in the PATH variable.
Params:

  • path: Optional[str] = None the path to check
  • cwd: bool = False whether to check if CWD path is present
  • base_dir: bool = False whether to check if the base directory path is present

Returns: True if the path is present in the PATH variable, False otherwise


add_path()

This method will add a path to the PATH variable (if it's not already present).
Params:

  • path: Optional[str] = None the path to add
  • cwd: bool = False whether to add the current working directory path
  • base_dir: bool = False whether to add the base directory path

Returns: no return value


remove_path()

This method will remove a path from the PATH variable (if it's present).
Params:

  • path: Optional[str] = None the path to remove
  • cwd: bool = False whether to remove the current working directory path
  • base_dir: bool = False whether to remove the base directory path

Returns: no return value

★⠀Python Library by XulbuX ⠀★

Project Links

Testing and Formatting

Classifiers

  • Intended Audience:
    • Developers
  • License:
    • OSI Approved
    • MIT License
  • Operating Systems:
    • Full Library: OS Independent
  • Supported Python Versions:
    • Python 3.14
    • Python 3.13
    • Python 3.12
    • Python 3.11
    • Python 3.10
  • Topics:
    • Libraries
    • Python Modules
    • Software Development

The XulbuX Logo

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /