-
-
Notifications
You must be signed in to change notification settings - Fork 611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for installation via pipx #1087
Comments
I will try to tackle this myself soon, but I was wondering if someone already familiar with the |
Hello @georgek, Thanks for bringing this up! TBH I have no experience with Internally pip-sync installs packages via: subprocess.check_call([sys.executable, '-m', 'pip', 'install', '...']) and it works pretty well for many cases. At first glance, we could configure the executable path that would resolve the issue. Any other ideas? /cc @cs01 what do you think? |
Could you elaborate on why |
It doesn't break it as such, but the problem is if you add tools like pip-tools to your virtualenvs then it will be included in It looks like finding python via One reason I thought about this is because poetry supports (and recommends) installation via |
Yeah, that's because |
Simply changing those calls to this seems to do the right thing: subprocess.check_call(["python", '-m', 'pip', 'install', '...']) This executes "python" in the currently active environment, which is what would generally be expected. I've tested it and it works fine when installed with Calling Being able to use |
That was part of the fix #734 issue AFAIR. The |
|
It guarantees you'll install packages in the same environment as |
But one problem will be a mismatch with what |
This could probably solve this issue with if os.environ.get('VIRTUAL_ENV'):
executable = 'python'
else:
executable = sys.executable |
Hi just wanted to leave a quick note that I am aware of this issue, but haven't had time to fully read it yet and formulate a response. I am also a huge fan of pip-tools! Wonderful project. I will respond at some point if my input is still needed. In the mean time I will cc some maintainers of pipx in case they have the bandwidth to respond. cc @uranusjr @itsayellow @gaborbernat |
This won't work well in some environments, like Devcontainer. Devcontainer encloses the entire development environment into a container, per project, so there's no need to create new virtual environment and allowed to pollute system site-packages. In that case, the code mentioned above won't solve the problem. |
@georgek Does |
Sorry for the extremely late reply. Yes, using the |
@georgek Did you make any progress on this feature, meanwhile? |
I haven't looked into it recently. The But the latter ( I'd be happy to give this a go if this sounds in any way like a good idea. I have no experience in this area yet. |
Yes, this sounds like the best solution. Unfortunately, there doesn't seem to be a way to import a module for a specific python version right now. Please try it out! |
@georgek https://github.com/juftin/hatch-pip-compile was able to accomplish this with hatch. Perhaps @juftin can say more on how that was done especially being able to use the same pip-compile install across multiple Python versions (i.e., the hatch version matrix feature like in tox) |
Actually, subprocess.check_call([hatch_env.executable, '-m', 'piptools', 'compile', '...']) Being able to use an option like |
What's the problem this feature will solve?
pipx
is a new tool which supports "global" installation of user tools.pip-tools
seems like an ideal candidate for such a global tool. However, currently if you installpip-tools
that way then anything that it installs (viapip-sync
) goes into thepipx
installation venv.Describe the solution you'd like
I'd like to be able to install
pip-tools
once viapipx
and then use this to sync my active virtualenv.Alternative Solutions
The current alternative is to install
pip-tools
in each virtualenv but the downside is it then breakspip freeze
and requires updating for each virtualenv you might have on your system (pip install -U pip-tools
).The text was updated successfully, but these errors were encountered: