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

"setuptools" and "pkg_resources" usage #417

Open
alessio-locatelli opened this issue Aug 11, 2024 · 4 comments
Open

"setuptools" and "pkg_resources" usage #417

alessio-locatelli opened this issue Aug 11, 2024 · 4 comments
Assignees
Labels
ENHANCEMENT ⚡ New Feature/Addition/Improvement PROPOSAL 📩 A proposal/proposition WORK IN PROGRESS 🚧 currently been worked on.
Milestone

Comments

@alessio-locatelli
Copy link

alessio-locatelli commented Aug 11, 2024

I want to discuss two things:

1. Expecting from pkg_resources import parse_version to be resolved may be a mistake.

Explanation:
from pkg_resources import parse_version requires setuptools, but setuptools is missing by default in Debian and Fedora Docker images.

Possible solutions:

  • Catch ImportError and do not check versions.
  • Document that a user must install setuptools manually on their side.
  • Add setuptools to the vidgear mandatory dependencies.
  • Do not depend on the parse_version function.

I can submit a PR, but I want to hear your opinion.

2. DeprecationWarning

>>> from pkg_resources import parse_version
<stdin>:1: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html

If in my first question you will decide to keep using this function, the import should be updated.

VidGear Version

0.3.3

Python version

3.12.4

Operating System version

fedora:40 Docker image

@alessio-locatelli alessio-locatelli added the QUESTION ❓ User asked about the working/usage of VidGear APIs. label Aug 11, 2024
Copy link

welcome bot commented Aug 11, 2024

Thanks for opening this issue, a maintainer will get back to you shortly!

In the meantime:

  • Read our Issue Guidelines, and update your issue accordingly. Please note that your issue will be fixed much faster if you spend about half an hour preparing it, including the exact reproduction steps and a demo.
  • Go comprehensively through our dedicated FAQ & Troubleshooting section.
  • For any quick questions and typos, please refrain from opening an issue, as you can reach us on Gitter community channel.

@abhiTronix abhiTronix added ENHANCEMENT ⚡ New Feature/Addition/Improvement WORK IN PROGRESS 🚧 currently been worked on. and removed QUESTION ❓ User asked about the working/usage of VidGear APIs. labels Aug 11, 2024
@abhiTronix abhiTronix added this to the v0.3.4 milestone Aug 11, 2024
@abhiTronix
Copy link
Owner

abhiTronix commented Aug 11, 2024

@olk-m Thank you for bringing up these important points regarding the use of setuptools and pkg_resources in VidGear.

Problem

You're correct that relying on pkg_resources.parse_version can cause issues in following cases

  • Minimal Docker images.
  • The pkg_resources is a deprecated
  • Extremely slow-to-import package
  • Only exists when setuptools is installed

Solution

Instead of adding a runtime dependency on setuptools, we should just use importlib.metadata from the stdlib. This is a more modern approach and part of the standard library since Python 3.8.

@abhiTronix abhiTronix added the PROPOSAL 📩 A proposal/proposition label Aug 11, 2024
@alessio-locatelli alessio-locatelli changed the title [Question]: "setuptools" and "pkg_resources" usage "setuptools" and "pkg_resources" usage Aug 11, 2024
@alessio-locatelli
Copy link
Author

alessio-locatelli commented Oct 6, 2024

@abhiTronix

Discussions are not enabled for this repository and I do not want to create too much noise by opening a new issue. I could contact you via email, but maybe this comment will be useful for someone.
Would you like to include a URL to the "vidgear in Docker" to the documentation?

There are two use cases:

  • a starting point for a new Docker app
  • a reproducible environment to report bugs so you can quickly reproduce them 🐛

In case you will need that, also added you as a collaborator.

@abhiTronix
Copy link
Owner

abhiTronix commented Oct 8, 2024

@alessio-locatelli Thanks for this great suggestion! This would indeed be valuable for developers using vidgear. I really appreciate your initiative in creating a setup and adding me as a collaborator.

Could you open a dedicated issue for this? It'll help us track and discuss the addition properly. Looking forward to working on this!

@abhiTronix abhiTronix self-assigned this Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ENHANCEMENT ⚡ New Feature/Addition/Improvement PROPOSAL 📩 A proposal/proposition WORK IN PROGRESS 🚧 currently been worked on.
Projects
None yet
Development

No branches or pull requests

2 participants