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

Allow usage of yt-dlp from a virtual environment #328

Closed
Oakchris1955 opened this issue Jun 9, 2024 · 3 comments · Fixed by #331
Closed

Allow usage of yt-dlp from a virtual environment #328

Oakchris1955 opened this issue Jun 9, 2024 · 3 comments · Fixed by #331
Labels
Feature Request Request for a new feature not yet implemented

Comments

@Oakchris1955
Copy link

It is currently possible to use an executable instead of the library API for downloading videos, under Preferences -> yt-dlp -> Use executable for downloads instead of API. From my understanding, even if this option is enabled, the program uses the system-installed yt-dlp for performing all other kinds of operations. My suggestion is to also add an option under Preferences -> yt-dlp to allow for the program to use the yt-dlp library from an external virtual environment. This would give more control to the user and make the program follow current recommendations from the Python Software Foundation, per PEP 668 and the Externally Managed Environments article from the Python Packaging User Guide

P.S. this could also prove a great opportunity to use a virtual environment for ALL the packages user by Videomass and thus negate the need to package them together in the binaries

@jeanslack jeanslack added the Feature Request Request for a new feature not yet implemented label Jun 10, 2024
@jeanslack
Copy link
Owner

jeanslack commented Jun 10, 2024

It is currently possible to use an executable instead of the library API for downloading videos, under Preferences -> yt-dlp -> Use executable for downloads instead of API. From my understanding, even if this option is enabled, the program uses the system-installed yt-dlp for performing all other kinds of operations.

Yes it's correct.

Consider that if you have a virtual environment activated you can enter the Python console and run videomass from there, like this:

from videomass import gui_app
gui_app.main()

This will allow you to use packages installed in the virtual environment without the need to install them system-wide.

My suggestion is to also add an option under Preferences -> yt-dlp to allow for the program to use the yt-dlp library from an external virtual environment. This would give more control to the user and make the program follow current recommendations from the Python Software Foundation, per PEP 668 and the Externally Managed Environments article from the Python Packaging User Guide

For this kind of thing you use pip. You can install videomass on as many virtual environments as you want independently.
This way there will be no conflicts with the peps you linked above.

That said, the option to externally import python package from the yt_dlp Source is planned and will be implemented on videomass using importlib. This will provide more control overall and I assume will satisfy your request as well.

@Oakchris1955
Copy link
Author

For this kind of thing you use pip. You can install videomass on as many virtual environments as you want independently.

What about packaged binaries, like those under Releases?

@jeanslack
Copy link
Owner

jeanslack commented Jun 11, 2024

Typically, Python binary packages created specifically to be installed using the package manager of Linux distributions (e.g apt, dpkg, dnf, rpm, urpmi, pacman, slackpkg, etc) install modules in the interpreter's default installation environment, for example /usr/lib/python3/dist-packages on debian/ubuntu. These binaries will use dependencies defined by operating system environment variables including modules in the dist-package and this is desirable.

However, this does not mean that you cannot import the modules installed on your virtual environment into the python applications installed on the system and this also applies to Videomass.

The situation changes for bundled Python applications such as Videomass portable edition for Windows.
Their purpose is to package the program and its dependencies into a single, self-contained package. The user can run the packaged app without installing a Python interpreter or any modules; In this case Videomass is entirely a point-and-click desktop application and it wouldn't make sense if it weren't.

I hope i was clear enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Request for a new feature not yet implemented
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants