-
-
Notifications
You must be signed in to change notification settings - Fork 269
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
Add workspace feature #3841
Add workspace feature #3841
Conversation
I should test how |
It would be nice if |
Some feedback:
This also occurs the other way around: If the parent project has a restrictive dependency but the subproject does not, the subproject's version is held back, but the green
|
Thanks, we need to collect compat for all projects in Line 2242 in e385b21
Yeah, the status output hasn't really been hooked up to this yet. Right now it shows everything merged among all projects. |
@jakobnissen, both your issues should be solved now. There is also an update on the julia side for the corresponding PR. |
Should check that |
First, I'd like to thank the huge effort behind this! I believe at some point on slack, someone proposed subprojects to be a way resolving the local module loading. More specifically, I like this to make mono-packages with multiple subpackages easier. So, for example, in our package Yao, we have YaoBase, YaoBlocks, etc. as submodules for Yao, and
So, what I'd like to have for a subproject is not only allowing loading dependencies from the base project but also allowing the base project to depend on several subprojects. This way, I can have a single package But again I don't think this feature is in conflict with this PR. Just want to bring this up, maybe we can chat a bit more during JuliaCon. |
To confirm I am understanding correctly. |
I'll say some things that would work with this: No need for TestEnv.jlInstead, make Relative paths in Manifest.toml.I'm not sure what this means. Sure, you can dev things with your "root" project active but as soon as you activate one of the packages in the monorepo and do a resolve you are going to have to dev everything unregistered there again. LOAD_PATH pushingPackages are not resolved together in the different environments in the load path so you might load incompatible versions here (if your root project has a required dependency version that is different from what that same dependency resolved to in the other environment). You also need to mutate this global state at the top of the script file if you want to mutate |
To be clear my comment was in agreement that those were good things, for the reasons you listed. |
Every project in the "workspace" will resolve together and generate a single manifest, yes. |
|
Missing showing that Pkg got added to the project file for some reason. |
should print paths relative to project when doing a |
I'm seeing some (I think) spurious warnings like:
|
ee5d53f
to
cab08da
Compare
91f0c50
to
c053732
Compare
I'm a bit confused about the workflow here, in particular in the context of From the discussion above, I understand that one has to specify |
I don't know if they are confusing or not. But being able to run the tests with the same versions as you actually run your code seems like a feature to me. Of course, you are not forced to put |
I fully agree that having That said, the fact that the proposed design has worked well for Rust is probably a good indicator that the idea is sound and I don't want to add noise to this discussion. So please feel free to ignore my feedback if you don't share these concerns. |
There is another possible (somewhat orthogonal) feature that could be explored (which could probably use the name "subproject") which is a project whose dependencies are the union of those listed in its own project and that of its "parent" (which is specified in the project file of the subproject). I am not fully clear exactly what the rules should be for resolving etc for that. |
9b63dea
to
3a1fad8
Compare
3a1fad8
to
0266008
Compare
8688290
to
4e15ea9
Compare
|
||
This structure is particularly beneficial for developers using a monorepo approach, where a large number of unregistered packages may be involved. It's also useful for adding documentation or benchmarks to a package by including additional dependencies beyond those of the package itself. | ||
|
||
Workspace can be nested, that ism a project that itself defines a workspace can also be part of another workspace. |
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 for this wonderful feature, just pointing out the typo ism
above!
This feature allows one to define a "workspace" in a project file by adding ```toml [workspace] projects = ["packageA", "docs", "test"] ``` to it. All projects in a workspace are resolved together into a single manifest file in the "root" project (the project that is not included by any other project in a workspace). The compat of all dependencies are intersected among the projects. Currently, every project in a workspace must be in a folder at the same level as the project that includes it into the workspace. If the test folder is included in the workspace, running `Pkg.test` is similar to just activating the test project and including the `runtest.jl` file. Many functions now take the `workspace` argument to decide if the function should operate on the active project or on the full workspace: - `Pkg.precompile` - `Pkg.status` - `Pkg.why` - `Pkg.instantiate`
This feature allows one to define a "workspace" in a project file by adding ```toml [workspace] projects = ["packageA", "docs", "test"] ``` to it. All projects in a workspace are resolved together into a single manifest file in the "root" project (the project that is not included by any other project in a workspace). The compat of all dependencies are intersected among the projects. Currently, every project in a workspace must be in a folder at the same level as the project that includes it into the workspace. If the test folder is included in the workspace, running `Pkg.test` is similar to just activating the test project and including the `runtest.jl` file. Many functions now take the `workspace` argument to decide if the function should operate on the active project or on the full workspace: - `Pkg.precompile` - `Pkg.status` - `Pkg.why` - `Pkg.instantiate`
Edit: The description below is not 100% accurate to the final implementation.
This PR requires JuliaLang/julia#53653.
This allows one to define a subproject which is an incremental addition to the dependency graph of the "base project". When the sub project is active it can load any dependency from the base project and the sub project itself. When Pkg resolves, it resolves among the base project and all sub projects and the full dependency graph is stored in a single manifest next to the base project's manifest.
Subprojects are defined by specifying a list of folders in the project file as:
Right now, the base project has to be one level above any sub project.
TODO:
Pkg/test>
iftest
is a subproject to Pkg.As a follow-up to this I want to make it so that the test subproject is special and that running
Pkg.test
if this is active should be equivalent to:Other follow up is to perhaps enhance
Pkg.status()
to show more clearly what packages comes from the base project and what comes from the sub project.