-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Remove cyclic dev dependency with the parser crate #11261
Conversation
|
Hmmm, I struggle with
The problem is that the tests are now no longer living next to the implementations. This makes them hard to discover or even knowing why a test failed (My intuition for a failing test in the parser crate is that the parser is incorrect). |
Removing the cyclic dep is more important to me than co-locating the tests, so I’d still vote in favor of this. |
The other alternative is to create a third crate that depends on both, and put the tests in there, but that will also bring some confusion. |
Because of rust-analyzer? Because it isn't a cyclic dependency according to rust
|
Yeah, because of rust-analyzer. It’s causing real problems for people! |
Yeah. A few alternative options where I don't have a strong preference:
I'm slightly preferring the second option. I don't know if @BurntSushi has any other recommendation on how we could restructure our project to avoid the rust-analyzer cyclic dependency. |
It seems like this is the rust-analyzer issue: rust-lang/rust-analyzer#3390 I guess it's a problem because I don't really know another way to disable it. I ran into this problem too, but didn't diagnose the root cause. I'd definitely vote in favor of fixing this somehow. It'd be nice if RA could figure out how to make this work though, because this is a legitimate pattern in the ecosystem. |
Yeah, weak vote for making a separate crate. (Personally fine with it being at |
be7a813
to
ecc14aa
Compare
I've updated the PR description to reflect the recent changes. Thank you all for the recommendations. |
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!
You may want to add a readme to both crates shortly explaining why they exist (link to the rust analyzer issue). It could prevent that someone undoes the change in the future
b40cbdd
to
f1dcdab
Compare
f1dcdab
to
13e2e66
Compare
Stumbled upon this just now, there is an issue on the rust-analyzer repo with some more info about this than the one you linked here rust-lang/rust-analyzer#14167 |
Summary
This PR removes the cyclic dev dependency some of the crates had with the parser crate.
The cyclic dependencies are:
ruff_python_ast
has a dev dependency onruff_python_parser
andruff_python_parser
directly depends onruff_python_ast
ruff_python_trivia
has a dev dependency onruff_python_parser
andruff_python_parser
has an indirect dependency onruff_python_trivia
(ruff_python_parser
-ruff_python_ast
-ruff_python_trivia
)Specifically, this PR does the following:
ruff_python_ast_integration_tests
and move the tests from theruff_python_ast
crate which uses the parser in this crateruff_python_trivia_integration_tests
and move the tests from theruff_python_trivia
crate which uses the parser in this crateMotivation
The main motivation for this PR is to help development. Before this PR,
rust-analyzer
wouldn't provide any intellisense in theruff_python_parser
crate regarding the symbols inruff_python_ast
crate.Test Plan
Check the logs of
rust-analyzer
to not see any signs of cyclic dependency.