-
-
Notifications
You must be signed in to change notification settings - Fork 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
chore(rust): Re-organize folder structure for Rust crates #10141
Conversation
A counter example: https://github.com/datafuselabs/databend/tree Polars-pipe and polars-plan are subcrates of polars-lazy and not accessible by any other crate. We can of-course make it flat. My rationale was that crates that can be used by other polars crates are flat, and that sub-crates that merely serve as sort of modules for a higher crate are nested. Because, though you change the folder structure now, it still are sub-crates. ;) |
Ah thanks! They have lots of crates 😅 but they don't really nest them - it's more like a folder structure with separate crates. Not crates-within-crates (with a rare exception).
True, in the end the dependencies dictate whether something should be considered a sub-crate or not. But following that logic, So to me it makes more sense to just get rid of the idea that folder structure indicates interdependency, and just organize it in a flat way. That also brings some uniformity to for example the path definition of dependencies in Cargo.tomls. |
Ok, no strong opinion here. Flat is easier to grok |
My OCD will be so pleased 😄 Any preference for the main folder? It's I will leave this open for a bit for other maintainers to chime in, and if no objections pop up, rebase & merge it at the end of the day. |
I share the same sentiments, flat is a bit easier to navigate. |
@stinodego this broke the The problem is that the nightly feature flag now isn't set anymore for all crates. When we nested under a global polars crate, all subcrates inherited the This now break clippy locally. |
I was looking at the ruff code base, and I am extremely jealous of the nice organization of their crates, and repo structure in general. I messed around a bit within our repo and came up with this.
I realize there is probably good reason for the repo to be set up the way it is right now, so please enlighten me! But I figured I'd just open a PR since I already had something working anyway.
Changes:
polars-lazy
had two crates in its subfolders:polars-plan
andpolars-pipe
. These have been moved up one level, so they are no longer underpolars-lazy
.polars
crate is moved down one level and lives next to the other crates.crates
.The main motivation for this change is to eliminate the pattern of 'sub-crates'. Something feels off about having a standard Rust crate setup with
src
,Cargo.toml
, etc. and then have other folders outside thesrc
folder with more source code in them. I also cannot find any examples of this pattern looking through some other Rust code bases or the Cargo docs.I also expect this 'flat' structure to make it easier to configure tooling / Cargo for CI purposes.
I can imagine the motivation for this change is quite weak and doesn't warrant such a sweeping change, but I figured I'd throw it out there anyway.
Thoughts?