-
Notifications
You must be signed in to change notification settings - Fork 79
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
feat: ✨ bring pre-commit and tests from supervision #188
Conversation
Signed-off-by: Onuralp SEZER <[email protected]>
Signed-off-by: Onuralp SEZER <[email protected]>
This changes also require to lock python version to "py38" before merge this please consider this too. Saying "python 3" is very wide and 3.X(1-7) already EOL as well. |
Signed-off-by: Onuralp SEZER <[email protected]>
@onuralpszr Is there a way for you to submit this PR without all of the linting changes? I am happy to add a precommit, but this PR has a lot of merge conflicts in its current state. |
Let me revision and ping you |
fca20e8
to
fab9831
Compare
Signed-off-by: Onuralp SEZER <[email protected]>
fab9831
to
4272383
Compare
Signed-off-by: Onuralp SEZER <[email protected]>
f3776a2
to
d5ca74b
Compare
@capjamesg pre-commits are fixed and more tests added for make sure code is fine as well. |
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.
Looks good. I left one comment. It looks like this has formatted our long print statements to have multiple strings. Do the new strings appear as expected? My inline comment corresponds to one example.
Signed-off-by: Onuralp SEZER <[email protected]>
That multiple string formatting not create "new line unless we add \n" so it is fine. |
Thank you for the clarification. I have approved these changes and asked another team member to review, too. |
Sure please do, I also want to fix colab bug as well. as soon as this one merge, I will fix other bugs too. (I am holding because I don't wanna create conflicts) |
@capjamesg also please add this repo to here (https://pre-commit.ci/) for auto fixes and CI actions you can do before merge or after merge but doing before is better so you can also see in action too. |
@capjamesg @onuralpszr I went over the file changes and it really looks like this causes no change in runtime behaviour. |
Pre-commit is a framework for managing Git pre-commit hooks in a project. These hooks are scripts that run automatically before you commit any changes to your codebase. Their purpose is to catch potential issues in your code early on, preventing them from being pushed to the repository and potentially causing problems later. Advantages of using pre-commit:
Advantages of using pre-commit.ci website:
Lastly we do use pre-commit heavily in supervision project and make sure codebase is in same standard. Usage is also very easy pip install pre-commit
pre-commit run --all-files Install as git-hook locally in your clone repo pre-commit install |
Current run and result pre-commit run --all-files fix end of files.........................................................Passed
trim trailing whitespace.................................................Passed
check yaml...............................................................Passed
check docstring is first.................................................Passed
check that executables have shebangs.....................................Passed
check toml...............................................................Passed
check for case conflicts.................................................Passed
check for added large files..............................................Passed
detect private key.......................................................Passed
forbid new submodules................................(no files to check)Skipped
pretty format json.......................................................Passed
mixed line ending........................................................Passed
Sort imports.............................................................Passed
Flake8 Checks............................................................Passed
bandit...................................................................Passed
ruff.....................................................................Passed |
About [build-system]
requires = ["setuptools>=57", "wheel"]
build-backend = "setuptools.build_meta" I just added others config for pre-commit tools and it can automatically read from there |
So if I understand correctly, the pre-commit change will have no effect for folks that don't have it installed then? |
For people who install "pip install roboflow" / users has no effect.(they don't need to install) But for devs and contributors has to install for meet the pre-commit requirements. |
Right. I'm just thinking abou what happens to the dev env of a a dev who just does "git pull" on this and doesn't know about it. (and imo, at this time, "nothing changes" is exactly what we want: make it optional first, dogfood on it, and maybe later add it to the devenv setup with the devcontainer) |
If person never install yes not gonna enforce it but "CI" will enforce it |
I mean best we can do write in contribute guide and hopefully checks the toml and config files :) (I assume person is dev) |
For this change it needs enforce and add dev container upfront and run install hook so it will automatically will exist. |
OK I understand now. This doesn't force any change in the dev env, commits will still work. and may get fixed automatically like it did here... or the build will break if the code doesn't conform with the new rules. This can go in as is. It's an improvement. |
I guess headline pretty much tells everything, We already made successful in supervision. Maybe we can automate here to as well. No more manual linting if that is acceptable.