-
Notifications
You must be signed in to change notification settings - Fork 0
Add examples #1
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
Open
elijahpetty
wants to merge
3
commits into
main
Choose a base branch
from
add-example
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add examples #1
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Name,Score,Value,Category | ||
| Alice,85,120,A | ||
| Bob,92,150,B | ||
| Charlie,78,95,A |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Name,Score,Value,Category | ||
| Diana,88,110,C | ||
| Eve,95,180,B | ||
| Frank,72,85,A |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Name,Score,Value,Category | ||
| Grace,91,160,C | ||
| Henry,83,105,B | ||
| Iris,89,140,A | ||
| Jack,76,90,C |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| Name,Score,Value,Category | ||
| Alice,85,120,A | ||
| Bob,92,150,B | ||
| Charlie,78,95,A | ||
| Diana,88,110,C | ||
| Eve,95,180,B | ||
| Frank,72,85,A | ||
| Grace,91,160,C | ||
| Henry,83,105,B | ||
| Iris,89,140,A | ||
| Jack,76,90,C |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # My Deephaven CLI | ||
|
|
||
| A CLI-only package providing command-line tools for data processing with Deephaven. This package is designed to be installed and run as a command-line tool. | ||
|
|
||
| ## Installation | ||
|
|
||
| ```shell | ||
| pip install . | ||
| ``` | ||
|
|
||
| Or in editable mode for development: | ||
|
|
||
| ```shell | ||
| pip install -e . | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| > [!NOTE] | ||
| > CLI functions require a Deephaven server running in the same Python process. Use the functions within a Python session where the server is already started. | ||
|
|
||
| ```shell | ||
| pip install -e . | ||
| python | ||
| ``` | ||
|
|
||
| Then in Python: | ||
|
|
||
| ```python | ||
| # Start the Deephaven server | ||
| from deephaven_server import Server | ||
| server = Server(port=10000, jvm_args=["-Xmx4g"]) | ||
| server.start() | ||
|
|
||
| # Now use the CLI function | ||
| from my_dh_cli.cli import my_dh_query | ||
| result = my_dh_query("../data/sample.csv", verbose=True) | ||
| print(f"Processed {result.size} rows") | ||
| ``` | ||
|
|
||
| ## Commands | ||
|
|
||
| ### my-dh-query | ||
|
|
||
| Process a CSV file with Deephaven. | ||
|
|
||
| **Arguments:** | ||
| - `input_file` - Path to the CSV file to process | ||
|
|
||
| **Options:** | ||
| - `--verbose, -v` - Enable verbose output | ||
|
|
||
| ## Requirements | ||
|
|
||
| - Python 3.8 or later | ||
| - Deephaven Server 0.35.0 or later | ||
| - Click 8.0.0 or later |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| [build-system] | ||
| requires = ["setuptools>=61.0", "wheel"] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [project] | ||
| name = "my_dh_cli" | ||
| version = "0.1.0" | ||
| description = "Command-line tool for data processing" | ||
| readme = "README.md" | ||
| requires-python = ">=3.8" | ||
| dependencies = [ | ||
| "deephaven-server>=0.35.0", | ||
| "click>=8.0.0", | ||
| ] | ||
|
|
||
| [project.scripts] | ||
| my-dh-query = "my_dh_cli.cli:app" | ||
|
|
||
| [tool.setuptools.packages.find] | ||
| where = ["src"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| Metadata-Version: 2.4 | ||
| Name: my_dh_cli | ||
| Version: 0.1.0 | ||
| Summary: Command-line tool for data processing | ||
| Requires-Python: >=3.8 | ||
| Description-Content-Type: text/markdown | ||
| Requires-Dist: deephaven-server>=0.35.0 | ||
| Requires-Dist: click>=8.0.0 | ||
|
|
||
| # My Deephaven CLI | ||
|
|
||
| A CLI-only package providing command-line tools for data processing with Deephaven. This package is designed to be installed and run as a command-line tool. | ||
|
|
||
| ## Installation | ||
|
|
||
| ```shell | ||
| pip install . | ||
| ``` | ||
|
|
||
| Or in editable mode for development: | ||
|
|
||
| ```shell | ||
| pip install -e . | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| After installation, use the command-line tool: | ||
|
|
||
| ```shell | ||
| my-dh-query input_data.csv | ||
| my-dh-query input_data.csv --verbose | ||
| ``` | ||
|
|
||
| ### Module Execution | ||
|
|
||
| You can also run without installation using module execution: | ||
|
|
||
| ```shell | ||
| python -m my_dh_cli input_data.csv | ||
| ``` | ||
|
|
||
| ## Commands | ||
|
|
||
| ### my-dh-query | ||
|
|
||
| Process a CSV file with Deephaven. | ||
|
|
||
| **Arguments:** | ||
| - `input_file` - Path to the CSV file to process | ||
|
|
||
| **Options:** | ||
| - `--verbose, -v` - Enable verbose output | ||
|
|
||
| ## Requirements | ||
|
|
||
| - Python 3.8 or later | ||
| - Deephaven Server 0.35.0 or later | ||
| - Click 8.0.0 or later | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| README.md | ||
| pyproject.toml | ||
| src/my_dh_cli/__init__.py | ||
| src/my_dh_cli/__main__.py | ||
| src/my_dh_cli/cli.py | ||
| src/my_dh_cli.egg-info/PKG-INFO | ||
| src/my_dh_cli.egg-info/SOURCES.txt | ||
| src/my_dh_cli.egg-info/dependency_links.txt | ||
| src/my_dh_cli.egg-info/entry_points.txt | ||
| src/my_dh_cli.egg-info/requires.txt | ||
| src/my_dh_cli.egg-info/top_level.txt | ||
|
elijahpetty marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
|
|
||
|
elijahpetty marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [console_scripts] | ||
| my-dh-query = my_dh_cli.cli:app | ||
|
elijahpetty marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| deephaven-server>=0.35.0 | ||
| click>=8.0.0 | ||
|
elijahpetty marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| my_dh_cli | ||
|
elijahpetty marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| """My Deephaven package for data processing.""" | ||
|
|
||
| __version__ = "0.1.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| from my_dh_cli.cli import app | ||
|
|
||
| if __name__ == "__main__": | ||
| app() |
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import click | ||
|
|
||
|
|
||
| def my_dh_query(input_file: str, verbose: bool = False): | ||
| """Read a CSV file and perform a simple query operation on the data.""" | ||
| from deephaven import read_csv | ||
|
|
||
| if verbose: | ||
| click.echo(f"Processing {input_file}...") | ||
|
|
||
| source = read_csv(input_file) | ||
|
|
||
| result = source.update(formulas=["DoubleScore = Score * 2"]) | ||
|
elijahpetty marked this conversation as resolved.
|
||
|
|
||
| if verbose: | ||
| click.echo(f"Processed {result.size} rows") | ||
|
|
||
| return result | ||
|
|
||
|
|
||
| @click.command() | ||
| @click.argument("input_file", type=click.Path(exists=True)) | ||
| @click.option("--verbose", "-v", is_flag=True, help="Enable verbose output") | ||
| def app(input_file: str, verbose: bool) -> None: | ||
| """Process data with Deephaven.""" | ||
| result = my_dh_query(input_file, verbose) | ||
|
elijahpetty marked this conversation as resolved.
|
||
| click.echo("Processing complete!") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| app() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # My Deephaven Library | ||
|
|
||
| A library-only package providing reusable Deephaven query functions. This package contains no CLI tools - it's designed to be imported and used as a library in other Python projects. | ||
|
|
||
| ## Installation | ||
|
|
||
| ```shell | ||
| pip install . | ||
| ``` | ||
|
|
||
| Or in editable mode for development: | ||
|
|
||
| ```shell | ||
| pip install -e . | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| > [!NOTE] | ||
| > All Deephaven functionality requires a running server. Start the server before importing Deephaven modules. | ||
|
|
||
| Import and use the library functions in your Python code: | ||
|
|
||
| ```python | ||
| # Start the Deephaven server | ||
| from deephaven_server import Server | ||
| server = Server(port=10000, jvm_args=["-Xmx4g"]) | ||
| server.start() | ||
|
|
||
| # Now use the library functions | ||
| from my_dh_library.queries import filter_by_threshold, add_computed_columns | ||
| from deephaven import read_csv | ||
|
|
||
| data = read_csv("data.csv") | ||
| filtered = filter_by_threshold(data, "Score", 75.0) | ||
| enhanced = add_computed_columns(filtered) | ||
| ``` | ||
|
|
||
| ## Available Functions | ||
|
|
||
| ### Query Functions (`my_dh_library.queries`) | ||
|
elijahpetty marked this conversation as resolved.
|
||
|
|
||
| - `filter_by_threshold(table, column, threshold)` - Filter table rows where column value exceeds threshold | ||
| - `add_computed_columns(table)` - Add commonly used computed columns to a table | ||
| - `summarize_by_group(table, group_col, value_col)` - Create summary statistics grouped by a column | ||
|
|
||
| ### Utility Functions (`my_dh_library.utils`) | ||
|
elijahpetty marked this conversation as resolved.
|
||
|
|
||
| - `validate_columns(table, required_columns)` - Check if table has all required columns | ||
| - `get_table_info(table)` - Get basic information about a table | ||
|
|
||
| ## Requirements | ||
|
|
||
| - Python 3.8 or later | ||
| - Deephaven Server 0.35.0 or later | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| [build-system] | ||
| requires = ["setuptools>=61.0", "wheel"] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [project] | ||
| name = "my_dh_library" | ||
| version = "0.1.0" | ||
| description = "Reusable Deephaven query functions" | ||
| readme = "README.md" | ||
| requires-python = ">=3.8" | ||
| dependencies = [ | ||
| "deephaven-server>=0.35.0", | ||
| ] | ||
|
|
||
| [tool.setuptools.packages.find] | ||
| where = ["src"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| Metadata-Version: 2.4 | ||
| Name: my_dh_library | ||
| Version: 0.1.0 | ||
| Summary: Reusable Deephaven query functions | ||
| Requires-Python: >=3.8 | ||
| Description-Content-Type: text/markdown | ||
| Requires-Dist: deephaven-server>=0.35.0 | ||
|
|
||
| # My Deephaven Library | ||
|
|
||
| A library-only package providing reusable Deephaven query functions. This package contains no CLI tools - it's designed to be imported and used as a library in other Python projects. | ||
|
|
||
| ## Installation | ||
|
|
||
| ```shell | ||
| pip install . | ||
| ``` | ||
|
|
||
| Or in editable mode for development: | ||
|
|
||
| ```shell | ||
| pip install -e . | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| Import and use the library functions in your Python code: | ||
|
|
||
| ```python | ||
| from my_dh_library.queries import filter_by_threshold, add_computed_columns | ||
| from deephaven import read_csv | ||
|
|
||
| # Use the library functions | ||
| data = read_csv("data.csv") | ||
| filtered = filter_by_threshold(data, "Score", 75.0) | ||
| enhanced = add_computed_columns(filtered) | ||
| ``` | ||
|
|
||
| ## Available Functions | ||
|
|
||
| ### Query Functions (`my_dh_package.queries`) | ||
|
|
||
| - `filter_by_threshold(table, column, threshold)` - Filter table rows where column value exceeds threshold | ||
| - `add_computed_columns(table)` - Add commonly used computed columns to a table | ||
| - `summarize_by_group(table, group_col, value_col)` - Create summary statistics grouped by a column | ||
|
|
||
| ### Utility Functions (`my_dh_package.utils`) | ||
|
elijahpetty marked this conversation as resolved.
Outdated
elijahpetty marked this conversation as resolved.
Outdated
|
||
|
|
||
| - `validate_columns(table, required_columns)` - Check if table has all required columns | ||
| - `get_table_info(table)` - Get basic information about a table | ||
|
|
||
| ## Requirements | ||
|
|
||
| - Python 3.8 or later | ||
| - Deephaven Server 0.35.0 or later | ||
|
elijahpetty marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| README.md | ||
| pyproject.toml | ||
| src/my_dh_library/__init__.py | ||
| src/my_dh_library/queries.py | ||
| src/my_dh_library/utils.py | ||
| src/my_dh_library.egg-info/PKG-INFO | ||
| src/my_dh_library.egg-info/SOURCES.txt | ||
| src/my_dh_library.egg-info/dependency_links.txt | ||
| src/my_dh_library.egg-info/requires.txt | ||
| src/my_dh_library.egg-info/top_level.txt | ||
|
elijahpetty marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
|
|
||
|
elijahpetty marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| deephaven-server>=0.35.0 | ||
|
elijahpetty marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| my_dh_library | ||
|
elijahpetty marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| """My Deephaven package for data processing.""" | ||
|
|
||
| __version__ = "0.1.0" | ||
|
|
||
| from my_dh_library.queries import filter_by_threshold, add_computed_columns, summarize_by_group | ||
|
|
||
| __all__ = ["filter_by_threshold", "add_computed_columns", "summarize_by_group"] |
Binary file added
BIN
+427 Bytes
my_dh_library/src/my_dh_library/__pycache__/__init__.cpython-312.pyc
Binary file not shown.
Binary file not shown.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.