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

modernised python packaging #493

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

batmanfeynman
Copy link

@batmanfeynman batmanfeynman commented Dec 14, 2021

I have made a pyproject.toml file as well as a setup.cfg file which is compliant with the latest python packaging recommendations.
These changes help me in creating an rpm for fedora as well. I will make an rpm package for v1.6.9 by including a patch file, but i think this modernized python packaging will help in possible future installation from pip.

Edit: I have not checked whether this interferes with the appimage creation script. But this does work well with python -m build.

@Et0h Et0h requested a review from daniel-123 December 14, 2021 18:30
@daniel-123
Copy link
Contributor

daniel-123 commented Dec 14, 2021

AppImage seems to work just fine on my Debian and this doesn't touch any of the deb packages, so from my side that seems to be covered.

One thing that isn't is that your new method assumes that end user will always want the GUI. Which is reasonably fair assumption on a client, but not so much in case of headless servers. Do you have some ideas how to have an optional set of requirements? Preferably, but not necessarily while keeping the GUI libraries as default. See the #416 for broader discussion.

@batmanfeynman
Copy link
Author

The changes introduced in #416 is what i came up with basically (those changes can easily be translated to the setup.cfg file). But that results in the following setup:
pip install syncplay would install everything without the gui requirements.
pip install syncplay[GUI] would install the client gui as well.

i noticed that @FallenWarrior2k head searched for a way to make the GUI default and couldn't find one. I am inclined to believe them. But I will look around a bit more to see if it possible without any workarounds.

@FallenWarrior2k
Copy link

I believe the extras-based approach is blocked on pypa/setuptools#1139.

@batmanfeynman
Copy link
Author

Also to add some information, I tried to see if i could use a venv with pip to run the syncplay code on both a fresh ubuntu and Fedora VM.
Ubuntu:
Installing requirements with pip went well and it fetched pyside2 5.15.2. All good. But syncplay client wouldn't run and complained about some missing library. I had to install some package through apt to get it working from within the venv

Fedora:
I made a venv. pip install for some reason only installed pyside2 5.13.1 . This was throwing some error on the python code of syncplay. Installing the python-packages from fedora repos did not get rid of this error! But now that all the dependencies were installed, if i exit the venv, syncplay would work.

The reason i am pointing out my experience is to show that getting gui working with pip based install method probably wont be straighforward.

@daniel-123
Copy link
Contributor

The fact that pyside2 installed from pip doesn't bring with itself whole Qt seems obvious in hindsight and largely invalidates my original argument behind focusing on gui. Without that in the way, the dependency chain of PySide2 is nowhere near as huge and wouldn't really have much of a practical impact.

@batmanfeynman
Copy link
Author

But I do agree with @FallenWarrior2k in that having at least the headless server package easily available on pypi would be awfully convenient.

Maybe we can make just the server package available through PyPI?

@batmanfeynman
Copy link
Author

@daniel-123 I also want to point out that with this commit, all i have done is translate the old setup.py file to the new format. The behaviour is the same, as in the old setup.py file also assumed that the end user will always want the GUI client.

What I want to point out is that making syncplay avaialable on PyPI is not the primary objective of this pull request, but instead to make it easier to follow packaging guidelines in fedora for projects developed in python. I will make a copr repo by tomorrow for 1.6.9 and link it here

@albertosottile
Copy link
Member

Before staring the review, just FYI, PySide2 wheels contain their own copy of Qt. So, in principle, there should be no need to resort to apt to run Syncplay after installing it from Python sources. However, there are some combinations of OS-PySide2 versions for which other libraries are missing when doing so.

This is the case for Ubuntu 20.04.3 and PySide2 5.15.2, in which the library missing is libxcb-xinerama.so.0 (see https://askubuntu.com/a/1069502). I just reproduced this on a fresh Focal Fossa VM. IMHO, this is a bug that should be reported upstream to PySide2. However, I can see that they cannot possibly support every target available... (though they should keep an eye on Ubuntu).

In short, I would not consider impossible to install Syncplay with GUI from PyPi, provided that all the dependencies behave as they should. Nevertheless, I do not think that PyPI should be a supported distribution channel for this project, as we already have quite a few. We actually invest a lot of effort for providing binaries specifically prepared to avoid having to use the sources.

In addition, I do not see the benefits of PyPi over plain git for developers and enthusiasts that still want to run from sources, as Syncplay cannot be used as a dependency in other Python projects.

setup.cfg Outdated Show resolved Hide resolved
setup.cfg Outdated Show resolved Hide resolved
setup.cfg Outdated Show resolved Hide resolved
[options]
include_package_data = True
packages = find:
install_requires =
Copy link
Member

Choose a reason for hiding this comment

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

I am not a fan of duplicated information, and switching to PEP 621 without touching the requirements*.txt files does exactly that.

I would be in favor of deleting the requirement files, but currently the Windows build system relies on them. This could be circumvented by using pip-compile e.g. via

pip-compile --output-file requirements.txt setup.cfg

in the CI workflows before the file is actually needed.

On the other hand, we could retain the requirements files and start using them in the proper way: to pin dependencies for CI/release builds. We actually need to pin dependencies on macOS but, for the moment I did that in the workflow code (very bad, but I did not have a proper alternative up to now).

@Et0h @daniel-123 what is your opinion here?

Copy link
Contributor

Choose a reason for hiding this comment

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

@Et0h @daniel-123 what is your opinion here?

As someone who is a Windows user I don't have any strong opinions on packaging beyond the general desire for things to work and be low-maintenance.

Copy link
Contributor

Choose a reason for hiding this comment

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

Personally I'd prefer to avoid pinning dependencies to specific version unless strictly as rollback resulting from a bug in latest version of given dependency. At least as far as AppImage goes.

For OS packages - they just use what's on the OS, so pinning isn't really a useful concept in first place.

Copy link
Author

Choose a reason for hiding this comment

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

Hi @daniel-123 @albertosottile
I just wanted to remind you of this!

Copy link
Member

@albertosottile albertosottile Dec 12, 2022

Choose a reason for hiding this comment

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

@batmanfeynman Sorry if I neglected this. The gist of this issue is that in both Windows and macOS workflows we currently have:

pip3 install -r requirements.txt
pip3 install -r requirements_gui.txt

and I do not see a clear way to reproduce the same behavior after this PR is merged UNLESS the information about dependencies is duplicated in setup.cfg and in the two requirements file. Am I missing something here? Is there a command to just install the dependencies of a package?

@batmanfeynman
Copy link
Author

batmanfeynman commented Dec 15, 2021

Link to copr repo as promised:
https://copr.fedorainfracloud.org/coprs/batmanfeynman/syncplay/

I also want to suggest 3 modification to the syncplay.pl website:

  1. In this page under "Problems running Appimage of Syncplay on Fedora", the link to issue number PySide missing from AppImage of version 1.6.5 #355 is not present. Please fix this.
  2. Add the link to the copr page at the end of this page
  3. Maybe suggest using the rpm in my copr instead of the AppImage for now in the troubleshooting page

Edit: PS: I have no issue with it being mentioned that my rpm is unofficial :).

@soredake
Copy link
Contributor

@batmanfeynman can you please add support for fedora 36 in your repo?

@batmanfeynman
Copy link
Author

@soredake done!

@corbmr
Copy link

corbmr commented Dec 11, 2022

@batmanfeynman Would it possible to get fedora 37 added to your repo? Thank you for working on this!

@batmanfeynman
Copy link
Author

@corbmr done.

@albertosottile
Copy link
Member

General comment: the issue of having the GUI dependencies separate is not solved. I believe the vast majority of people that install from sources do that precisely because they do not want to have the GUI. Therefore, I do not think we can just merge this PR in a way that does not cover for this use case. Unless I am missing something, I think we need to keep the two separate requirements file, for the moment.

@Et0h
Copy link
Contributor

Et0h commented Dec 25, 2022

I also want to suggest 3 modification to the syncplay.pl website:

  1. In this page under "Problems running Appimage of Syncplay on Fedora", the link to issue number PySide missing from AppImage of version 1.6.5 #355 is not present. Please fix this.

Fixed.

  1. Add the link to the copr page at the end of this page

I've added it to https://copr.fedorainfracloud.org/coprs/batmanfeynman/syncplay/ and #574

  1. Maybe suggest using the rpm in my copr instead of the AppImage for now in the troubleshooting page

Done.

@VarLad
Copy link

VarLad commented May 24, 2023

@Et0h @batmanfeynman Any idea if you could update the COPR Fedora 38 (and possibly build for Rawhide) and update the version to the latest release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants