mypaint / mypaint

MyPaint is a simple drawing and painting program that works well with Wacom-style graphics tablets.
https://mypaint.app
GNU General Public License v2.0
2.64k stars 386 forks source link

Building: Rely on Python virtual environment instead of system python environment #1224

Closed AesaraB closed 5 months ago

AesaraB commented 6 months ago

Point of concern

In order to build MyPant, there will likely always be a requirement to make changes to the system/user environment through the installation of packages. All the same we want to reduce the number of moving parts, both in the OS, and in MyPaint's environment.

Suggested improvements

System python installations may be full of extraneous packages, use Python venv in the documentation instead.

Here's an example of a project that uses Python's virtual environment capabilities in the documentation

jtojnar commented 5 months ago

venv+pip are still full of moving parts, you just move where the stuff is moving. If you want more predicability, you will need something like Poetry.

But since we only depend on four Python libraries:

and the first half will need other libraries installed through the system package manager, installing the Python dependencies through non-system means would increase the amount of moving parts, not decrease it.

AesaraB commented 5 months ago

I agree with your comment, after I first started trying to test venv+pip I quickly came across these problems. Since then, I hadn't really known what to do with this issue.

In practice making the build environment portable is unnecessary. These days developers wanting that should containerise their building and testing workflow (which is easier than ever with tools like distrobox).

And, if we want more reproducible build environments, it's easier to just use NixOS in a container to do this.

A more productive use of time than addressing this (non) issue is to remove the tech debt from our build system.

I'm the one who opened this issue, and I see no need for it to remain open with the added context provided by your comment, as well as what I just stated in mine.

jtojnar commented 5 months ago

And, if we want more reproducible build environments, it's easier to just use NixOS in a container to do this.

If you want to go the Nix way, you do not even need containers – Nix will run on any Linux distro and MacOS.

It can be used for building very light Docker images, Appimages, Snaps. Or just for quickly getting some of thousands of tools that Nixpkgs provides out of the box.

Nixpkgs even supports cross-compilation to mingw2, if we want to target Windows but it currently does not have all the patches necessary to build GTK (and its dependencies) like msys2 has, so separate msys2 toolchain will still be needed, at least for now.

There is quite a lot to learn if you decide to go the Nix way. But both Nix and Meson have quite active and helpful community. I can help withe either too, if needed.

AesaraB commented 5 months ago

I appreciate your offer for help, no doubt I'll have some questions for these softwares as I learn more about them.

I think Nix is a wonder of technology as it stands, but my focus is on the application itself. I am competent in system administration, but I'm grateful that @odysseywestra is here to focus on that side of the project.