histoprint icon indicating copy to clipboard operation
histoprint copied to clipboard

add --field-prefix via click.option and update doc

Open YeungOnion opened this issue 2 years ago • 7 comments

added option proposed in scikit-hep/histoprint #121


add --field-prefix via click.option adding this option modifies kwargs which causes later errors opting to delete this key, to fix root cause in later pr

implement behavior of --field-prefix option uses click callback on the field option to handle this.

updated docs to include help text for --field-prefix option

remove type annotations One of these type annotations was actually incorrect, but I noticed that they weren't used in this file. Opted to remove instead of fix

YeungOnion avatar Nov 27 '23 17:11 YeungOnion

Hi! Thanks a lot for this PR. Could you add a test of this feature to .github/workflows/pythontests.yml? To make sure it keeps working in the future.

ast0815 avatar Nov 28 '23 12:11 ast0815

If github isn't notifying here, does that mean that all tests passed? If so, then I think I got it right.

YeungOnion avatar Nov 28 '23 17:11 YeungOnion

If you look at the output of the tests (e.g. by clicking on the green checkmark next to the latest commit). you will see that it did not actually run your test defined in the tests.py file. That is because the test function names need to start with test_ in order to be discovered and run.

I would expect the test to fail, since you do ask for the field wo before setting the prefix t. The first field should be two, and that should check that the prefix does indeed only apply to fields after it.

You can also run pytest locally before pushing to test things.

ast0815 avatar Nov 28 '23 18:11 ast0815

Could you also remove the newlines from the option help text, so it behaves like the others, and also make the docstring of your test function follow the convention of the others?

ast0815 avatar Nov 28 '23 18:11 ast0815

I opted to ignore positional information, but didn't include that in the help doc, so I updated that along with the requests.

YeungOnion avatar Nov 28 '23 18:11 YeungOnion

As you can see, the tests fail now: https://github.com/scikit-hep/histoprint/actions/runs/7023198492/job/19109160857?pr=124

Aside from fixing that, you also need to add the added option to the CHANGELOG.md. Just put it as a bullet point under

## [Unreleased]

### Added

ast0815 avatar Nov 29 '23 10:11 ast0815

Realized that click did not work the way I expected, but I think keeping it all in the decorators isn't worth the complexity. So it'll be implemented as a few lines in main - which may have always been the best bet. Now running pytest locally and all tests are passing.

YeungOnion avatar Nov 30 '23 05:11 YeungOnion