-
Notifications
You must be signed in to change notification settings - Fork 34
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
pip installation fixed #433
base: main
Are you sure you want to change the base?
Conversation
Hmm, this is an interesting tradeoff. It feels a bit iffy for the Python build logic to direct the user to The alternate I’m considering is:
I could be convinced that this “run-the-cli” logic is acceptable if there are other well-architected Python libraries that require the use of NPM to build. Do you know of any? What do you think of my alternate proposal? |
Agreed about nmp ref there. But as I checked just yet tree-sitter could be installed by So usually the responsibility between Python package and user environment setup is separated right there: all configuration/artifacts building for a package performed by the package itself all tooling for that (say llvm/gcc) should be installed beforehand by an OS package manager. So I could replace this error message with cargo reference. Actually usually this kind of errors are even more opaque, like "tree-sitter-cli missing" so it leaves completely up to user to figure out how to install any. Speaking about pointing it to a separate constantly outdated branch, I consider it as a last resort if any other fails by some reason. But after all it's not me who'll have to maintain it further 💁🏻♂️ |
The branch gets auto updated on every new release so I’m not worried about maintenance there (if it looks stale it’s because I haven’t had a reason to do a release in a while). What existing Python packages require installation of something separate through Cargo first? I would certainly prefer that if there’s prior art but that’s just because I like Rust more than I like js. The tree-sitter lib and tree-sitter cli are two different beasts, as I understand it, but I haven’t looked at all into how it works with Python. Unless the Python binding is some unholy wrapper around the cli, someone could absolutely be plausibly using it the lib without the cli. If the Python binding is an unholy cli wrapper, it would be great to simply call out to that. |
Also, just to add, I really appreciate you doing this! I hope my comments aren’t discouraging — I’m happy that you are using this and trying to get it working with Python, I just want to make sure we don’t impose an undue burden on future users. |
Nah, it's all good. You're raising valid concerns about PR in the repo you own. Also I've missed that the tool that I'm using in the building script is the cli not a lib, so I agree that this is no go option in it's current state. So I dug a bit further here. And here's two examples which I consider as more appropriate: https://github.com/openai/tiktoken and https://github.com/ijl/orjson are both having a rust core which are could be obtained by user by either stored in pip as an prebuilt binary (to install by pip without local compilation) or (it's an assumption of mine, haven't checked yet) got setup instruction of how to build included rust code and (link?) it with python wrapper around it. So the next question is, is there a way to generate those missed in the main files with a pure rust without |
In general the idea is to generate all missed files as the first step of installation process, which is allowed by python ecosystem.
I'd like to emphasise that beyond that i've said above I have a little sense of what is happening in this code, because I'm kinda lame in python. But now
pip install .
runs successfully on my side withbrew install tree-sitter
command beforehand. Thus I believepip install git+https://github.com/alex-pinkus/tree-sitter-swift.git
will so.Closes: #432