-
Notifications
You must be signed in to change notification settings - Fork 115
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
Upgrade Antlr to 4.11 and vendor the runtime #1114
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jlopezpena!
This looks good to me.
I have confirmed that the sha256 of the antlr .jar file in this PR is the same as the sha256 of the .jar file available at github.com/antlr/website-antlr4.
(CI lint failures are unrelated to this PR) |
@Jasha10, this is a breaking change (that would also require a parallel fix to Hydra.
|
How should users (like myself) do that, in a way that it works with various dependencies declaring (To keep the comment on-topic: from the peanut gallery, looks like this is effort well spent on a short term solution while folks address the root cause) |
@omry what is the root issue that needs to be fixed, and is there any way I can help with that? I submitted the corresponding PR to |
@astrojuanlu You can do that by having your own dependency repository (kind of a mirrored version of PyPi) where you make specific builds of packages catered to your needs. Then when you declare dependencies you specify your mirror as the primary place to find dependencies and PyPi as a fallback, or explicitly declare dependencies to be pulled from your mirror. Eg with
and when you declare a dependency instead of doing The problem with this approach is if you are working on a library that needs to be used by other people in their project, because then you are forcing THEM to also do the same thing (or you to vendor the modified package source for |
Yeah that's what I had in mind, ideally we should be able to do this in a way that transitive dependencies don't have to cooperate. Otherwise I don't see how users can cope with the current situation effectively. |
Hello, just wanted to clarify what the status of this PR is. Does the comment by @omry mean that this PR will be blocked and we will need to find another way to make If this is the case, I would be happy to help with finding the root cause and working on a PR to address it. |
I think it would be good to at least discuss @omry's points before merging.
Yes, we are working on that: facebookresearch/hydra#2733
Done! (commit bc4949b)
Any ideas for fixing the root issue? The antlr version is tightly coupled to the minor version of
Here is a recipe for users who need to build their own version of OmegaConf+Hydra: My opinion is that we should go forward with this PR.
|
I haven't looked at this in details, but would it be possible by any chance to make Hydra / OmegaConf compatible with multiple versions of antlr? (compiling the grammar during |
The current workflow for compiling the grammar invokes the following command:
This requires the antlr If we compile the grammar during Option (2) has been suggested before (here). I'm not sure specifically how we would expose such an option at |
It just so happens that I've run across a dependency problem involving this exact issue as well. Seems like a tricky issue to solve. |
I think the best solution would be to "vendor" OmegaConf with a specific version of antlr, and have Hydra depend on it. I think I outlined it at some point as one of the options for a permanent fix for this issue. |
Could an option be to replace the |
I don't see how that would do anything. |
I see, so the binary dependency is not runtime, but build-time only. I can think of two potential solutions to the bigger issue then. One would be to build the grammars at install time. The downside of that is that the antlr binary would need to be downloaded at install time (probably through antlr-tools to avoid needing a system wide install of java). This would add size and time to install, as well as require an active internet collection. The second approach would be to build multiple versions of the grammars at build time (through multiple versions of the antlr binary), and select the grammar at runtime based on the installed version of I believe the second option would be nicer from the user's point of view, with the tradeoff of having a more complex build process (which might or might not be acceptable for |
I think @omry's suggestion of shipping a specific version of |
Not quite. The antlr runtime is checking that it's working with code generated by a generator from the exact same version. Other low-level libraries, like pip itself, solves the problem of dependency conflicts by optionally including their dependencies in under a different module. They call this vendoring (pip page about it). The complication is that Hydra should probably follow whatever OmegaConf is doing here. |
I understand the benefit of vendoring, the downside of that is that by vendoring a third party pakage you are left with the burden of incorporating security updates and whatnot yourself - which might or might not be a big ordeal depending on how often there are changes that need to be incorporated, and how complex updating the vendoring is (which might be as simple as running a As mentioned, if there is anything I can do to help solve the issue let me know, the final decision on what the right solution is of couse falls onto the core developers, as they are the ones that will be left with the maintenance burden. |
Is there a final decision on what the way forward should be? We are discovering more incompatibilities with other dependencies. |
I think shipping our own version will be easier overall. We just need someone to actually implement it :) |
I guess you mean @omry's vendoring idea from #1114 (comment)
👍🏽 Thank you! |
I can reproduce the problem. The files in |
@mawildoer the non-editable installs should work now, could you give it a check? @Jasha10, @omry it looks like CI is only testing editable installs, perhaps a non-editable scenario should be added as well (in a separate PR) |
TIL; those are the old-school alias for the
Yessir! Tested both Thanks for the quick response! I'll have to package and distribute your branch if we can't get this back to mainline soon 😅 Thanks for all the work! |
@jlopezpena I've just uploaded omegaconf dev release
|
@Jasha10 excellent, thank you very much! I made a commit to the hydra PR including the regex import fixing for the generated parsers, will change it to use the |
It would be useful if someone can try a non-editable install on Windows -- I don't have a windows machine, and am a bit concerned that the "walk-path-and-replace" strategy for finding the submodules might not work due to some path formatting issues (I changed the replacement to use |
Hi @Jasha10, what are the remaining TODOs before this PR can be merged? Currently, the antlr version incompatibility is major blocker for our project (because of the clash between Omegaconf & https://github.com/Nixtla/statsforecast), so I would be happy to help with any of the remaining TODOs, if possible. |
In my opinion this PR is in good shape. |
@Jasha10, thank you for the quick response! Are there some open issues related to the CI failures on the hydra side that I could take a stab at? |
There are no open issues but you can basically look at recent open PRs on Hydra to check what's failing. |
@shchur I have made a list: |
Thank you @jlopezpena for taking on this vendoring project.
|
Bumping
antlr
binary andantlr4-python3-runtime
in order to unlock doing the same thing inhydra
, following this discussion