Skip to content
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

Require opencv-python-headless by default #130

Closed
2 tasks done
fabito opened this issue Jun 12, 2023 · 7 comments · Fixed by #180
Closed
2 tasks done

Require opencv-python-headless by default #130

fabito opened this issue Jun 12, 2023 · 7 comments · Fixed by #180
Assignees
Labels
enhancement New feature or request version: 0.12.0 Feature to be added in `0.12.0` release

Comments

@fabito
Copy link

fabito commented Jun 12, 2023

Search before asking

  • I have searched the Supervision issues and found no similar feature requests.

Description

Installing supervision indirectly installs opencv-python package as a dependency.
It would be nice to make it optional or replace opencv-python by opencv-python-headless.

Use case

For production inference environments we usually don't want/need to install/depend on GUI packages and libraries.

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@fabito fabito added the enhancement New feature or request label Jun 12, 2023
@github-actions
Copy link
Contributor

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

@SkalskiP SkalskiP self-assigned this Jun 12, 2023
@SkalskiP
Copy link
Collaborator

Hi, @fabito 👋🏻! That will be awesome for example if you want to limit the size of your Docker image. I definitely think it is a good move.

The next question is how do we implement this? We could add headless into extras_require but this way it will install opencv-python first and then opencv-python-headless. Do you have better ideas?

install_requires=[
    'numpy>=1.20.0',
    'opencv-python',  # this will install by default
    'matplotlib',
    'pyyaml'
],
extras_require={
    'dev': [
        'flake8',
        'black==22.3.0',
        'isort',
        'twine',
        'pytest',
        'wheel',
        'notebook',
        'mkdocs-material',
        'mkdocstrings[python]'
    ],
    'headless': ['opencv-python-headless'],  # extra for environments without GUI
},

@fabito
Copy link
Author

fabito commented Jun 13, 2023

A new extra sounds like a good route.
I am not sure if we can exclude a package when a specific extra is specified though. I did a quick research and apparently that is not possible ? Needs further investigation.

@SkalskiP
Copy link
Collaborator

I guess the alternative is to build two separate pip packages, supervision and supervision-headless, using two different setup.py files.

@sanmai-NL
Copy link

Why use a setup.py at all in 2023? I'd expect you to use a PEP 621 pyproject.toml. For this issue, using optional dependencies.

@SkalskiP
Copy link
Collaborator

SkalskiP commented Jul 4, 2023

Hi, @sanmai-NL 👋🏻! It looks like I'm already lagging behind the latest Python dev trends. We started working on a migration from setup.py to project.toml, but got distracted by other features. I'll make sure to revive this idea.

@SkalskiP
Copy link
Collaborator

SkalskiP commented Jul 4, 2023

@onuralpszr would be awesome if you could propose some solution that would work 🔥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request version: 0.12.0 Feature to be added in `0.12.0` release
Projects
Archived in project
3 participants