Enables explicit root setting for [tool.rye.workspace] table #1023
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Wanted to take a crack at solving my specific problem in #856. Repeated here:
In a monorepo I am working on, there is the following structure:
Each project should be usable independently and their dependencies may conflict (so a top level workspace does not apply). I would like for users of the repo to be able to
rye sync
inmonorepo/project1
when they need to work on that project and have an editable install ofmonorepo/project0
.Above I only showed a single dependencies per project, but in the future there may be more than one dependency from the monorepo for a given project, e.g.,
project4
:Solution
By setting the
root
key in the[tool.rye.workspace]
table one can now explicitly override the search root for projects for the relevant project's workspace. Project membership (i.e.,is_member
) is first checked as before, using the current project's root, and then is checked using the explicitly specified search root (if applicable).This might not be the final answer (e.g., it might be nice to be able to control the search root on a per member basis, where members could optionally become inline tables with
name
(the current glob pattern) androot
keys), but it's a good starting point.Given this is my first time looking at the
rye
code base, and my Rust is not expert level, I'd appreciate feedback here. I left a TODO related to error handling in the case when the root key results in anError
.Happy to hear discussion about this PR, it solves my problem for the moment so I hope we can get in it
rye
in some form in the near future because I can't use it in my project until there is some way to handle this scenario.