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

python312Packages.nose: fix build #325968

Merged
merged 17 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions pkgs/applications/graphics/hydrus/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ python3Packages.buildPythonPackage rec {
twisted
];

# tests rely on nose
doCheck = pythonOlder "3.12";

nativeCheckInputs = with python3Packages; [
nose
mock
Expand Down
3 changes: 0 additions & 3 deletions pkgs/development/python-modules/actdiag/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ buildPythonPackage rec {

propagatedBuildInputs = [ blockdiag ];

# tests rely on nose
doCheck = pythonOlder "3.12";

nativeCheckInputs = [
nose
pytestCheckHook
Expand Down
4 changes: 0 additions & 4 deletions pkgs/development/python-modules/biopandas/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ buildPythonPackage rec {
looseversion
];

# tests rely on nose
# resolved in 0.5.1: https://github.com/BioPandas/biopandas/commit/67aa2f237c70c826cd9ab59d6ae114582da2112f
doCheck = pythonOlder "3.12";

nativeCheckInputs = [
nose
pytestCheckHook
Expand Down
3 changes: 0 additions & 3 deletions pkgs/development/python-modules/blockdiag/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ buildPythonPackage rec {
webcolors
];

# tests rely on nose
doCheck = pythonOlder "3.12";

nativeCheckInputs = [
ephem
nose
Expand Down
4 changes: 0 additions & 4 deletions pkgs/development/python-modules/hkdf/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
lib,
buildPythonPackage,
fetchFromGitHub,
pythonOlder,
nose,
setuptools,
}:
Expand All @@ -23,9 +22,6 @@ buildPythonPackage {

pythonImportsCheck = [ "hkdf" ];

# tests rely on nose
doCheck = pythonOlder "3.12";

nativeCheckInputs = [ nose ];

checkPhase = ''
Expand Down
4 changes: 0 additions & 4 deletions pkgs/development/python-modules/lockfile/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
setuptools,
pbr,
nose,
pythonOlder,
}:

buildPythonPackage rec {
Expand All @@ -23,9 +22,6 @@ buildPythonPackage rec {
setuptools
];

# tests rely on nose
doCheck = pythonOlder "3.12";

nativeCheckInputs = [ nose ];

checkPhase = ''
Expand Down
576 changes: 576 additions & 0 deletions pkgs/development/python-modules/nose/0001-nose-python-3.12-fixes.patch

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions pkgs/development/python-modules/nose/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,25 @@
isPy3k,
isPyPy,
python,
pythonAtLeast,
python312,
coverage,
setuptools,
}:

buildPythonPackage rec {
version = "1.3.7";
format = "setuptools";
pname = "nose";

# unmaintained, relies on the imp module
disabled = pythonAtLeast "3.12";
pyproject = true;

src = fetchPypi {
inherit pname version;
sha256 = "f1bffef9cbc82628f6e7d7b40d7e255aefaa1adb6a1b1d26c69a8b79e6208a98";
};

# 2to3 was removed in setuptools 58
build-system = [ setuptools ];

patches = lib.optional isPy3k [ ./0001-nose-python-3.12-fixes.patch ];

postPatch = ''
substituteInPlace setup.py \
--replace "'use_2to3': True," ""
Expand All @@ -31,8 +32,9 @@ buildPythonPackage rec {
--replace "from setuptools.command.build_py import Mixin2to3" "from distutils.util import Mixin2to3"
'';

preBuild = lib.optionalString (isPy3k) ''
${python.pythonOnBuildForHost}/bin/2to3 -wn nose functional_tests unit_tests
# 2to3 is removed from Python 3.13, so always use Python 3.12 2to3 for now.
preBuild = lib.optionalString isPy3k ''
${python312.pythonOnBuildForHost}/bin/2to3 -wn nose functional_tests unit_tests
Comment on lines +35 to +37
Copy link
Member

@emilazy emilazy Jul 10, 2024

Choose a reason for hiding this comment

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

I guess when 3.12 leaves Nixpkgs we’ll have to do one of:

  • package 2to3 independently of the Python interpreter;
  • run it once over the nose code and just vendor the results; or
  • remove nose?

Copy link
Contributor Author

@jchv jchv Jul 10, 2024

Choose a reason for hiding this comment

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

Yeah, that's roughly my thoughts. My order of preferences for future actions: (I assume most people are in a similar frame of mind, but just to jot it down in detail.)

  • Most preferred would be getting rid of nose dependencies upstream. It's unmaintained and most users don't use very much of its functionality, so a migration should be easy. For some packages, I think this will just be a matter of getting the version in Nixpkgs updated. For some simpler stuff, nose2pytest may be enough to generate a patch that we can use + submit upstream.

  • Failing that, if Lack of attribution and licence information for code derived from CPython mdmintz/pynose#33 gets resolved then maybe we can consider the pynose licensing issue resolved and resume usage of pynose as a drop-in replacement, pending other's approval. I'm sure there will be some hesitance here though and I'm not going to argue if the thought is we'd rather play it safe.

  • Failing that, we can continue to try to patch Nose for Python 3.14+. In an earlier version of this PR I did indeed include a 2to3 patch file, but it's rather large, so I think putting it in Nixpkgs preemptively is undesirable.

  • And failing that, my thought is we can remove nose, disable tests on anything that continues to use nose, and eventually remove packages that depend on nose which are unmaintained.

If you think it is a good idea, I can try to add more context to that comment for the future. Specifically, we could outline the options for handling 2to3.

Regarding packaging 2to3 independently: maybe even better would be packaging the fissix tool by amyreese, as it essentially seems to be an improved 2to3. (Coincidentally, it is also apparently used by the nose2pytest tool.)

Copy link
Member

@mweinelt mweinelt Jul 10, 2024

Choose a reason for hiding this comment

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

Ideally by 2028 we've fixed the ecosystem enough, that nose is not relevant anymore. I wouldn't worry too much about this today.

Copy link
Member

Choose a reason for hiding this comment

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

I didn’t realize that we kept Python releases for that many years. Agreed that it’s not worth thinking about in that case.

'';

propagatedBuildInputs = [ coverage ];
Expand Down
3 changes: 0 additions & 3 deletions pkgs/development/python-modules/nwdiag/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ buildPythonPackage rec {

dependencies = [ blockdiag ];

# tests rely on nose
doCheck = pythonOlder "3.12";

nativeCheckInputs = [
nose
pytestCheckHook
Expand Down
3 changes: 0 additions & 3 deletions pkgs/development/python-modules/pprintpp/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ buildPythonPackage rec {

build-system = [ setuptools ];

# tests rely on nose
doCheck = pythonOlder "3.12";

nativeCheckInputs = [
nose
parameterized
Expand Down
4 changes: 0 additions & 4 deletions pkgs/development/python-modules/pydy/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
lib,
buildPythonPackage,
fetchPypi,
pythonOlder,
numpy,
scipy,
sympy,
Expand All @@ -29,9 +28,6 @@ buildPythonPackage rec {
sympy
];

# tests rely on nose
doCheck = pythonOlder "3.12";

nativeCheckInputs = [
nose
cython
Expand Down
2 changes: 0 additions & 2 deletions pkgs/development/python-modules/pypass/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ buildPythonPackage rec {
pexpect
];

doCheck = pythonOlder "3.12";

nativeCheckInputs = [ nose ];

# Configuration so that the tests work
Expand Down
3 changes: 0 additions & 3 deletions pkgs/development/python-modules/pytimeparse/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ buildPythonPackage rec {

build-system = [ setuptools ];

# tests rely on nose
doCheck = pythonOlder "3.12";

nativeCheckInputs = [ nose ];

pythonImportsCheck = [ "pytimeparse" ];
Expand Down
3 changes: 0 additions & 3 deletions pkgs/development/python-modules/seqdiag/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ buildPythonPackage rec {

dependencies = [ blockdiag ];

# tests rely on nose
doCheck = pythonOlder "3.12";

nativeCheckInputs = [
nose
pytestCheckHook
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ buildPythonPackage rec {

dependencies = [ sphinx-rtd-theme ];

# tests rely on nose
doCheck = pythonOlder "3.12";

nativeCheckInputs = [
nose
sphinx
Expand Down
4 changes: 0 additions & 4 deletions pkgs/development/python-modules/uvcclient/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
lib,
buildPythonPackage,
fetchFromGitHub,
pythonOlder,
nose,
mock,
}:
Expand All @@ -24,9 +23,6 @@ buildPythonPackage rec {
--replace-fail "assertEquals" "assertEqual"
'';

# tests rely on nose
doCheck = pythonOlder "3.12";

nativeCheckInputs = [
nose
mock
Expand Down
3 changes: 0 additions & 3 deletions pkgs/development/python-modules/xlwt/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ buildPythonPackage rec {

build-system = [ setuptools ];

# tests rely on nose, archived in 2020
doCheck = pythonOlder "3.12";

nativeCheckInputs = [ nose ];

checkPhase = ''
Expand Down