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

Python-kivy: init at 1.10.0 #29305

Closed
wants to merge 2 commits into from
Closed

Conversation

vanschelven
Copy link
Contributor

Motivation for this change

Kivy is an Open source Python library for rapid development of applications
that make use of innovative user interfaces, such as multi-touch apps.

Most of Kivy's dependencies are optional, so defining a good "default" set of useful dependencies was a bit of a challenge. The present set of dependencies works well for me, but more dependencies, or even options for configuring the package, may be required in the future.

There is also some discussion at kivy/kivy#5367

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

buildPythonPackage rec {
name = "Kivy-1.10.0";

src = pkgs.fetchurl {
Copy link
Member

Choose a reason for hiding this comment

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

fetchPypi


propagatedBuildInputs = with self; [
pillow
pkgs.mtdev
Copy link
Member

Choose a reason for hiding this comment

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

Why is this library propagated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a mistake; I thought that would be helpful, but the actual fix was found later (https://groups.google.com/forum/#!topic/nix-devel/CPQKpM3u1EY), and I never downgraded to non-propagated. Will fix.

@@ -11176,6 +11176,29 @@ in {

keyring = callPackage ../development/python-modules/keyring { };

kivy = callPackage ../development/python-modules/kivy { inherit stdenv buildPythonPackage maintainers platforms licenses pkgs self ; };

kivygarden = buildPythonPackage rec {
Copy link
Member

Choose a reason for hiding this comment

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

in separate file

# assert stdenv.lib.versionOlder self.cython.version "0.25.3";

buildPythonPackage rec {
name = "Kivy-1.10.0";
Copy link
Member

Choose a reason for hiding this comment

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

can you include pname, version, and ${pname}-${version} as is now more commonly done.

# The sole reason for this package is that it is a (questionable) dependency of Kivy
name = "kivy-garden-0.1.4";

src = pkgs.fetchurl {
Copy link
Member

Choose a reason for hiding this comment

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

fetchPypi


kivygarden = buildPythonPackage rec {
# The sole reason for this package is that it is a (questionable) dependency of Kivy
name = "kivy-garden-0.1.4";
Copy link
Member

Choose a reason for hiding this comment

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

same with pname and version

sha256 = "0wkcpr2zc1q5jb0bi7v2dgc0vs5h1y7j42mviyh764j2i0kz8mn2";
};

buildInputs = with self; [ requests ];
Copy link
Member

Choose a reason for hiding this comment

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

Is this not needed during runtime? Or is it needed for the tests? In case of the latter, use checkInputs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's needed during runtime.

kivy-garden is a "not invented here" package manager for kivy components, and as such uses requests to fetch those components.

The real problem is that such a thing exists in the first place, and that it is an explicit dependency of Kivy. I'll talk with the kivy people about both of those issues.

In the meantime, given the fact that the present PR makes kivy-garden available, it should do so in a non-broken way, so I'll promote this to a propagatedBuildInput

As per the comments by @FRidh
(once no more questions/remarks remain, I'll squash the commits into a single one)
@@ -0,0 +1,101 @@
{ stdenv, buildPythonPackage, fetchPypi, maintainers, platforms, licenses, pkgs, self }:
Copy link
Member

Choose a reason for hiding this comment

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

parameters are supposed to be individual functions or derivations, and not sets. Exceptions are stdenv or lib.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm having some trouble implementing this advice, and associated advice on given repeatedly below on how to remove the associated explicit parameter-setting on the calling side. Could you show me how it's done?


buildInputs = with self; [
pkgconfig
cython
Copy link
Member

Choose a reason for hiding this comment

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

these two can be nativeBuildInputs if I am correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not confident that I understand the difference (see https://groups.google.com/forum/#!topic/nix-devel/Ad1b0RShe6k) and all other Python packages that I could find do in fact use buildInputs here, so I'm a bit wary to proceed with this tip. Feel free to correct me if you're sure about this behavior though.

kivygarden # See https://github.com/kivy/kivy/issues/5367 suggestion I-2
requests # See https://github.com/kivy/kivy/issues/5367 suggestion I-3
docutils # See https://github.com/kivy/kivy/issues/5367 question Q-5
pygments # See https://github.com/kivy/kivy/issues/5367 question Q-6
Copy link
Member

Choose a reason for hiding this comment

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

Are these 4 only needed during build time? Or during runtime? If the latter -> propagatedBuildInputs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Regarding docutils: purely build time.

Regarding the rest: setup.py refuses to install without these packages present, but they are fundamentally optional and (in the case of kivygarden especially) it's undesirable to pollute the runtime environment too much with their presence. If someone e.g. want the pygments functionality at runtime, it's better to have them install this explicitly than to "pull in the world"

In short, I stand with the decision to have them be build time dependencies, but it's a bit of a judgement call.

# https://kivy.org/docs/installation/installation.html
# https://kivy.org/docs/installation/installation-linux.html

pkgs.mesa
Copy link
Member

Choose a reason for hiding this comment

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

get rid of pkgs

@@ -0,0 +1,25 @@
# The sole reason for this package is that it is a (questionable) dependency of Kivy
{ buildPythonPackage, fetchPypi, maintainers, platforms, licenses, pkgs, self }:
Copy link
Member

Choose a reason for hiding this comment

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

same as the other

homepage = "https://pypi.python.org/pypi/kivy-garden";
license = licenses.mit;
maintainers = with maintainers; [ vanschelven ];
platforms = platforms.unix; # Can only test linux; in principle other platforms are supported
Copy link
Member

Choose a reason for hiding this comment

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

buildPythonPackage already sets platforms

homepage = "https://pypi.python.org/pypi/kivy";
license = licenses.mit;
maintainers = with maintainers; [ vanschelven ];
platforms = platforms.unix; # I can only test linux; in principle other platforms are supported
Copy link
Member

Choose a reason for hiding this comment

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

buildPythonPackage already sets platforms

@@ -11176,6 +11176,10 @@ in {

keyring = callPackage ../development/python-modules/keyring { };

kivy = callPackage ../development/python-modules/kivy { inherit stdenv buildPythonPackage fetchPypi maintainers platforms licenses pkgs self ; };
Copy link
Member

Choose a reason for hiding this comment

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

callPackage will populate the arguments automatically

@vanschelven
Copy link
Contributor Author

@FRidh I've responded in the above remarking that I'm not confident enough in my knowledge of Nix packaging to push forwards from here. Any chance you could implement your own remarks/requests so that we can push this PR forward and get it accepted?

@vanschelven
Copy link
Contributor Author

I'm closing this pull request; it no longer works against the current version of master, and updating is non-trivial at the moment. I might reopen a similar request at a later point in time.

@FRidh FRidh mentioned this pull request Oct 10, 2019
@rissson rissson mentioned this pull request Nov 23, 2020
10 tasks
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.

None yet

2 participants