move dataframe commands to nu-cmd-dataframe (#9241)

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](https://github.com/nushell/nushell/blob/main/crates/nu-command/src/conversions/into/mod.rs)

Later on we can move this functionality out of nu-command if we decide
it makes sense...

### The following tests were ignored...

```rust
modified:   crates/nu-cmd-dataframe/src/dataframe/series/date/get_day.rs
modified:   crates/nu-cmd-dataframe/src/dataframe/series/date/get_hour.rs
modified:   crates/nu-cmd-dataframe/src/dataframe/series/date/get_minute.rs

modified:   crates/nu-cmd-dataframe/src/dataframe/series/date/get_month.rs
modified:   crates/nu-cmd-dataframe/src/dataframe/series/date/get_nanosecond.rs
modified:   crates/nu-cmd-dataframe/src/dataframe/series/date/get_ordinal.rs

modified:   crates/nu-cmd-dataframe/src/dataframe/series/date/get_second.rs
modified:   crates/nu-cmd-dataframe/src/dataframe/series/date/get_week.rs
modified:   crates/nu-cmd-dataframe/src/dataframe/series/date/get_weekday.rs

modified:   crates/nu-cmd-dataframe/src/dataframe/series/date/get_year.rs
modified:   crates/nu-cmd-dataframe/src/dataframe/series/string/strftime.rs
```
This commit is contained in:
Michael Angerman 2023-05-19 10:56:08 -07:00 committed by GitHub
parent ca275f59da
commit c55b5c0a55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
131 changed files with 128 additions and 51 deletions

21
Cargo.lock generated
View File

@ -2611,6 +2611,7 @@ dependencies = [
"nix",
"nu-ansi-term",
"nu-cli",
"nu-cmd-dataframe",
"nu-cmd-lang",
"nu-color-config",
"nu-command",
@ -2678,6 +2679,24 @@ dependencies = [
"unicode-segmentation",
]
[[package]]
name = "nu-cmd-dataframe"
version = "0.80.1"
dependencies = [
"chrono",
"fancy-regex",
"indexmap",
"nu-cmd-lang",
"nu-engine",
"nu-parser",
"nu-protocol",
"nu-test-support",
"num 0.4.0",
"polars",
"serde",
"sqlparser 0.32.0",
]
[[package]]
name = "nu-cmd-lang"
version = "0.80.1"
@ -2747,6 +2766,7 @@ dependencies = [
"native-tls",
"notify",
"nu-ansi-term",
"nu-cmd-dataframe",
"nu-cmd-lang",
"nu-color-config",
"nu-engine",
@ -2770,7 +2790,6 @@ dependencies = [
"os_pipe",
"pathdiff",
"percent-encoding",
"polars",
"powierza-coefficient",
"print-positions",
"quick-xml 0.28.2",

View File

@ -28,6 +28,7 @@ members = [
"crates/nu-parser",
"crates/nu-system",
"crates/nu-cmd-lang",
"crates/nu-cmd-dataframe",
"crates/nu-command",
"crates/nu-protocol",
"crates/nu-plugin",
@ -45,6 +46,7 @@ members = [
nu-cli = { path = "./crates/nu-cli", version = "0.80.1" }
nu-color-config = { path = "./crates/nu-color-config", version = "0.80.1" }
nu-cmd-lang = { path = "./crates/nu-cmd-lang", version = "0.80.1" }
nu-cmd-dataframe = { path = "./crates/nu-cmd-dataframe", version = "0.80.1", optional = true }
nu-command = { path = "./crates/nu-command", version = "0.80.1" }
nu-engine = { path = "./crates/nu-engine", version = "0.80.1" }
nu-json = { path = "./crates/nu-json", version = "0.80.1" }

View File

@ -0,0 +1,68 @@
[package]
authors = ["The Nushell Project Developers"]
description = "Nushell's dataframe commands based on polars."
edition = "2021"
license = "MIT"
name = "nu-cmd-dataframe"
repository = "https://github.com/nushell/nushell/tree/main/crates/nu-cmd-dataframe"
version = "0.80.1"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
bench = false
[dependencies]
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.80.1" }
nu-engine = { path = "../nu-engine", version = "0.80.1" }
nu-parser = { path = "../nu-parser", version = "0.80.1" }
nu-protocol = { path = "../nu-protocol", version = "0.80.1" }
# Potential dependencies for extras
chrono = { version = "0.4.23", features = [
"std",
"unstable-locales",
], default-features = false }
fancy-regex = "0.11.0"
indexmap = { version = "1.7", features = ["serde-1"] }
num = { version = "0.4.0", optional = true }
serde = { version = "1.0.123", features = ["derive"] }
sqlparser = { version = "0.32.0", features = ["serde"], optional = true }
[dependencies.polars]
features = [
"arg_where",
"checked_arithmetic",
"concat_str",
"cross_join",
"csv",
"cum_agg",
"default",
"dtype-categorical",
"dtype-datetime",
"dtype-struct",
"dynamic_groupby",
"ipc",
"is_in",
"json",
"lazy",
"object",
"parquet",
"random",
"rolling_window",
"rows",
"serde",
"serde-lazy",
"strings",
"strings",
"to_dummies",
]
optional = true
version = "0.29.0"
[features]
dataframe = ["default"]
default = ["num", "polars", "sqlparser"]
[dev-dependencies]
nu-test-support = { path = "../nu-test-support", version = "0.80.1" }

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 - 2023 The Nushell Project Developers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -79,7 +79,7 @@ fn command(
.map(|df| PipelineData::Value(NuDataFrame::into_value(df, call.head), None))
}
#[cfg(test)]
#[cfg(explore_refactor_IntoDatetime)]
mod test {
use super::super::super::super::super::IntoDatetime;
use super::super::super::super::test_dataframe::test_dataframe;

View File

@ -79,7 +79,7 @@ fn command(
.map(|df| PipelineData::Value(NuDataFrame::into_value(df, call.head), None))
}
#[cfg(test)]
#[cfg(explore_refactor_IntoDatetime)]
mod test {
use super::super::super::super::super::IntoDatetime;
use super::super::super::super::test_dataframe::test_dataframe;

View File

@ -79,7 +79,7 @@ fn command(
.map(|df| PipelineData::Value(NuDataFrame::into_value(df, call.head), None))
}
#[cfg(test)]
#[cfg(explore_refactor_IntoDatetime)]
mod test {
use super::super::super::super::super::IntoDatetime;
use super::super::super::super::test_dataframe::test_dataframe;

View File

@ -79,7 +79,7 @@ fn command(
.map(|df| PipelineData::Value(NuDataFrame::into_value(df, call.head), None))
}
#[cfg(test)]
#[cfg(explore_refactor_IntoDatetime)]
mod test {
use super::super::super::super::super::IntoDatetime;
use super::super::super::super::test_dataframe::test_dataframe;

View File

@ -79,7 +79,7 @@ fn command(
.map(|df| PipelineData::Value(NuDataFrame::into_value(df, call.head), None))
}
#[cfg(test)]
#[cfg(explore_refactor_IntoDatetime)]
mod test {
use super::super::super::super::super::IntoDatetime;
use super::super::super::super::test_dataframe::test_dataframe;

View File

@ -79,7 +79,7 @@ fn command(
.map(|df| PipelineData::Value(NuDataFrame::into_value(df, call.head), None))
}
#[cfg(test)]
#[cfg(explore_refactor_IntoDatetime)]
mod test {
use super::super::super::super::super::IntoDatetime;
use super::super::super::super::test_dataframe::test_dataframe;

View File

@ -79,7 +79,7 @@ fn command(
.map(|df| PipelineData::Value(NuDataFrame::into_value(df, call.head), None))
}
#[cfg(test)]
#[cfg(explore_refactor_IntoDatetime)]
mod test {
use super::super::super::super::super::IntoDatetime;
use super::super::super::super::test_dataframe::test_dataframe;

View File

@ -79,7 +79,7 @@ fn command(
.map(|df| PipelineData::Value(NuDataFrame::into_value(df, call.head), None))
}
#[cfg(test)]
#[cfg(explore_refactor_IntoDatetime)]
mod test {
use super::super::super::super::super::IntoDatetime;
use super::super::super::super::test_dataframe::test_dataframe;

View File

@ -79,7 +79,7 @@ fn command(
.map(|df| PipelineData::Value(NuDataFrame::into_value(df, call.head), None))
}
#[cfg(test)]
#[cfg(explore_refactor_IntoDatetime)]
mod test {
use super::super::super::super::super::IntoDatetime;
use super::super::super::super::test_dataframe::test_dataframe;

View File

@ -79,7 +79,7 @@ fn command(
.map(|df| PipelineData::Value(NuDataFrame::into_value(df, call.head), None))
}
#[cfg(test)]
#[cfg(explore_refactor_IntoDatetime)]
mod test {
use super::super::super::super::super::IntoDatetime;
use super::super::super::super::test_dataframe::test_dataframe;

Some files were not shown because too many files have changed in this diff Show More