-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Brew installed version doesn't work with plugins #566
Comments
@rshurts you're right. Plugin installation for Homebrew-based installs doesn't work out of the box. There are advantages to keeping Homebrew as the recommended method, though. It makes updates easy and the main package can depend on Python 3 (improved SSL support, etc.). The ideal world solution would be to have all plugins available as Homebrew packages ( Using But plugins installed there won't survive HTTPie upgrades. Perhaps it would be possible to tweak the Homebrew formula to makeallow HTTPie load installed plugins from, for example, the Homebrew Python 3 …or some sort of custom plugin installer. |
In the meantime, maybe a note in the documentation around plugins saying "brew doesn't work with plugins and to pip install httpie for plugin functionality" would save some headaches. |
There is also a problem with the read rights when user has no admin rights: $ http --help
Traceback (most recent call last):
File "/usr/local/bin/http", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3123, in <module>
@_call_aside
File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3107, in _call_aside
f(*args, **kwargs)
File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3136, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 569, in _build_master
ws = cls()
File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 562, in __init__
self.add_entry(entry)
File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 618, in add_entry
for dist in find_distributions(entry, True):
File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1965, in find_on_path
for dist in factory(fullpath):
File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2035, in distributions_from_metadata
root, entry, metadata, precedence=DEVELOP_DIST,
File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2492, in from_location
py_version=py_version, platform=platform, **kw
File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2867, in _reload_version
md_version = _version_from_file(self._get_metadata(self.PKG_INFO))
File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2456, in _version_from_file
line = next(iter(version_lines), '')
File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2646, in _get_metadata
for line in self.get_metadata_lines(name):
File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1411, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1407, in get_metadata
value = self._get(self._fn(self.egg_info, name))
File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1519, in _get
with open(path, 'rb') as stream:
PermissionError: [Errno 13] Permission denied: '/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/idna-2.7-py3.7.egg-info/PKG-INFO' I was able to fix it with chmod +r /usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/idna-2.7-py3.7.egg-info/PKG-INFO but switched to |
Since I upgraded to 10.14 Mojave I'm having the permissions error mentioned by @aheissenberger above. I have the same setup where I install homebrew using a local admin account but do normal operation in a standard account. I'm not a Python person and don't understand this discussion of plugins. I do not recall trying to add anything httpie beyond whatever comes as part of the homebrew formula. Is this fundamentally a Python3 problem (at least, Python as installed via homebrew)? Should I be reporting it to the maintainers? |
For what it's worth and perhaps other users googling for an answer, installing a plugin worked fine for me like this:
Thanks #566 (comment) |
Just thinking out loud here, I haven't actually tried this. Perhaps at runtime we add
Suspect it might work fine for 80-90% of the use cases but no idea what might be in that last 10% ! |
It is preferable rather my proposal on #1108 IMO. Still:
All those solutions are not ideal, I'll see how other projects are doing. If you have examples, I would be glad to check them :) |
Good point, my random sampling of 4 plugins finds they all require |
I've done a little work on Nikola, it manages plugin installs itself. Running Maybe we could borrow the second half of that idea and do Pros
Cons
Kind of suspect it would go against Homebrew philosophy if we modify a dir managed by Homebrew in this way but it's difficult to see a clean solution to all the complications here. I'm not convinced this is a good idea but maybe it's a step nearer to one. |
From an outsiders look, this issue seem like a problem for the people who are actually maintaing plugins rather than the httpie itself. If an X tool is installed through Y platform, then it is fair to expect to get all the plugins to be installed in the same manner. So if the plugin maintainers also package their plugins for brew to support those users, that would be the general and (somewhat) unconvient solution (which is what we currently have with all those Possible solutionsIf we turn the other way around, and try to offer a more user friendly solution on the httpie side as far as I can tell there are 2 options that I can think of: --interpreter (less human friendly & more error prone)Since we don't have any actual chance of knowing what is the primary python environment they have installed the plugin (we can only assume it is the global one, or whatever The general solution that I've seen (e.g on pyperf/pyperformance) for this sort of problem is that you pass an
2 advantages over directly pointing to
Advantages over #1108:
The implementation would be simple; and works by firing the new python interpreter, retrieving the location for the site-packages and temporarily include them on the entry-point search. httpie plugin (more user friendly)A more user friendlier, but rather complex solution is to Being able to directly install plugins is something that this interface can delegate to Example scenerio;
Advantages over the
|
@isidentical I like the Perhaps the default target dir should be next to the If we are delegating to Should it be |
This would be a bit more complicated, considering there might be multiple
Indeed.
I do not believe |
Managing plugins through an HTTPie-provided command looks like the best solution all things considered.
|
Indeed. For regular installations, both options should work (
What I meant by
Yep, this will be taken care of. Since
Agreed.
What do you mean by
As I mentioned in the proposal, we will temporarily make the
Makes sense (as well as
One important thing to note here is that, we will need to have
(from https://snapcraft.io/docs/home-interface) There seems to be some discussions with workarounds, https://forum.snapcraft.io/t/accessing-xdg-config-home-of-the-host/9780/10, but I am not reliable are them (needs further research). |
Okay, that’s great 👍🏻 |
I focused on this today and seems like it is finally working (install/uninstall/list). Here is the draft branch to give an impression of the implementation, though it is nowhere near production-ready (in terms of UI): https://github.com/httpie/httpie/compare/master...isidentical:httpie-plugins?expand=1. There were a couple of caveats (e.g pip doesn't support uninstallation from a custom scheme etc) but they all seem to work now. The next steps would be creating a proper UI for this (especially in terms of error handling), and figuring out a way to write tests. |
We have finally landed |
🎉 This feature is now publicly available in HTTPie for Terminal 3.0: |
Brew is listed as the recommended way of installing httpie on macOS. However, it doesn't work with auth plugins.
For example, if you
pip3 install requests-hawk
and then runhttp --help
hawk will not show as an auth type. If youpip3 install httpie-oauth
it will install httpie via pip as a dependency and overwrite the brew installed link in/usr/local/bin/http
and now all the plugins will show because it isn't using the brew installed version.I suggest changing the documentation to read
pip3 install httpie
as the recommended method of installing on macOS.The text was updated successfully, but these errors were encountered: