-
Notifications
You must be signed in to change notification settings - Fork 441
feat: enhanced lab check
to make local linting easier
#621
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
Conversation
cc @deanwampler |
Hi, is this linting the CLI's Python code? #515 was intended to implement linting of the |
Yup this is for the Python code but I see your point - let me see about extending this to cover linting those YAML files as well 👍 |
@ckadner I wonder if we might be able to turn the raw Shell code in that lint action in |
Some potential concerns about linting the python code through lab lint:
|
I tried to address some of these concerns in my followup commit:
Other changes I made here:
|
I recommend the following changes:
|
I'm fine with this approach, but I'm going to see if we can get some weigh-in from the project maintainers to ensure this is the direction we're all fine going with since it'll require removal of some functionality from this PR (we should probably then open a separate issue for creating a |
First impression is that it's very confusing because "lab lint" would be expected to be only for "users" not at all like tox lint/fmt for devs. Looking deeper, I see you could hide some of that with --dev flag, but let's go back to "it's confusing to users" and just not do that. Devs can use tox. Nice work (thank you), but feels a little misplaced for the user experience when mixing in dev stuff. |
Also curious why we need a Makefile? I don't mind them, but I've seen them removed from projects and we have There's some benefit in keeping it minimum defacto standards (and that could include make but ? )
|
That was only a suggestion. It would let a CLI developer type |
@nathan-weinberg Should this be part of the |
CLI linting Python code came from me, but seems the general consensus here is to move away from that. Not looking to add any workflows here, but I think what @deanwampler was saying in his original issue (feel free to step in Dean if I'm mistaken) was that he wanted a way to do the equivalent linting being done by the Taxonomy repo Lint action locally from the CLI. |
lab lint
to make local linting easierlab check
to make local linting easier
Updated the PR to remove the Python linting and move the basic YAML checking into the existing |
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'd like to see this more backwards compatible. Not sure this would break anyone/anywhere but I've been burned by that lately. It's not a protected API.
Along with that there's an unnecessary change in the KeyError exception that makes that error useful (I think) and isn't necessary to remove that.
Squashed commits to ease rebasing |
I am no maintainer, but code LGTM, except for the linting issues that point to duplicated imports. Please fix those first. Also, I'd suggest splitting the update of the |
Those are fixed now - this should be going in today so updating the labeler here should be fine. Thanks for reviewing! |
cc @xukai92 |
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.
Left some comments, thanks for adding the tests @nathan-weinberg.
I think it'll help to keep only related changes in this PR (ie changes related to lab check). It'll help review the PR if the extra comments are removed, thank you!
@nathan-weinberg could you un-resolve the comments you didn't address please. It's helpful to have the either have the conversation and let the commenter resolve, or ignore it too but let other reviewers say "this comment doesn't matter much so resolving" instead of the author resolving it themselves. Copying the highest priority comment here that's been resolved without addressing:
Yea my bad, I placed that comment in the wrong place (I wanna say it's because there were so many other unrelated changes like the code comments that I had to go through, that the review process got derailed, but for the sake of moving things along, let's go with "it's my bad") But I hope my comment is clear. Let me phrase it in another way: Quality testing this PR
|
Holding this PR for now @xukai92, might help to have another look, maybe I'm missing something in the setup that Nathans is suggesting here. |
@anik120 All comments were addressed, not sure what you're referring to but seems you had some issues with your review - let's sync over this in-person |
not sure why functional tests are failing. can you try rebasing with main? |
I did a rebase with main for you to see if this fixes tests. |
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 have found and fixed this issue (needed an additional +2024-03-22 12:21:29 ./scripts/functional-tests.sh:222: test_generate
+2024-03-22 12:21:29 ./scripts/functional-tests.sh:189: test_generate(): cat -
+2024-03-22 12:21:29 ./scripts/functional-tests.sh:199: test_generate(): sed -i -e 's/num_instructions:.*/num_instructions: 1/g' config.yaml
+2024-03-22 12:21:29 ./scripts/functional-tests.sh:202: test_generate(): timeout 5m lab generate --taxonomy-path simple_math.yaml
INFO 2024-03-22 12:21:32,938 lab.py:423 Generating model 'merlinite-7b-Q4_K_M' using 10 cpus, taxonomy: 'simple_math.yaml' and seed 'seed_tasks.json' against http://localhost:28711/v1 server
WARNING 2024-03-22 12:21:32,952 generate_data.py:544 Cannot find yaml_rules.yaml. Using default rules.
Cannot find prompt.txt. Using default prompt.
Synthesizing new instructions. If you aren't satisfied with the generated instructions, interrupt training (Ctrl-C) and try adjusting your YAML files. Adding more examples may help.
0%| | 0/1 [00:00<?, ?it/s]INFO 2024-03-22 12:21:32,958 generate_data.py:378 Selected taxonomy path
Q> calculate the total cost when each book is $10.
I> <noinput>
3 items
A> The total cost is $30
Q> poll
find out the average age in a group consisting of three people aged 21,24,28 respectively.
I>
A> The average age is 24.33 years old.
2it [01:06, 33.19s/it] INFO 2024-03-22 12:22:39,335 generate_data.py:463 Generation took 66.40s
2it [01:06, 33.19s/it]
+2024-03-22 12:22:39 ./scripts/functional-tests.sh:205: test_generate(): ls -l generated/generated_merlinite-7b-Q4_K_M_2024-03-22T11_46_07.json generated/generated_merlinite-7b-Q4_K_M_2024-03-22T12_07_37.json generated/generated_merlinite-7b-Q4_K_M_2024-03-22T12_16_53.json generated/generated_merlinite-7b-Q4_K_M_2024-03-22T12_21_32.json generated/test_merlinite-7b-Q4_K_M_2024-03-22T11_46_07.jsonl generated/test_merlinite-7b-Q4_K_M_2024-03-22T12_07_37.jsonl generated/test_merlinite-7b-Q4_K_M_2024-03-22T12_16_53.jsonl generated/test_merlinite-7b-Q4_K_M_2024-03-22T12_21_32.jsonl generated/train_merlinite-7b-Q4_K_M_2024-03-22T11_46_07.jsonl generated/train_merlinite-7b-Q4_K_M_2024-03-22T12_07_37.jsonl generated/train_merlinite-7b-Q4_K_M_2024-03-22T12_16_53.jsonl generated/train_merlinite-7b-Q4_K_M_2024-03-22T12_21_32.jsonl
-rw-r--r--. 1 nathan nathan 229 Mar 22 11:47 generated/generated_merlinite-7b-Q4_K_M_2024-03-22T11_46_07.json
-rw-r--r--. 1 nathan nathan 806 Mar 22 12:09 generated/generated_merlinite-7b-Q4_K_M_2024-03-22T12_07_37.json
-rw-r--r--. 1 nathan nathan 596 Mar 22 12:18 generated/generated_merlinite-7b-Q4_K_M_2024-03-22T12_16_53.json
-rw-r--r--. 1 nathan nathan 581 Mar 22 12:22 generated/generated_merlinite-7b-Q4_K_M_2024-03-22T12_21_32.json
-rw-r--r--. 1 nathan nathan 552 Mar 22 11:47 generated/test_merlinite-7b-Q4_K_M_2024-03-22T11_46_07.jsonl
-rw-r--r--. 1 nathan nathan 552 Mar 22 12:09 generated/test_merlinite-7b-Q4_K_M_2024-03-22T12_07_37.jsonl
-rw-r--r--. 1 nathan nathan 552 Mar 22 12:18 generated/test_merlinite-7b-Q4_K_M_2024-03-22T12_16_53.jsonl
-rw-r--r--. 1 nathan nathan 552 Mar 22 12:22 generated/test_merlinite-7b-Q4_K_M_2024-03-22T12_21_32.jsonl
-rw-r--r--. 1 nathan nathan 304 Mar 22 11:47 generated/train_merlinite-7b-Q4_K_M_2024-03-22T11_46_07.jsonl
-rw-r--r--. 1 nathan nathan 881 Mar 22 12:09 generated/train_merlinite-7b-Q4_K_M_2024-03-22T12_07_37.jsonl
-rw-r--r--. 1 nathan nathan 750 Mar 22 12:18 generated/train_merlinite-7b-Q4_K_M_2024-03-22T12_16_53.jsonl
-rw-r--r--. 1 nathan nathan 735 Mar 22 12:22 generated/train_merlinite-7b-Q4_K_M_2024-03-22T12_21_32.jsonl
++2024-03-22 12:22:39 ./scripts/functional-tests.sh:206: test_generate(): jq '. | length'
+++2024-03-22 12:22:39 ./scripts/functional-tests.sh:206: test_generate(): tail -n 1
+++2024-03-22 12:22:39 ./scripts/functional-tests.sh:206: test_generate(): ls -tr generated/generated_merlinite-7b-Q4_K_M_2024-03-22T11_46_07.json generated/generated_merlinite-7b-Q4_K_M_2024-03-22T12_07_37.json generated/generated_merlinite-7b-Q4_K_M_2024-03-22T12_16_53.json generated/generated_merlinite-7b-Q4_K_M_2024-03-22T12_21_32.json
++2024-03-22 12:22:39 ./scripts/functional-tests.sh:206: test_generate(): cat generated/generated_merlinite-7b-Q4_K_M_2024-03-22T12_21_32.json
+2024-03-22 12:22:39 ./scripts/functional-tests.sh:206: test_generate(): '[' 2 -lt 1 ']' |
Adds yaml linting to `lab check' Adds tests for `lab check' 'create-untracked' func can now write byte strings Signed-off-by: Nathan Weinberg <nweinber@redhat.com>
Which issue is resolved by this Pull Request:
Resolves #515
Description of your changes:
edited from original: for context originally created
lab lint
command that linted CLI Python code via toxcreate-untracked()
func can now write byte stringsAlso fixes incorrect version pin for Labeler action