From bdaf0eb853ff79c16669e731a6cf8f77507ee0de Mon Sep 17 00:00:00 2001 From: rzmk <30333942+rzmk@users.noreply.github.com> Date: Thu, 20 Jun 2024 23:38:46 -0400 Subject: [PATCH 01/10] docs: add link to https://docs.rs/czv --- README.md | 2 +- czv-python/README.md | 2 +- czv-python/czv.pyi | 2 +- czv-wasm/README.md | 2 +- czv-wasm/src/lib.rs | 2 +- czv/README.md | 2 +- czv/src/lib.rs | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 183a4b3..9a189ab 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ czv includes libraries for Rust, Python, and WebAssembly (JavaScript and TypeScr ## Links - czv GitHub repository: -- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) +- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) ([docs](https://docs.rs/czv)) - WebAssembly (JavaScript/TypeScript): [npmjs.com/package/czv-wasm](https://www.npmjs.com/package/czv-wasm) ([source code](https://github.com/rzmk/czv/tree/main/czv-wasm)) - Python: [pypi.org/project/czv](https://pypi.org/project/czv/) ([source code](https://github.com/rzmk/czv/tree/main/czv-python)) diff --git a/czv-python/README.md b/czv-python/README.md index 284e5c9..db51388 100644 --- a/czv-python/README.md +++ b/czv-python/README.md @@ -5,7 +5,7 @@ Python library for [czv](https://github.com/rzmk/czv). czv is a library of CSV-r ## Links - czv GitHub repository: -- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) +- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) ([docs](https://docs.rs/czv)) - WebAssembly (JavaScript/TypeScript): [npmjs.com/package/czv-wasm](https://www.npmjs.com/package/czv-wasm) ([source code](https://github.com/rzmk/czv/tree/main/czv-wasm)) - Python: [pypi.org/project/czv](https://pypi.org/project/czv/) ([source code](https://github.com/rzmk/czv/tree/main/czv-python)) diff --git a/czv-python/czv.pyi b/czv-python/czv.pyi index ed45162..775c69e 100644 --- a/czv-python/czv.pyi +++ b/czv-python/czv.pyi @@ -27,7 +27,7 @@ print(output) # 4 ## Links - czv GitHub repository: -- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) +- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) ([docs](https://docs.rs/czv)) - WebAssembly (JavaScript/TypeScript): [npmjs.com/package/czv-wasm](https://www.npmjs.com/package/czv-wasm) ([source code](https://github.com/rzmk/czv/tree/main/czv-wasm)) - Python: [pypi.org/project/czv](https://pypi.org/project/czv/) ([source code](https://github.com/rzmk/czv/tree/main/czv-python)) diff --git a/czv-wasm/README.md b/czv-wasm/README.md index 6e5cbde..18ef562 100644 --- a/czv-wasm/README.md +++ b/czv-wasm/README.md @@ -5,7 +5,7 @@ WebAssembly (JavaScript and TypeScript) library for [czv](https://github.com/rzm ## Links - czv GitHub repository: -- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) +- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) ([docs](https://docs.rs/czv)) - WebAssembly (JavaScript/TypeScript): [npmjs.com/package/czv-wasm](https://www.npmjs.com/package/czv-wasm) ([source code](https://github.com/rzmk/czv/tree/main/czv-wasm)) - Python: [pypi.org/project/czv](https://pypi.org/project/czv/) ([source code](https://github.com/rzmk/czv/tree/main/czv-python)) diff --git a/czv-wasm/src/lib.rs b/czv-wasm/src/lib.rs index 286e831..54bb076 100644 --- a/czv-wasm/src/lib.rs +++ b/czv-wasm/src/lib.rs @@ -29,7 +29,7 @@ //! # Links //! //! - czv GitHub repository: -//! - Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) +//! - Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) ([docs](https://docs.rs/czv)) //! - WebAssembly (JavaScript/TypeScript): [npmjs.com/package/czv-wasm](https://www.npmjs.com/package/czv-wasm) ([source code](https://github.com/rzmk/czv/tree/main/czv-wasm)) //! - Python: [pypi.org/project/czv](https://pypi.org/project/czv/) ([source code](https://github.com/rzmk/czv/tree/main/czv-python)) diff --git a/czv/README.md b/czv/README.md index 5b73a3c..e0e38cd 100644 --- a/czv/README.md +++ b/czv/README.md @@ -5,7 +5,7 @@ Rust library for [czv](https://github.com/rzmk/czv). czv is a library of CSV-rel ## Links - czv GitHub repository: -- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) +- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) ([docs](https://docs.rs/czv)) - WebAssembly (JavaScript/TypeScript): [npmjs.com/package/czv-wasm](https://www.npmjs.com/package/czv-wasm) ([source code](https://github.com/rzmk/czv/tree/main/czv-wasm)) - Python: [pypi.org/project/czv](https://pypi.org/project/czv/) ([source code](https://github.com/rzmk/czv/tree/main/czv-python)) diff --git a/czv/src/lib.rs b/czv/src/lib.rs index 32e7969..05fd06f 100644 --- a/czv/src/lib.rs +++ b/czv/src/lib.rs @@ -33,7 +33,7 @@ //! # Links //! //! - czv GitHub repository: -//! - Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) +//! - Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) ([docs](https://docs.rs/czv)) //! - WebAssembly (JavaScript/TypeScript): [npmjs.com/package/czv-wasm](https://www.npmjs.com/package/czv-wasm) ([source code](https://github.com/rzmk/czv/tree/main/czv-wasm)) //! - Python: [pypi.org/project/czv](https://pypi.org/project/czv/) ([source code](https://github.com/rzmk/czv/tree/main/czv-python)) From ad526cc7173c55af8b487254464b1f8d9ed7bfa9 Mon Sep 17 00:00:00 2001 From: rzmk <30333942+rzmk@users.noreply.github.com> Date: Thu, 20 Jun 2024 23:48:28 -0400 Subject: [PATCH 02/10] docs: add docstring for `ColumnCountBuilder::execute` --- czv/src/count.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/czv/src/count.rs b/czv/src/count.rs index d00cb33..f84bb0b 100644 --- a/czv/src/count.rs +++ b/czv/src/count.rs @@ -207,6 +207,7 @@ impl< __file_path: typed_builder::Optional>, > ColumnCountBuilder<(__file_path, __file_data)> { + /// Returns the column count. pub fn execute(self) -> Result { let builder = self.__build(); column_count(builder.file_path, builder.file_data) From 4e62cc2ecdca74c03c056188bce4fa1271c713eb Mon Sep 17 00:00:00 2001 From: Mueez Khan <30333942+rzmk@users.noreply.github.com> Date: Fri, 21 Jun 2024 00:19:44 -0400 Subject: [PATCH 03/10] docs: fix Rust example to use `include_header_row` --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9a189ab..642569c 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,11 @@ apple,2.50 banana,3.00 strawberry,1.50 "; - let output: usize = RowCount::new().file_data(data).execute()?; - println!("{output}"); // 3 + let output: usize = RowCount::new() + .file_data(data) + .include_header_row(true) + .execute()?; + println!("{output}"); // 4 Ok(()) } ``` From 254e34fe053081062b3e4f8628db94ef9e0c92ce Mon Sep 17 00:00:00 2001 From: Mueez Khan <30333942+rzmk@users.noreply.github.com> Date: Fri, 21 Jun 2024 01:18:45 -0400 Subject: [PATCH 04/10] docs: remove links to non-existent files --- czv/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/czv/README.md b/czv/README.md index e0e38cd..022987f 100644 --- a/czv/README.md +++ b/czv/README.md @@ -67,9 +67,9 @@ For benchmarks we use [criterion.rs](https://github.com/bheisler/criterion.rs). Licensed under either of - Apache License, Version 2.0 - ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) + (http://www.apache.org/licenses/LICENSE-2.0) - MIT license - ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) + (http://opensource.org/licenses/MIT) at your option. From 55835772ed365aa7eec47bb047b9ae1265fd714e Mon Sep 17 00:00:00 2001 From: Mueez Khan <30333942+rzmk@users.noreply.github.com> Date: Fri, 21 Jun 2024 01:32:09 -0400 Subject: [PATCH 05/10] docs: fix czv-wasm node-demo --- czv-wasm/examples/node-demo/sample.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/czv-wasm/examples/node-demo/sample.ts b/czv-wasm/examples/node-demo/sample.ts index f969962..8197c19 100644 --- a/czv-wasm/examples/node-demo/sample.ts +++ b/czv-wasm/examples/node-demo/sample.ts @@ -1,3 +1,5 @@ +// See the README.md file in this file's folder +// for how to run this example import czv from "../../pkg/czv-ts"; const options: czv.RowCountOptions = { @@ -5,6 +7,7 @@ const options: czv.RowCountOptions = { apple,2.50 banana,3.00 strawberry,1.50`, + include_header_row: true }; const output: number = czv.rowCount(options); From 719f3e1512ef6a3e3d3cca07a665b8763dddf7fb Mon Sep 17 00:00:00 2001 From: rzmk <30333942+rzmk@users.noreply.github.com> Date: Fri, 21 Jun 2024 05:52:34 -0400 Subject: [PATCH 06/10] docs: comment slice docstring while disabled --- czv/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/czv/src/lib.rs b/czv/src/lib.rs index 05fd06f..fcf36c8 100644 --- a/czv/src/lib.rs +++ b/czv/src/lib.rs @@ -41,7 +41,7 @@ pub mod count; #[doc(inline)] pub use count::{ColumnCount, RowCount}; -/// Extract a section of rows. +// Extract a section of rows. // pub mod slice; // #[doc(inline)] // pub use slice::Slice; From 358fe0a8b92ed2e29f2a9dcc5326419db3b4099c Mon Sep 17 00:00:00 2001 From: rzmk <30333942+rzmk@users.noreply.github.com> Date: Fri, 21 Jun 2024 23:30:44 -0400 Subject: [PATCH 07/10] test: add row count with header --- czv-wasm/tests/count.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/czv-wasm/tests/count.rs b/czv-wasm/tests/count.rs index d0b8164..4c858c2 100644 --- a/czv-wasm/tests/count.rs +++ b/czv-wasm/tests/count.rs @@ -6,7 +6,7 @@ wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); #[test] #[wasm_bindgen_test] -fn basic() -> Result<()> { +fn row_count_nonheader() -> Result<()> { let options = RowCountOptions { file_data: "fruit,price apple,2.00 @@ -19,3 +19,19 @@ strawberry,3.00" assert_eq!(result, 3); Ok(()) } + +#[test] +#[wasm_bindgen_test] +fn row_count_header() -> Result<()> { + let options = RowCountOptions { + file_data: "fruit,price +apple,2.00 +banana,1.50 +strawberry,3.00" + .to_string(), + include_header_row: Some(true), + }; + let result = czv_wasm::count::row_count(options)?; + assert_eq!(result, 4); + Ok(()) +} From 1e7c4a1569ec07a0a7aa2fe29eaf6057aef9e030 Mon Sep 17 00:00:00 2001 From: rzmk <30333942+rzmk@users.noreply.github.com> Date: Sat, 22 Jun 2024 08:38:00 -0400 Subject: [PATCH 08/10] test(wasm): add `column_count` --- czv-wasm/tests/count.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/czv-wasm/tests/count.rs b/czv-wasm/tests/count.rs index 4c858c2..7b04e7a 100644 --- a/czv-wasm/tests/count.rs +++ b/czv-wasm/tests/count.rs @@ -1,5 +1,5 @@ use czv_wasm; -use czv_wasm::count::RowCountOptions; +use czv_wasm::count::{ColumnCountOptions, RowCountOptions}; use czv_wasm::Result; use wasm_bindgen_test::*; wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); @@ -35,3 +35,18 @@ strawberry,3.00" assert_eq!(result, 4); Ok(()) } + +#[test] +#[wasm_bindgen_test] +fn column_count() -> Result<()> { + let options = ColumnCountOptions { + file_data: "fruit,price +apple,2.00 +banana,1.50 +strawberry,3.00" + .to_string(), + }; + let result = czv_wasm::count::column_count(options)?; + assert_eq!(result, 2); + Ok(()) +} From 5b8c057e5d3b7d0459383b77a3078e8bc3144ebc Mon Sep 17 00:00:00 2001 From: rzmk <30333942+rzmk@users.noreply.github.com> Date: Tue, 25 Jun 2024 21:19:24 -0400 Subject: [PATCH 09/10] test(python): rename tests & add column count test --- czv-python/tests/test_count.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/czv-python/tests/test_count.py b/czv-python/tests/test_count.py index c796835..e5b2f9a 100644 --- a/czv-python/tests/test_count.py +++ b/czv-python/tests/test_count.py @@ -2,12 +2,12 @@ import czv import pytest from .test_data import test_data -class TestCountFunc: +class TestRowCount: @pytest.mark.parametrize( "file_name,expected", [("fruits.csv", 3), ("constituents_altnames.csv", 33971)], ) - def test_count(self, file_name, expected): + def test_row_count(self, file_name, expected): """Count the total number of non-header rows.""" result = czv.row_count(file_path=test_data[file_name]) @@ -17,8 +17,19 @@ class TestCountFunc: "file_name,expected", [("fruits.csv", 4), ("constituents_altnames.csv", 33972)], ) - def test_include_header_row(self, file_name, expected): + def test_row_count_include_header_row(self, file_name, expected): """Count the total number of rows including the header row.""" result = czv.row_count(file_path=test_data[file_name], include_header_row=True) assert result == expected + +class TestColumnCount: + @pytest.mark.parametrize( + "file_name,expected", + [("fruits.csv", 2), ("constituents_altnames.csv", 6)], + ) + def test_column_count(self, file_name, expected): + """Count the total number of columns.""" + + result = czv.column_count(file_path=test_data[file_name]) + assert result == expected From fa02eddc1e607b8fdb11e7938ca03d2d7c7ca735 Mon Sep 17 00:00:00 2001 From: Mueez Khan <30333942+rzmk@users.noreply.github.com> Date: Fri, 7 Mar 2025 06:57:15 -0500 Subject: [PATCH 10/10] chore: delete .github/FUNDING.yml --- .github/FUNDING.yml | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index baa721a..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -github: [rzmk]