userpath
========

.. image:: https://img.shields.io/travis/ofek/userpath/master.svg?logo=travis&label=Travis%20CI
    :target: https://travis-ci.org/ofek/userpath
    :alt: CI - Travis

.. image:: https://img.shields.io/appveyor/ci/ofek/userpath/master.svg?logo=appveyor&label=AppVeyor
    :target: https://ci.appveyor.com/project/ofek/userpath
    :alt: CI - AppVeyor

.. image:: https://img.shields.io/codecov/c/github/ofek/userpath/master.svg?logo=data:image/svg+xml;base64, &label=Codecov
    :target: https://codecov.io/github/ofek/userpath?branch=master
    :alt: Codecov

|

.. image:: https://img.shields.io/pypi/pyversions/userpath.svg?logo=python&label=Python&logoColor=gold
    :target: https://pypi.org/project/userpath
    :alt: PyPI - Supported Python versions

.. image:: https://img.shields.io/pypi/v/userpath.svg?logo=python&label=PyPI&logoColor=gold
    :target: https://pypi.org/project/userpath
    :alt: PyPI - Version

.. image:: https://img.shields.io/pypi/dm/userpath.svg?color=blue&label=Downloads&logo=python&logoColor=gold
    :target: https://pypi.org/project/userpath
    :alt: PyPI - Downloads

|

.. image:: https://img.shields.io/badge/License-MIT%2FApache--2.0-9400d3.svg
    :target: https://choosealicense.com/licenses
    :alt: License: MIT/Apache-2.0

.. image:: https://img.shields.io/badge/say-thanks-ff69b4.svg
    :target: https://saythanks.io/to/ofek
    :alt: Say Thanks

-----

Ever wanted to release a cool new app but found it difficult to add its
location to PATH for users? Me too! This tool does that for you on all
major operating systems and does not require elevated privileges!

    **Fear not, this only modifies the user PATH; the system PATH is never
    touched nor even looked at!**

.. contents:: **Table of Contents**
    :backlinks: none

Installation
------------

userpath is distributed on `PyPI <https://pypi.org>`_ as a universal
wheel and is available on Linux/macOS and Windows and supports
Python 2.7/3.6+ and PyPy.
::

    $ pip install userpath

Commands
--------

Only 3!
::

    $ userpath -h
    Usage: userpath [OPTIONS] COMMAND [ARGS]...

    Options:
      --version   Show the version and exit.
      -h, --help  Show this message and exit.

    Commands:
      append   Appends to the user PATH
      prepend  Prepends to the user PATH
      verify   Checks if locations are in the user PATH

.. image:: https://raw.githubusercontent.com/ofek/visuals/master/userpath/lt.PNG
    :alt: Example run

API
---

.. code-block:: python

    >>> import userpath
    >>> location = r'C:\Users\Ofek\Desktop\test'
    >>>
    >>> userpath.in_current_path(location)
    False
    >>> userpath.in_new_path(location)
    False
    >>> userpath.append(location)
    True
    >>> userpath.in_new_path(location)
    True
    >>> userpath.need_shell_restart(location)
    True

License
-------

userpath is distributed under the terms of both

- `MIT License <https://choosealicense.com/licenses/mit>`_
- `Apache License, Version 2.0 <https://choosealicense.com/licenses/apache-2.0>`_

at your option.

History
-------

Important changes are emphasized.

1.4.2
^^^^^

- Fix fallback mechanism for detecting the name of the parent process

1.4.1
^^^^^

- Fix PATH registry key type on Windows

1.4.0
^^^^^

- Fix duplicating system paths on Windows
- Prevent adding paths multiple times on macOS/Linux
- Send CLI errors to stderr instead of stdout

1.3.0
^^^^^

- Only require the dependency ``distro`` on Linux
- Ship tests with source distributions

1.2.0
^^^^^

- Added support for shell auto-detection and selection

1.1.0
^^^^^

- First public stable release

View `all history <https://github.com/ofek/userpath/blob/master/HISTORY.rst>`_
