Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

pyproject.toml, pre-commit, ruff, uv and typing issues, fixes #1119 #1120

Merged
merged 19 commits into from
Feb 27, 2025

Conversation

Dronakurl
Copy link
Contributor

@Dronakurl Dronakurl commented Feb 7, 2025

It looks big, but there is a lot of typing stuff, unneeded imports, etc, that can easily be seen doesn't change anything.
I added comments at the files that have noteworthy changes like bugs found from type checking.

Best way to start reading is pyproject.toml. Here you can see that ruff is used and the dependencies are defined.

The exisiting ci.yml pretended to run on different OS types, but actually did only run 3 times on ubuntu.
In this first step, I did not try to fix this.

Often I found syntax like x: int = None. I replaced it with x: Optional[int] = None so the type checker in my IDE (I used pyright) found cases where the code did not handle the None case. I fixed some of the issues around that.

What still confuses me in base.py is this: Is _object_prediction_list_per_image a list or a list of lists.
I figured that it could be both, so I defined a type for that.

With uv pre-commit install, you now have ruff pre-commits, that will do the equivalent of isort, black and flake.

Please tell me what you think

@Dronakurl Dronakurl force-pushed the ruff2 branch 2 times, most recently from 406ec72 to 5c8ad45 Compare February 9, 2025 00:25
@Dronakurl
Copy link
Contributor Author

Dronakurl commented Feb 9, 2025

The "build" workflow went through, you can have a look.
Open tasks for me:

  • Why does huggingface get different inference results?
  • package_testing workflow (maybe integrate into one workflow with different triggers)
  • deepsparse does not work for V3.8-3.9 yet with my version
  • pypi publish with uv (first to test-pypi)

optional

  • improve the readme for contributions
  • improve the explanations for list or list of lists in base.py
  • type checking continued

@fcakyon
Copy link
Collaborator

fcakyon commented Feb 9, 2025

Thanks for the great PR @Dronakurl !

Since there is 9000+ lines of changes (not only styling but critical code changes as well), GIthub Review UI is crashing 😅 and it might take weeks for me to review it.

It would be faster if you could separate this large PR (dependency change, workflow changes, project structure change, typo fixes, code logic changes) into smaller single purpose PRs.

For instance if I know the changes in a PR are only styling updates, I can review those lines faster but with current form, I have to go over each line to see if its a logical update or styling update.

It's up to you, I can review both ways, please let me know which way you want to move forward (split this PR into smaller PRs or keep it this way).

@fcakyon fcakyon added documentation Improvements or additions to documentation enhancement New feature or request workflows ci/cd workflows cli labels Feb 9, 2025
@fcakyon fcakyon self-requested a review February 9, 2025 12:19
@Dronakurl
Copy link
Contributor Author

Dronakurl commented Feb 9, 2025 via email

@Dronakurl
Copy link
Contributor Author

Dronakurl commented Feb 9, 2025 via email

@fcakyon
Copy link
Collaborator

fcakyon commented Feb 9, 2025

Because looking at the function, it reverts to cpu anyway. fatih akyon

Then you found an existing bug 😅

@fcakyon
Copy link
Collaborator

fcakyon commented Feb 9, 2025

Of course, and they are still there! I am using pytest and the dependencies for ci are defined in pyproject.toml fatih akyon

Dependencies are OK, but pytest tests are not running. Only the CLI tests are running 🤔 https://github.com/obss/sahi/actions/runs/13220591930/job/36915618246?pr=1120

@Dronakurl Dronakurl force-pushed the ruff2 branch 2 times, most recently from e9770de to c6c9ad6 Compare February 16, 2025 22:31
@Dronakurl Dronakurl marked this pull request as ready for review February 16, 2025 22:53
@Dronakurl Dronakurl closed this Feb 16, 2025
@Dronakurl Dronakurl reopened this Feb 16, 2025
@Dronakurl
Copy link
Contributor Author

I think, the PR is now ready for a final review.
I edited according to your comments on the draft and fixed the CI.
"package_testing" and "publish" workflows work on uv now, too (package_testing is included in ci.yml)

@fcakyon
Copy link
Collaborator

fcakyon commented Feb 19, 2025

@Dronakurl, thanks a lot for all the work you put in!

Please add your profile/name to the contributor's list in the readme between Kadir Nar and Burak Maden 🤗

@fcakyon fcakyon added this pull request to the merge queue Feb 27, 2025
Merged via the queue into obss:main with commit 4a11b02 Feb 27, 2025
5 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
cli documentation Improvements or additions to documentation enhancement New feature or request workflows ci/cd workflows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants