paylogic / pip-accel

pip-accel: Accelerator for pip, the Python package manager

Home Page:https://pypi.python.org/pypi/pip-accel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pip-accel does not support running as a module

elena-lilac opened this issue · comments

I've tried to run pip-accel as a
python -m pip_accel install -r requirements.txt

but it does not support running this way:
No module named pip_accel.__main__; 'pip_accel' is a package and cannot be directly executed

python==2.7, pip==7.1.2, pip-accel==0.38

Hi and thanks for the feedback. I've never consciously enabled this mode of operation in any of my Python projects. What's the advantage(s) you see in enabling this? Currently you can achieve the same effect (IIUC) using a command line like the following:

python $(which pip-accel) install -r requirements.txt

But to be honest I don't see why any of this is preferable over just running the pip-accel console script entry point which is provided specifically for this purpose :-).

python $(which pip-accel) install -r requirements.txt does't work on Win. I'm looking for the same sintax for linux/mac/win.

Hi @xolox!

Our case is not-so-simple: we have cross-platform script for virtualenv creation. It has 3 steps:

  • create virtualenv
  • install pip-accel using pip
  • install some packages using pip-accel

Script is written on python, and we use subprocess to call virtualenv, pip and pip-accel scripts.
To call, e.g. pip-accel, we need to know its binary name: pip-accel on linux & os x and pip-accel.exe on windows. (Or we can use shell=True, but subprocess docs warn that it can be a security hazard)

So we have two "magic" lines in code:

pip_exec = 'pip.exe' if is_win else 'pip'
pip_accel_exec = 'pip-accel.exe' if is_win else 'pip-accel'

Pip supports python -m pip install pip-accel syntax, and we wanted to use pip-accel the same way in order to replace two magic lines with one python_exec = 'python.exe' if is_win else 'python'.

Or, maybe, we're doing everything wrong, and there is a solution that uses no "magic" at all =)

@HPotter wrote:

Or, maybe, we're doing everything wrong, and there is a solution that uses no "magic" at all =)

No this definitely sounds like a valid and reasonable use case, I'm working on enabling python -m pip_accel ... right now. Stay tuned! :-)

I just published pip-accel version 0.43 to GitHub and PyPI. The new version supports being executed using the syntax python -m pip_accel .... While adding a simple test for this mode of execution I noticed that this isn't supported on Python 2.6 due to a regression in Python 2.6 (one workaround is to run python -m pip_accel.__main__ ...). I hope this helps!

Oh, great, thank you! That was insanely fast ;)