Loading pkgs/development/python-modules/devtools/default.nix +9 −7 Original line number Diff line number Diff line Loading @@ -8,15 +8,12 @@ pygments, pytest-mock, pytestCheckHook, pythonOlder, }: buildPythonPackage rec { pname = "devtools"; version = "0.12.2"; format = "pyproject"; disabled = pythonOlder "3.7"; pyproject = true; src = fetchFromGitHub { owner = "samuelcolvin"; Loading @@ -25,14 +22,19 @@ buildPythonPackage rec { hash = "sha256-1HFbNswdKa/9cQX0Gf6lLW1V5Kt/N4X6/5kQDdzp1Wo="; }; patches = [ # https://github.com/samuelcolvin/python-devtools/pull/166 ./fix-test-ast-expr.patch ]; postPatch = '' substituteInPlace pyproject.toml \ --replace-fail 'asttokens>=2.0.0,<3.0.0' 'asttokens>=2.0.0' \ ''; nativeBuildInputs = [ hatchling ]; build-system = [ hatchling ]; propagatedBuildInputs = [ dependencies = [ asttokens executing pygments Loading Loading @@ -63,7 +65,7 @@ buildPythonPackage rec { meta = with lib; { description = "Python's missing debug print command and other development tools"; homepage = "https://python-devtools.helpmanual.io/"; changelog = "https://github.com/samuelcolvin/python-devtools/releases/tag/v${version}"; changelog = "https://github.com/samuelcolvin/python-devtools/releases/tag/${src.tag}"; license = licenses.mit; maintainers = with maintainers; [ jdahm ]; }; Loading pkgs/development/python-modules/devtools/fix-test-ast-expr.patch 0 → 100644 +44 −0 Original line number Diff line number Diff line From 7a95b33f8fe9b2d426c2680291ccbae2e973faa0 Mon Sep 17 00:00:00 2001 From: Tom Hunze <dev@thunze.de> Date: Sun, 4 May 2025 00:49:57 +0200 Subject: [PATCH] Fix `test_ast_expr` for Python 3.13 --- tests/test_prettier.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test_prettier.py b/tests/test_prettier.py index 298dc58..0f24756 100644 --- a/tests/test_prettier.py +++ b/tests/test_prettier.py @@ -486,6 +486,7 @@ class User(SQLAlchemyBase): @pytest.mark.skipif(sys.version_info < (3, 9), reason='no indent on older versions') +@pytest.mark.skipif(sys.version_info >= (3, 13), reason='show_empty=False on newer versions') def test_ast_expr(): assert pformat(ast.parse('print(1, 2, round(3))', mode='eval')) == ( "Expression(" @@ -503,6 +504,22 @@ def test_ast_expr(): ) +@pytest.mark.skipif(sys.version_info < (3, 13), reason='no show_empty on older versions') +def test_ast_expr_show_empty(): + assert pformat(ast.parse('print(1, 2, round(3))', mode='eval')) == ( + "Expression(" + "\n body=Call(" + "\n func=Name(id='print', ctx=Load())," + "\n args=[" + "\n Constant(value=1)," + "\n Constant(value=2)," + "\n Call(" + "\n func=Name(id='round', ctx=Load())," + "\n args=[" + "\n Constant(value=3)])]))" + ) + + @pytest.mark.skipif(sys.version_info < (3, 9), reason='no indent on older versions') def test_ast_module(): assert pformat(ast.parse('print(1, 2, round(3))')).startswith('Module(\n body=[') Loading
pkgs/development/python-modules/devtools/default.nix +9 −7 Original line number Diff line number Diff line Loading @@ -8,15 +8,12 @@ pygments, pytest-mock, pytestCheckHook, pythonOlder, }: buildPythonPackage rec { pname = "devtools"; version = "0.12.2"; format = "pyproject"; disabled = pythonOlder "3.7"; pyproject = true; src = fetchFromGitHub { owner = "samuelcolvin"; Loading @@ -25,14 +22,19 @@ buildPythonPackage rec { hash = "sha256-1HFbNswdKa/9cQX0Gf6lLW1V5Kt/N4X6/5kQDdzp1Wo="; }; patches = [ # https://github.com/samuelcolvin/python-devtools/pull/166 ./fix-test-ast-expr.patch ]; postPatch = '' substituteInPlace pyproject.toml \ --replace-fail 'asttokens>=2.0.0,<3.0.0' 'asttokens>=2.0.0' \ ''; nativeBuildInputs = [ hatchling ]; build-system = [ hatchling ]; propagatedBuildInputs = [ dependencies = [ asttokens executing pygments Loading Loading @@ -63,7 +65,7 @@ buildPythonPackage rec { meta = with lib; { description = "Python's missing debug print command and other development tools"; homepage = "https://python-devtools.helpmanual.io/"; changelog = "https://github.com/samuelcolvin/python-devtools/releases/tag/v${version}"; changelog = "https://github.com/samuelcolvin/python-devtools/releases/tag/${src.tag}"; license = licenses.mit; maintainers = with maintainers; [ jdahm ]; }; Loading
pkgs/development/python-modules/devtools/fix-test-ast-expr.patch 0 → 100644 +44 −0 Original line number Diff line number Diff line From 7a95b33f8fe9b2d426c2680291ccbae2e973faa0 Mon Sep 17 00:00:00 2001 From: Tom Hunze <dev@thunze.de> Date: Sun, 4 May 2025 00:49:57 +0200 Subject: [PATCH] Fix `test_ast_expr` for Python 3.13 --- tests/test_prettier.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test_prettier.py b/tests/test_prettier.py index 298dc58..0f24756 100644 --- a/tests/test_prettier.py +++ b/tests/test_prettier.py @@ -486,6 +486,7 @@ class User(SQLAlchemyBase): @pytest.mark.skipif(sys.version_info < (3, 9), reason='no indent on older versions') +@pytest.mark.skipif(sys.version_info >= (3, 13), reason='show_empty=False on newer versions') def test_ast_expr(): assert pformat(ast.parse('print(1, 2, round(3))', mode='eval')) == ( "Expression(" @@ -503,6 +504,22 @@ def test_ast_expr(): ) +@pytest.mark.skipif(sys.version_info < (3, 13), reason='no show_empty on older versions') +def test_ast_expr_show_empty(): + assert pformat(ast.parse('print(1, 2, round(3))', mode='eval')) == ( + "Expression(" + "\n body=Call(" + "\n func=Name(id='print', ctx=Load())," + "\n args=[" + "\n Constant(value=1)," + "\n Constant(value=2)," + "\n Call(" + "\n func=Name(id='round', ctx=Load())," + "\n args=[" + "\n Constant(value=3)])]))" + ) + + @pytest.mark.skipif(sys.version_info < (3, 9), reason='no indent on older versions') def test_ast_module(): assert pformat(ast.parse('print(1, 2, round(3))')).startswith('Module(\n body=[')