Skip to main content

Cross-platform tool to put Python's user bin in PATH, no sudo/ELEV required!

Project description

Latest PyPI version Supported Python versions License

When you install a package via pip install --user ..., any executables get placed in a special directory specifically for the intended user. Unfortunately, this location is most likely not included in your user’s PATH variable. So for example if you did pip3 install --user hatch and then tried to learn more about your new tool by doing hatch --help, it would fail to be located. See: https://github.com/pypa/pip/issues/3813

pybin solves this problem by providing a small CLI, and corresponding API, to locate your Python’s user bin and optionally update the user PATH. It supports 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!

Installation

pybin is distributed on PyPI as a universal wheel and is available on Linux/macOS and Windows and supports Python 2.6-2.7/3.3+ and PyPy.

$ pip install pybin

Do not use --user!

Commands

Only 2!

pybin

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

  Shows the location of the bin directory and whether or not it is in the
  user PATH.

Options:
  -p, --pypath TEXT  An absolute path to a Python executable.
  --version          Show the version and exit.
  -h, --help         Show this message and exit.

Commands:
  put  Updates the user PATH

pybin put

$ pybin put -h
Usage: pybin put [OPTIONS]

  Updates the user PATH. The shell must be restarted for the update to take
  effect.

Options:
  -p, --pypath TEXT  An absolute path to a Python executable.
  -f, --force        Update PATH even if it appears to be correct.
  -h, --help         Show this message and exit.

API

>>> from pybin import in_path, locate, put_in_path
>>> in_path()
False
>>> locate()
'C:\\Users\\Ofek\\AppData\\Roaming\\Python\\Python36\\Scripts'
>>> success = put_in_path()

Manual modification

Use the location pybin shows in concert with this very comprehensive document Java provides: https://www.java.com/en/download/help/path.xml

License

pybin is distributed under the terms of both

at your option.

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

pybin-0.3.3.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

pybin-0.3.3-py2.py3-none-any.whl (7.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pybin-0.3.3.tar.gz.

File metadata

  • Download URL: pybin-0.3.3.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pybin-0.3.3.tar.gz
Algorithm Hash digest
SHA256 5a006260e0680ceff25b307043b7836bb105a18b595da6336f9a190a67c2725b
MD5 2fa5097b0afddd518a760698a4ef717f
BLAKE2b-256 ef09a0ef2db3931f9eb337b5eb19f3884a76664b1bd236e3bc64a73d2337a871

See more details on using hashes here.

File details

Details for the file pybin-0.3.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pybin-0.3.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1c24eacdef17ab530c1979a1cfcf1c0ec0c7d72764d4cc37b27b4b38137f3f5f
MD5 68fd5adf13a18ec9d283a77d677c4a85
BLAKE2b-256 64e69e691371408f7bdba1221ca1659b0111f7e34faf94ab4bb640b9a6e7ff92

See more details on using hashes here.

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