nushell/crates
Matthias Meschede 966cebec34
Adds polars list-contains command (#15304)
# Description

This  PR adds the `polars list-contains` command. It works like this:

```
~/Projects/nushell/nushell> let df = [[a]; [[a,b,c]] [[b,c,d]] [[c,d,f]]] | polars into-df -s {a: list<str>};
~/Projects/nushell/nushell> $df | polars with-column [(polars col a | polars list-contains (polars lit a) | polars as b)] | polars collect
╭───┬───────────┬───────╮
│ # │     a     │   b   │
├───┼───────────┼───────┤
│ 0 │ ╭───┬───╮ │ true  │
│   │ │ 0 │ a │ │       │
│   │ │ 1 │ b │ │       │
│   │ │ 2 │ c │ │       │
│   │ ╰───┴───╯ │       │
│ 1 │ ╭───┬───╮ │ false │
│   │ │ 0 │ b │ │       │
│   │ │ 1 │ c │ │       │
│   │ │ 2 │ d │ │       │
│   │ ╰───┴───╯ │       │
│ 2 │ ╭───┬───╮ │ false │
│   │ │ 0 │ c │ │       │
│   │ │ 1 │ d │ │       │
│   │ │ 2 │ f │ │       │
│   │ ╰───┴───╯ │       │
╰───┴───────────┴───────╯
```

or 

```
~/Projects/nushell/nushell> let df = [[a, b]; [[a,b,c], a] [[b,c,d], f] [[c,d,f], f]] | polars into-df -s {a: list<str>, b: str}
~/Projects/nushell/nushell> $df | polars with-column [(polars col a | polars list-contains b | polars as c)] | polars collect
╭───┬───────────┬───┬───────╮
│ # │     a     │ b │   c   │
├───┼───────────┼───┼───────┤
│ 0 │ ╭───┬───╮ │ a │ true  │
│   │ │ 0 │ a │ │   │       │
│   │ │ 1 │ b │ │   │       │
│   │ │ 2 │ c │ │   │       │
│   │ ╰───┴───╯ │   │       │
│ 1 │ ╭───┬───╮ │ f │ false │
│   │ │ 0 │ b │ │   │       │
│   │ │ 1 │ c │ │   │       │
│   │ │ 2 │ d │ │   │       │
│   │ ╰───┴───╯ │   │       │
│ 2 │ ╭───┬───╮ │ f │ true  │
│   │ │ 0 │ c │ │   │       │
│   │ │ 1 │ d │ │   │       │
│   │ │ 2 │ f │ │   │       │
│   │ ╰───┴───╯ │   │       │
╰───┴───────────┴───┴───────╯
```

or

```
~/Projects/nushell/nushell> let df = [[a, b]; [[1,2,3], 4] [[2,4,1], 2] [[2,1,6], 3]] | polars into-df -s {a: list<i64>, b: i64}
~/Projects/nushell/nushell> $df | polars with-column [(polars col a | polars list-contains ((polars col b) * 2) | polars as c)] | polars collect
╭───┬───────────┬───┬───────╮
│ # │     a     │ b │   c   │
├───┼───────────┼───┼───────┤
│ 0 │ ╭───┬───╮ │ 4 │ false │
│   │ │ 0 │ 1 │ │   │       │
│   │ │ 1 │ 2 │ │   │       │
│   │ │ 2 │ 3 │ │   │       │
│   │ ╰───┴───╯ │   │       │
│ 1 │ ╭───┬───╮ │ 2 │ true  │
│   │ │ 0 │ 2 │ │   │       │
│   │ │ 1 │ 4 │ │   │       │
│   │ │ 2 │ 1 │ │   │       │
│   │ ╰───┴───╯ │   │       │
│ 2 │ ╭───┬───╮ │ 3 │ true  │
│   │ │ 0 │ 2 │ │   │       │
│   │ │ 1 │ 1 │ │   │       │
│   │ │ 2 │ 6 │ │   │       │
│   │ ╰───┴───╯ │   │       │
╰───┴───────────┴───┴───────╯
```

Let me know what you think. I'm a bit surprised that a list by default
seems to get converted to "object" when doing `into-df` which is why I
added the extra `-s` flag every time to explicitly force it into a list.
2025-03-12 08:25:03 -07:00
..
nu_plugin_custom_values Rework operator type errors (#14429) 2025-02-12 20:03:40 -08:00
nu_plugin_example Bump to 0.102.1 dev version (#15012) 2025-02-05 00:19:48 -05:00
nu_plugin_formats Bump to 0.102.1 dev version (#15012) 2025-02-05 00:19:48 -05:00
nu_plugin_gstat Bump to 0.102.1 dev version (#15012) 2025-02-05 00:19:48 -05:00
nu_plugin_inc Bump to 0.102.1 dev version (#15012) 2025-02-05 00:19:48 -05:00
nu_plugin_nu_example Bump to 0.102.1 dev version (#15012) 2025-02-05 00:19:48 -05:00
nu_plugin_polars Adds polars list-contains command (#15304) 2025-03-12 08:25:03 -07:00
nu_plugin_python Bump to 0.102.1 dev version (#15012) 2025-02-05 00:19:48 -05:00
nu_plugin_query update query json help and examples (#15190) 2025-02-26 09:15:14 -06:00
nu_plugin_stress_internals Bump to 0.102.1 dev version (#15012) 2025-02-05 00:19:48 -05:00
nu-cli Include symlinks in directory completions (#15268) 2025-03-12 08:13:41 -05:00
nu-cmd-base Bump to 0.102.1 dev version (#15012) 2025-02-05 00:19:48 -05:00
nu-cmd-extra Refactor/fix tests affecting the whole command set (#15073) 2025-02-11 11:36:36 +01:00
nu-cmd-lang fix $env.FILE_PWD and $env.CURRENT_FILE inside overlay use (#15126) 2025-03-05 21:13:44 +02:00
nu-cmd-plugin Refactor/fix tests affecting the whole command set (#15073) 2025-02-11 11:36:36 +01:00
nu-color-config Rework operator type errors (#14429) 2025-02-12 20:03:40 -08:00
nu-command Parse XML documents with DTDs by default, and add --disallow-dtd flag (#15272) 2025-03-12 08:09:55 -05:00
nu-derive-value Use proc-macro-error2 instead of proc-macro-error (#15093) 2025-02-11 15:13:34 -05:00
nu-engine check signals in nu-glob and ls (#15140) 2025-02-28 19:36:39 +01:00
nu-explore fix: new clippy warnings from rust 1.85.0 (#15203) 2025-02-27 14:11:47 +01:00
nu-glob check signals in nu-glob and ls (#15140) 2025-02-28 19:36:39 +01:00
nu-json fix: new clippy warnings from rust 1.85.0 (#15203) 2025-02-27 14:11:47 +01:00
nu-lsp fix(lsp): find_id for custom def in custom def (#15289) 2025-03-12 07:35:28 -05:00
nu-parser Fix unterminated loop in parse_record (#15246) 2025-03-05 21:02:03 +01:00
nu-path Bump to 0.102.1 dev version (#15012) 2025-02-05 00:19:48 -05:00
nu-plugin Bump to 0.102.1 dev version (#15012) 2025-02-05 00:19:48 -05:00
nu-plugin-core Replaced IoError::new_with_additional_context calls that still had Span::unknown() (#15056) 2025-02-08 09:23:28 -06:00
nu-plugin-engine Rework operator type errors (#14429) 2025-02-12 20:03:40 -08:00
nu-plugin-protocol make plugin compatible with nightly nushell version (#15084) 2025-02-11 06:40:15 -06:00
nu-plugin-test-support Bump to 0.102.1 dev version (#15012) 2025-02-05 00:19:48 -05:00
nu-pretty-hex bugfix: math commands now return error with infinite range [#15135] (#15236) 2025-03-11 14:40:26 +01:00
nu-protocol Parse XML documents with DTDs by default, and add --disallow-dtd flag (#15272) 2025-03-12 08:09:55 -05:00
nu-std refactor: tree-sitter-nu friendly alternative expressions (#15301) 2025-03-12 08:48:19 -05:00
nu-system Jobs (#14883) 2025-02-25 12:09:52 -05:00
nu-table Bump to 0.102.1 dev version (#15012) 2025-02-05 00:19:48 -05:00
nu-term-grid Bump to 0.102.1 dev version (#15012) 2025-02-05 00:19:48 -05:00
nu-test-support fix(test-support): use CARGO_BUILD_TARGET_DIR env var (#15212) 2025-02-28 20:08:44 +01:00
nu-utils Add filesize.show_unit config option (#15276) 2025-03-09 17:34:55 -05:00
nuon Custom command attributes (#14906) 2025-02-11 06:34:51 -06:00
README.md Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00

Nushell core libraries and plugins

These sub-crates form both the foundation for Nu and a set of plugins which extend Nu with additional functionality.

Foundational libraries are split into two kinds of crates:

  • Core crates - those crates that work together to build the Nushell language engine
  • Support crates - a set of crates that support the engine with additional features like JSON support, ANSI support, and more.

Plugins are likewise also split into two types:

  • Core plugins - plugins that provide part of the default experience of Nu, including access to the system properties, processes, and web-connectivity features.
  • Extra plugins - these plugins run a wide range of different capabilities like working with different file types, charting, viewing binary data, and more.