Skip to content

Conversation

onuralpszr
Copy link
Contributor

Description

feat: introduce pyproject.toml and pre-commit file
feat: toml file uses poetry as a dependency management and packaging system
feat: pre-commit added. It can be use with git hooks for checks

Extra notes

  • Latest poetry have new package check system cause issue on debugpy (debugpy people already know this so waiting for their side to fix)
  • It is possible to turn off that feature so debugpy can be install properly without check
  • Latest packages also force me to use higher version of python so I may need to reduce this version bit more and flexible on versions

I also found that some of the lines pass way more than 88 lines and there is no new line at the end of line in files. I did not add those changes yet but I can do if it is gets accepted.

While I was doing migration work, I also want to hear your opinion as well, please let me know and thank you.

List any dependencies that are required for this change.

Type of change

  • New feature (non-breaking change which adds functionality)

How has this change been tested, please provide a testcase or example of how you tested the change?

Install poetry and run

poetry install
pre-commit run --all-files

Any specific deployment considerations

For example, documentation changes, usability, usage/costs, secrets, etc.

pre-commit config required on repository settings for automatic pre-commit pr and and pre-commit github actions

feat: toml file uses poetry as a dependency management and packaging system
feat: pre-commit added. It can be use with git hooks for checks

Signed-off-by: Onuralp SEZER <[email protected]>
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello there, thank you for opening an PR ! 🙏🏻 The team was notified and they will get back to you asap.

@SkalskiP
Copy link
Collaborator

Hi, @onuralpszr 👋🏻! I underestimated you. Thank you very much for taking the time. This was the first time I would use this setup so on this occasion I have some questions.

Questions

  1. What is the upside of pyproject.toml over setup.py?
  2. What is the upside of poetry over pip?
  3. Can we use pre-commit with the current project configuration? Namely without migrating to poetry?

Notes

Latest packages also force me to use higher version of python so I may need to reduce this version bit more and flexible on versions

We really would like to keep the current Python version requirement. Problem is that very Computer Vision projects are slow when it comes to adopting new versions.

I also found that some of the lines pass way more than 88 lines and there is no new line at the end of line in files.

Was that actually code or comments?

@onuralpszr
Copy link
Contributor Author

onuralpszr commented Mar 29, 2023

Hello;

Let me answering your questions with possible source links as well.

1 - I do use pyproject.toml over setup.py because it is more modern and easy to manage for me. I do not need requirement.txt and I can set version or can put between versions also I can do all of my check configs and so many other functionally inside that toml file.

There is an also pep link about that so it can give also more idea about as well.
python pep link : https://peps.python.org/pep-0518/

2- I use Poetry because It can manage pyproject and install packages so basically manage pip and setup.py in 1 command line also it has ability to check package versions. I can use something else for packahing like "hatchling" but it just personal choice and I do use a lot personal and in business it is very much useful tool. I can also specify python version when I create venv and has more control over my project. Technically I use pip indirectly but it still useful and worth file give it a shot. Plus toml file is bigger advantage because you have sections and more cleaner and have more options as well. You can also do publish and build via poetry directly as well.

3- pre-commit does not require poetry it is a standalone tool you can use it just needs configs and pre-commit can fetch that from "toml" file or we can put all inside the pre-commit yml. Also "toml" file can be created differently like I said early on like "hatchling" so it is technically need a "toml" file in that case not the "poetry". Poetry is manage toml/add package/publish/build / can be extended (via plugins) and since it is a toml file pre-commit and use that as well.

For example If you check fastapi project you can see they also use toml file but they prefer to use "hatchling" so for pre-commit it needs a place to read "configs" can be pyproject.toml or can be inside of it own config or you can create config for each tool like "black config file, yapf config file etc..."

For that last part If you run pre-commit run --all-files you can see changes and it will show you what is the problem and gives you very detailed result plus it does to automatic fixes you can apply them as well.

UPDATE-2

pypa/pip#8559 (pypa/pip want us to use pyproject.toml by default instead of old setup.py)

@SkalskiP
Copy link
Collaborator

Hi, @onuralpszr 👋🏻! Sorry, I get distracted by other important stuff. Still, want to contribute? I hope 🙏🏻

@onuralpszr
Copy link
Contributor Author

Hi, @onuralpszr 👋🏻! Sorry, I get distracted by other important stuff. Still, want to contribute? I hope 🙏🏻

Yes I want to do it. I answered your questions so please let me know how do you want to proceed it.know. So I can do more work on it. I stopped a bit because of your questions.

@SkalskiP SkalskiP added the version: 0.12.0 Feature to be added in `0.12.0` release label Jul 4, 2023
@onuralpszr
Copy link
Contributor Author

I am closing this PR in favor of the following PR: #180. I will introduce pre-commit in a separate PR.

cc @SkalskiP

@onuralpszr onuralpszr closed this Jul 4, 2023
@SkalskiP
Copy link
Collaborator

SkalskiP commented Jul 4, 2023

Awesome @onuralpszr! 🔥 I got a bit overwhelmed with open issues and PRs before the supervision-0.12.0 release. So anything we don't use and can close, makes me happy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
version: 0.12.0 Feature to be added in `0.12.0` release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants