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

pythonPackages.feedparser: 5.2.1 -> 6.0.1 #101635

Closed
wants to merge 7 commits into from

Conversation

delroth
Copy link
Contributor

@delroth delroth commented Oct 25, 2020

Motivation for this change

Feedparser 6.0.1 was released on Sept 15. The 6.x branch is not compatible with Python 2.x anymore.

I found two packages in nixpkgs that do not work with 6.x at this point, with no upstream fix for either of them. To minimize breakage, I've kept feedparser 5.2.1 (current version) in nixpkgs as pythonPackages.feedparser5. I don't feel strongly about this (anything that doesn't have a plan to support Py3k in 2020 is probably not actively maintained anyway...), let me know if you'd rather me remove the relevant commits and break the reverse dependencies.

I've also fixed the derivation to add a checkPhase.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • 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 nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@SuperSandro2000
Copy link
Member

Result of nixpkgs-review pr 101635 1

1 package marked as broken and skipped:
  • kmymoney
6 packages failed to build:
  • tangogps (foxtrotgps)
  • quodlibet
  • quodlibet-full
  • quodlibet-without-gst-plugins
  • quodlibet-xine
  • quodlibet-xine-full
21 packages built:
  • appdaemon
  • calibre
  • canto-curses
  • canto-daemon
  • flexget
  • gpodder
  • greg
  • pubs
  • python27Packages.feedparser5
  • python37Packages.feedparser
  • python37Packages.feedparser5
  • python37Packages.sgmllib3k
  • python37Packages.weboob
  • python38Packages.feedparser
  • python38Packages.feedparser5
  • python38Packages.sgmllib3k
  • python38Packages.weboob
  • sabnzbd
  • tartube
  • tribler
  • ytcc

@SuperSandro2000
Copy link
Member

I think they fails are unrelated to this PR:

wrapping `/nix/store/hzs5pfk5r3s3b4khrvcj83j7bmvirxmi-quodlibet-xine-full-4.2.1/bin/.operon-wrapped'...
Executing pythonRemoveTestsDir
Finished executing pythonRemoveTestsDir
@nix { "action": "setPhase", "phase": "installCheckPhase" }
running install tests
dbus[666]: Failed to start message bus: Failed to open "/etc/dbus-1/session.conf": No such file or directory
/build/quodlibet-4.2.1/quodlibet/formats/_audio.py:1019: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if profile is "none":
Gtk.init failed
/nix/store/3wsc5pi02dsbzbzyhrnm4a69xis42hn4-xvfb-run/bin/.xvfb-run-wrapped: line 186: kill: (657) - No such process
wrapping `/nix/store/7sf6fnkrkw4carhlaw2kf33q9n69ypis-quodlibet-full-4.2.1/bin/.operon-wrapped'...
Executing pythonRemoveTestsDir
Finished executing pythonRemoveTestsDir
@nix { "action": "setPhase", "phase": "installCheckPhase" }
running install tests
dbus[666]: Failed to start message bus: Failed to open "/etc/dbus-1/session.conf": No such file or directory
/build/quodlibet-4.2.1/quodlibet/formats/_audio.py:1019: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if profile is "none":
Gtk.init failed
/nix/store/3wsc5pi02dsbzbzyhrnm4a69xis42hn4-xvfb-run/bin/.xvfb-run-wrapped: line 186: kill: (657) - No such process

@delroth
Copy link
Contributor Author

delroth commented Oct 25, 2020

Note that the set of quodlibet packages is already broken at HEAD for an unrelated reason according to Hydra. tangogps builds fine locally, do you have a repro? (/nix/store/xldsw4rzp0scp19vbni6lw4bx5jwg68g-foxtrotgps-1.2.2)

Comment on lines 2034 to +2035
feedparser = callPackage ../development/python-modules/feedparser { };
feedparser5 = callPackage ../development/python-modules/feedparser/5.x.nix { }; # For Python 2.x compatibility.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
feedparser = callPackage ../development/python-modules/feedparser { };
feedparser5 = callPackage ../development/python-modules/feedparser/5.x.nix { }; # For Python 2.x compatibility.
feedparser = if isPy3k then
callPackage ../development/python-modules/feedparser { };
else
callPackage ../development/python-modules/feedparser/5.x.nix { };

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 looked into doing that, but there are other reasons to split off feedparser5 separately. For example, octoprint right now is Py3k compatible but their setup.py requires feedparser<6.

We could likely patch octoprint in place, I suspect that this <6 requirement is just there for safety against incompatible version bumps. I don't feel strongly either way. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would like to avoid having many version of the same package

Pinning within python-modules is highly discouraged. This will potentially introduce incompatible versions in a user's environment as either the new pinned version or the original version will be imported at runtime, breaking one of the packages.

The preference to handling this is to relax version bounds in the "install_requires" field. (could be in setup.py, pyproject.toml, requirements or others). In most cases, packages are still compatible with small API changes which may warrant a major version bump. We use test suites to verify that the package still works correctly.

If the package is still incompatible with the latest major version, then the most proper way to handle this is make an issue with the upstream package to adopt the latest major version. Or if upstream is not very responsive, you are free patch the source to make it compatible.

In very few circumstances, two versions of the same package are allowed to exist if the packages are extremely difficult to package. Some examples of this are tensorflow, which has huge ecosystems built around it and is hard to package. Another is django, which has 2 actively developed versions, and large ecosystems built around each.

One exception to this is applications, due to the way buildPythonApplication and toPythonApplication functions work, the related derivations will not bleed dependencies between packages. If the package doesn't need to be imported by other python modules, then this package would be a good candidate to convert into application. You can look at https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/admin/awscli/default.nix as an example of using an overlay within a python application.

Info on buildPythonApplication can be found here.
Info on toPythonApplication can be found here.

Comment on lines +23 to +25
};

}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
};
}
};
}

sha256 = "1s8jm3dgqabgf8x96931scji679qkhvczlv3qld4qxpsicfgns3q";
};

doCheck = false; # No tests.
Copy link
Contributor

Choose a reason for hiding this comment

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

If tests are not available, then please use pythonImportsCheck to import the most important modules. This isn't as good as unit tests, but will usually give a good indication of run-time errors. Please see pythonImportsCheck documentation for more information.

@@ -2032,6 +2032,7 @@ in {
feedgenerator = callPackage ../development/python-modules/feedgenerator { inherit (pkgs) glibcLocales; };

feedparser = callPackage ../development/python-modules/feedparser { };
feedparser5 = callPackage ../development/python-modules/feedparser/5.x.nix { }; # For Python 2.x compatibility.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
feedparser5 = callPackage ../development/python-modules/feedparser/5.x.nix { }; # For Python 2.x compatibility.
feedparser_5 = callPackage ../development/python-modules/feedparser/5.x.nix { }; # For Python 2.x compatibility.

Comment on lines 2034 to +2035
feedparser = callPackage ../development/python-modules/feedparser { };
feedparser5 = callPackage ../development/python-modules/feedparser/5.x.nix { }; # For Python 2.x compatibility.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would like to avoid having many version of the same package

Pinning within python-modules is highly discouraged. This will potentially introduce incompatible versions in a user's environment as either the new pinned version or the original version will be imported at runtime, breaking one of the packages.

The preference to handling this is to relax version bounds in the "install_requires" field. (could be in setup.py, pyproject.toml, requirements or others). In most cases, packages are still compatible with small API changes which may warrant a major version bump. We use test suites to verify that the package still works correctly.

If the package is still incompatible with the latest major version, then the most proper way to handle this is make an issue with the upstream package to adopt the latest major version. Or if upstream is not very responsive, you are free patch the source to make it compatible.

In very few circumstances, two versions of the same package are allowed to exist if the packages are extremely difficult to package. Some examples of this are tensorflow, which has huge ecosystems built around it and is hard to package. Another is django, which has 2 actively developed versions, and large ecosystems built around each.

One exception to this is applications, due to the way buildPythonApplication and toPythonApplication functions work, the related derivations will not bleed dependencies between packages. If the package doesn't need to be imported by other python modules, then this package would be a good candidate to convert into application. You can look at https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/admin/awscli/default.nix as an example of using an overlay within a python application.

Info on buildPythonApplication can be found here.
Info on toPythonApplication can be found here.

doCheck = false;
propagatedBuildInputs = [ sgmllib3k ];

checkPhase = "python tests/runtests.py";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
checkPhase = "python tests/runtests.py";
checkPhase = "${python.interpreter} tests/runtests.py";

support alternate interpreters

};

# lots of networking failures
doCheck = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
doCheck = false;
doCheck = false;

If tests are not available, then please use pythonImportsCheck to import the most important modules. This isn't as good as unit tests, but will usually give a good indication of run-time errors. Please see pythonImportsCheck documentation for more information.

@delroth
Copy link
Contributor Author

delroth commented Nov 19, 2020

Sorry, this is ending up being much more effort than I'm willing to put into a package version bump that I'm not even officially maintaining. I'll keep in mind some of the comments here for future Python derivations I might end up writing, but I don't think putting the burden on me to fix many instances of existing technical debt is fair when I'm just trying to get nixpkgs more up to date.

Closing this PR to avoid sitting on it forever and discouraging other folks from trying to own that problem themselves.

@delroth delroth closed this Nov 19, 2020
@jonringer
Copy link
Contributor

@delroth it's help mitigate users having broken packages at runtime. Sure, it's burdensome, and probably should have been included when initially added. But it's better to break during the build, than break at runtime.

Also, when doing mass package updates, it's either myself or @FRidh trying to stabilize the entire package set, E.g. #101636 . So, it's still important to have packages which demonstrate breakages during build.

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

4 participants