mitsuhiko / pipsi

pip script installer
Other
2k stars 133 forks source link

auto add bin dir to PATH of shell config (i.e. .bashrc) #148

Closed cs01 closed 6 years ago

cs01 commented 6 years ago
RonnyPfannschmidt commented 6 years ago

i'm happy to add this if its an opt in and invoked via the actual pipsi

so pipsi would print something "if you believe your setup is simple, just run $PIPSI_EXECUTABLE fix_path_config" to append the required entry to your shells config" (im sure there is a better way to word this)

unconditionally simply has the potential to severely break things for a small minority, and i do not like that prospect

additionally this code is supposed to run after pipsi is installed, so its a nice way to keep get_pipsi simpler by putting it into a module in pipsi (plus you can use all the pypi modules necessary to make this simple)

cs01 commented 6 years ago

additionally this code is supposed to run after pipsi is installed, so its a nice way to keep get_pipsi simpler by putting it into a module in pipsi (plus you can use all the pypi modules necessary to make this simple)

I don't understand this logic. The installer actually prints to stdout that pipsi has been installed but additional manual steps are needed. This PR automates those manual steps in a way similar to Rust. Why is it better to defer modifying the PATH? It's a bit of a chicken and egg problem: pipsi cannot be (easily) run until it's on the PATH.

I made this the default to mimic Rust's installation, but I can understand why you are hesitant to make this the default.

In the Rust development environment, all tools are installed to the ~/.cargo/bin directory, and this is where you will find the Rust toolchain, including rustc, cargo, and rustup. Accordingly, it is customary for Rust developers to include this directory in their PATH environment variable. During installation rustup will attempt to configure the PATH. Because of differences between platforms, command shells, and bugs in rustup, the modifications to PATH may not take effect until the console is restarted, or the user is logged out, or it may not succeed at all. If, after installation, running rustc --version in the console fails, this is the most likely reason.

https://www.rust-lang.org/en-US/install.html

pew also does this.

RonnyPfannschmidt commented 6 years ago

perhaps i am overly cautious about this about this thanks for pointing this out, its perhaps best to have a release that tries it by default (and fall back later if it turns out to break things unexpectedly)

cs01 commented 6 years ago

Updated to modify path by default, per your last comment.

image

RonnyPfannschmidt commented 6 years ago

thanks for the work