-
Notifications
You must be signed in to change notification settings - Fork 18
docs: Demonstrate CLI API over running module as script #195
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
matthewfeickert
wants to merge
3
commits into
scikit-hep:main
Choose a base branch
from
matthewfeickert:docs/use-cli
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
Changes from all commits
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
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -20,13 +20,13 @@ get larger files from common open-access data repositories. | |||||
| ## Installing and usage | ||||||
| To install: | ||||||
|
|
||||||
| ```bash | ||||||
| ``` | ||||||
| python -m pip install scikit-hep-testdata | ||||||
| ``` | ||||||
|
|
||||||
| Once installed, absolute file paths can be resolved using the helper methods: | ||||||
|
|
||||||
| ``` python | ||||||
| ```python | ||||||
| from skhep_testdata import data_path | ||||||
|
|
||||||
| filename = data_path("some_file.root") | ||||||
|
|
@@ -60,18 +60,38 @@ files. | |||||
| ### Command-line invocation | ||||||
| You can also interact with this package from the command-line: | ||||||
|
|
||||||
| ```bash | ||||||
| ``` | ||||||
| # Print a path (download if needed) | ||||||
| python -m skhep_testdata cms_hep_2012_tutorial/data.root | ||||||
| skhep-testdata cms_hep_2012_tutorial/data.root | ||||||
|
|
||||||
| # Show all "local" files | ||||||
| python -m skhep_testdata --list | ||||||
| skhep-testdata --list | ||||||
|
|
||||||
| # Download all files to an existing directory | ||||||
| python -m skhep_testdata --all --dir local | ||||||
| skhep-testdata --all --dir local | ||||||
| ``` | ||||||
|
|
||||||
| You can also use `pipx run scikit-hep-testdata` to access the above CLI without installing. | ||||||
| Note: The `scikit-hep-testdata` and `skhep-testdata` command-line tools are the equivalent of `python -m skhep_testdata`. | ||||||
|
|
||||||
| You can also use any of the following to access the above CLI without installing. | ||||||
|
|
||||||
| * uv: | ||||||
|
|
||||||
| ``` | ||||||
| uvx scikit-hep-testdata | ||||||
| ``` | ||||||
|
|
||||||
| * pipx: | ||||||
|
|
||||||
| ``` | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| pipx run scikit-hep-testdata | ||||||
| ``` | ||||||
|
|
||||||
| * Pixi: | ||||||
|
|
||||||
| ``` | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| pixi exec scikit-hep-testdata | ||||||
| ``` | ||||||
|
|
||||||
|
|
||||||
| ## Adding new files | ||||||
|
|
@@ -146,6 +166,6 @@ This project follows the [all-contributors](https://github.com/all-contributors/ | |||||
| This package uses `pytest` to run the unit tests. Install with `pip install scikit-hep-testdata[test]` or `pip install -e .[test]` (dev) to get the testing requirements. | ||||||
| then run: | ||||||
|
|
||||||
| ```bash | ||||||
| ``` | ||||||
| pytest | ||||||
| ``` | ||||||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bash syntax highlighting on GitHub looks the same as no syntax highlighting on GitHub if you aren't using explicit Bash commands. I would normally suggest
console, as that's more correct as people will be executing these in shells regardless of shell type, but that does change the syntax highlighting in a way that just converts all of it to a new color, which isn't very useful.Is there an advantage to selecting
bashhere? If no, should we change Scikit-HEP style recommendations?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess none of the three options are much better than the others.
skhep-testdata --all --dir localskhep-testdata --all --dir localBut to be consistent with the rest of the readme, it would be good to keep using
bashor switch everything else to either of the other options.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides consistency, it also adds context for LLMs even if it does not change visually on Github. I don't think
shvsbashvsconsolematters, except thatbashseems more common. Maybe all should be changed toconsolethen?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ariostas @APN-Pucky I think that this demonstrates why trying to apply a blanket default to every code block is not a reasonable approach.
bashmeans Bash code. A tool CLI is not Bash, and so thelocalis "correctly" incorrectly highlighted, aslocalis valid Bash keyword.consoleis a different color and looks strange because it is expecting to display a command at the prompt and the output, as can be seen in this exampleI do not find this to be a good argument. We should not be changing how we write human documentation for LLMs — that seems the wrong way round in terms of adaptation. It is reasonable to write different forms of docs if you want to cater to LLMs, but it would also provide incorrect context to label things as
bashorconsolewhen they're not.I'd prefer to move to removing syntax hints that do not correspond to the actual language in the block. Though if others would prefer other options I'd suggest moving this to a GitHub Issue for additional discussion and following up on the mailing list for GitHub org wide agreement.