move dataframe commands to nu-cmd-dataframe#9241
move dataframe commands to nu-cmd-dataframe#9241stormasm merged 4 commits intonushell:mainfrom stormasm:dfport10
Conversation
amtoine
left a comment
There was a problem hiding this comment.
i've started by looking at your last commit related to the tests 😋
could we, instead of commenting them out, which makes them harder to find and reenable, mark them as #[ignore]?
next to the #[test] or #[cfg(test)] 😉
There was a problem hiding this comment.
this looks great and simple, thanks a lot @stormasm for tackling the refactoring ❤️
i've got some remarks after looking at your changes:
- ✔️
crates/nu-command/src/dataframe/is now gone - ❌ an idea about the commenting of tests (see my other review)
- ❓ in the main
Cargo.toml, we have
[features]
#...
dataframe = ["nu-command/dataframe"], maybe the path should change? 😮
i'm quite confused cargo build --features dataframe still works with this path 🤔
so unfortunately you can only add #[ignore]to individual tests and not to the whole #[cfg(test)]
mod test {which is ideally what we would want... |
This was one of the trickiest parts of the refactor ---- but yes this is the magical incantation that is needed for this to work.. Getting all of the correct feature pieces in the right place was mainly the only challenging part of the refactor that took me quite a while to figure out... 👍 |
then i'd say adding i'm not a huge fan of whole blocks of dead code... as they are only 11 of them, this looks feasible? 😌 |
|
EDIT: ✔️ i just understood this and it's fine =>
|
agreed on your point with #[ignore = "comment why test is being ignored"]but this will not solve the problem because this code is still there #[cfg(test)]
mod test {
use super::super::super::super::super::IntoDatetime;
use super::super::super::super::test_dataframe::test_dataframe;
use super::*;and that is where the problem lies.. we need a way to tell the attribute to ignore the whole #[cfg(test)]
mod test {maybe @jntrnr or @fdncred knows a way to do that.... we can either delete the code entirely IntoDatetimeout of nu-command or once we determine its not worth doing then then I could come back in and delete the whole block of code of where the test is located... |
|
oooh it's an issue with the imports... then yeah if someone has a better idea 😌 EDIT: a quick and dirty way to do that might be to set a dummy yeah, fn main() {
println!("Hello, world!");
}
#[cfg(test_fixme)]
mod tests {
use euqwioeuwqioeu;
}but does complain as soon as i turn on |
great idea !! |
|
anytime @stormasm 😉 😌 |
|
Marked as a breaking change since we won't build with dataframes by default? (Or do we?) |
|
@kubouch we are good.... we were not building dataframes by default prior to my PR... you had to pass in a feature flag in order to get dataframes... its also currently documented here as well... |
|
When we publish our next release to crates.io we will have to add the crate nu-cmd-dataframeto our script... |
|
@stormasm See nushell/nu_scripts#507, I think that should be it? |
@kubouch cool ! thanks for adding that... |
|
@stormasm |
|
@amtoine developers needing the bits command will not need dataframes 😄 cargo build --features=extra'They will only have to build with the above command which does not include dataframes |
|
woooopsie, bad copy-paste 😱 |
|
it's not a breaking change. people who wanted dfrs already had to do |
oooh you're right, it's just a refactor 👍 |
requires - #9455 # ⚙️ Description in this PR i move the commands we've all agreed, in the core team, to move out of the core Nushell to the `extra` feature. > **Warning** > in the first commits here, i've > - moved the implementations to `nu-cmd-extra` > - removed the declaration of all the commands below from `nu-command` > - made sure the commands were not available anymore with `cargo run -- -n` ## the list of commands to move with the current command table downloaded as `commands.csv`, i've run ```bash let commands = ( open commands.csv | where is_plugin == "FALSE" and category != "deprecated" | select name category "approv. %" | rename name category approval | insert treated {|it| ( ($it.approval == 100) or # all the core team agreed on them ($it.name | str starts-with "bits") or # see #9241 ($it.name | str starts-with "dfr") # see #9327 )} ) ``` to preprocess them and then ```bash $commands | where {|it| (not $it.treated) and ($it.approval == 0)} ``` to get all untreated commands with no approval, which gives ``` ╭────┬───────────────┬─────────┬─────────────┬──────────╮ │ # │ name │ treated │ category │ approval │ ├────┼───────────────┼─────────┼─────────────┼──────────┤ │ 0 │ fmt │ false │ conversions │ 0 │ │ 1 │ each while │ false │ filters │ 0 │ │ 2 │ roll │ false │ filters │ 0 │ │ 3 │ roll down │ false │ filters │ 0 │ │ 4 │ roll left │ false │ filters │ 0 │ │ 5 │ roll right │ false │ filters │ 0 │ │ 6 │ roll up │ false │ filters │ 0 │ │ 7 │ rotate │ false │ filters │ 0 │ │ 8 │ update cells │ false │ filters │ 0 │ │ 9 │ decode hex │ false │ formats │ 0 │ │ 10 │ encode hex │ false │ formats │ 0 │ │ 11 │ from url │ false │ formats │ 0 │ │ 12 │ to html │ false │ formats │ 0 │ │ 13 │ ansi gradient │ false │ platform │ 0 │ │ 14 │ ansi link │ false │ platform │ 0 │ │ 15 │ format │ false │ strings │ 0 │ ╰────┴───────────────┴─────────┴─────────────┴──────────╯ ``` # 🖌️ User-Facing Changes ``` $nothing ``` # 🧪 Tests + Formatting - ⚫ `toolkit fmt` - ⚫ `toolkit clippy` - ⚫ `toolkit test` - ⚫ `toolkit test stdlib` # 📖 After Submitting ``` $nothing ``` # 🔍 For reviewers ```bash $commands | where {|it| (not $it.treated) and ($it.approval == 0)} | each {|command| try { help $command.name | ignore } catch {|e| $"($command.name): ($e.msg)" } } ``` should give no output in `cargo run --features extra -- -n` and a table with 16 lines in `cargo run -- -n`
Context from Discord: https://discord.com/channels/601130461678272522/615962413203718156/1138694933545504819 I was working on Nu for the first time in a while and I noticed that sometimes rust-analyzer takes a really long time to run `cargo check` on the entire workspace. I dug in and it was checking a bunch of dataframe-related dependencies even though the `dataframe` feature is not built by default. It looks like this is a regression of sorts, introduced by #9241. Thankfully the fix is pretty easy, we can make it so everything important in `nu-cmd-dataframe` is only used when the `dataframe` feature is enabled. ### Impact on `cargo check --workspace` Before this PR: 635 crates, 33.59s After this PR: 498 crates, ~20s (with the `mold` linker and a `cargo clean` before each run, the relative difference for incremental checks will likely be much larger)
All of the dataframe commands ported over with no issues...
11 tests are commented out (for now)
So 100 of the original 111 tests are passing with only 11 tests being ignored for now..
As per our conversation in the core team meeting on Wednesday
I took @jntrnr suggestion and just commented out the tests dealing
with IntoDatetime
Later on we can move this functionality out of nu-command if we decide it makes sense...
The following tests were ignored...