ofek / pybin Goto Github PK
View Code? Open in Web Editor NEWCross-platform tool to put Python's user bin in PATH, no sudo/runas required!
License: Apache License 2.0
Cross-platform tool to put Python's user bin in PATH, no sudo/runas required!
License: Apache License 2.0
I'm trying to use hatch
on macOS (High Sierra 10.13.5), and need to use pybin
to update my patch to find the installed hatch
script, but I can't get pybin
to modify my path.
What am I doing wrong?
$ pip3 install --user hatch
$ hatch
-bash: hatch: command not found
$ sudo -H pip3 install pybin
$ pybin
The user bin directory `/Users/brendan/Library/Python/3.7/bin` is not in PATH.
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
$ pybin put
Success!
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
$ pybin put -f
Success!
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
I found that in a default skeleton user directory in Elementary 5 (based on Ubuntu bionic), there is no final newline in the .bashrc file, which instead finishes with the word 'esac' which is the end of a case statement.
Pybin's default editing behaviour therefore causes this error...
bash: /home/cefn/.bashrc: line 171: syntax error near unexpected token `PATH="/home/cefn/.local/bin:$PATH"'
bash: /home/cefn/.bashrc: line 171: `esacexport PATH="/home/cefn/.local/bin:$PATH"'
This is easily resolved by putting a newline after the word 'esac' but it would be better if pybin preceded the edit performed by its 'put' behaviour with a newline to be sure this doesn't happen.
This is a great little utility and I hope it is able to be maintained.
As you have probably noticed at pypa/pip#3813 there was a big issue around the message which should be shown to the user, regardless of what changes might be made.
Unfortunately I think pybin retains some of these issues of documentation and understandability in terms of the guidance and messages shown, but I think they may be easily fixed with your help.
python3 -m pybin
I suffer from the Debian curse of no .local/bin in my $PATH . Of course, this means that it is impossible to run pybin which is in .local/bin, which defeats its own purpose. Running the 'package main' of pybin using the -m option works regardless if .local/bin is on the path or not.
I ran the following...
python3 -m pybin
The user bin directory `/home/cefn/.local/bin` is not in PATH.
...but I was disappointed that it didn't offer a fix. It should instead read as follows.
python3 -m pybin
The user bin directory `/home/cefn/.local/bin` is not in PATH.
Run type the following line and press enter to fix your path...
python3 -m pybin put
Alternatively you could have pybin by default offer an interactive prompt to fix a non-existent path, with flags to override interactive (do nothing) or force (change the path non-interactively).
I ran...
python3 -m pybin put
Success!
..and it had successfully added the path line to the end of my .bashrc. Brilliant! This will be very useful for me as an educator working with learners who may be following my instructions to install python3 at home, as part of the VGKits Vanguard project.
Thanks for your intervention. It could save a world of pain for lots of people.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.