From 3f2c25adcf8e8af0cfa28b738fdc0dcfaceefe04 Mon Sep 17 00:00:00 2001 From: Christoph Jabs Date: Tue, 16 Sep 2025 09:52:14 +0300 Subject: [PATCH 1/3] python3Packages.python-sat: switch to fetchPypi - match the version numbering used on PyPI - since releases are not tagged in the upstream git repo, this way the automatic update script should work --- .../python-modules/python-sat/default.nix | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pkgs/development/python-modules/python-sat/default.nix b/pkgs/development/python-modules/python-sat/default.nix index 8b6e8716a56b..6db040811517 100644 --- a/pkgs/development/python-modules/python-sat/default.nix +++ b/pkgs/development/python-modules/python-sat/default.nix @@ -1,21 +1,20 @@ { buildPythonPackage, - fetchFromGitHub, + fetchPypi, lib, six, pypblib, pytestCheckHook, }: -buildPythonPackage { +buildPythonPackage rec { pname = "python-sat"; - version = "0.1.8.dev20"; + version = "1.8.dev20"; format = "setuptools"; - src = fetchFromGitHub { - owner = "pysathq"; - repo = "pysat"; - rev = "d94f51e5eff2feef35abbc25480659eafa615cc0"; # upstream does not tag releases - hash = "sha256-fKZcdEVuqpv8jWnK8Cr1UJ7szJqXivK6x3YPYHH5ccI="; + src = fetchPypi { + inherit version; + pname = "python_sat"; + hash = "sha256-8uUi6DtPVh/87EWSgTtGq7UhAs+Glw8KARPkK3ukeMg="; }; # Build SAT solver backends in parallel and fix hard-coded g++ reference for From c01d7fbe0a0baf4ef37583687c697dc8026a7397 Mon Sep 17 00:00:00 2001 From: Christoph Jabs Date: Tue, 16 Sep 2025 10:34:42 +0300 Subject: [PATCH 2/3] python3Packages.python-sat: cleanup and convert to pyproject true - fix pytest import issue As described in https://github.com/NixOS/nixpkgs/issues/255262, `python -m pytest` adds the local directory to PYTHONPATH, which gives precendence to local imports. Remove the local `pysat` directory to only import the installed variant. - convert to pyproject true - update description --- .../python-modules/python-sat/default.nix | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/pkgs/development/python-modules/python-sat/default.nix b/pkgs/development/python-modules/python-sat/default.nix index 6db040811517..7ff726cb5daf 100644 --- a/pkgs/development/python-modules/python-sat/default.nix +++ b/pkgs/development/python-modules/python-sat/default.nix @@ -2,6 +2,7 @@ buildPythonPackage, fetchPypi, lib, + setuptools, six, pypblib, pytestCheckHook, @@ -9,7 +10,9 @@ buildPythonPackage rec { pname = "python-sat"; version = "1.8.dev20"; - format = "setuptools"; + pyproject = true; + + build-system = [ setuptools ]; src = fetchPypi { inherit version; @@ -17,26 +20,42 @@ buildPythonPackage rec { hash = "sha256-8uUi6DtPVh/87EWSgTtGq7UhAs+Glw8KARPkK3ukeMg="; }; - # Build SAT solver backends in parallel and fix hard-coded g++ reference for - # darwin, where stdenv uses clang + # Fix hard-coded g++ reference for darwin, where stdenv uses clang + # FIXME: remove once https://github.com/pysathq/pysat/pull/204 is merged and + # has hit PyPI postPatch = '' - substituteInPlace solvers/prepare.py \ - --replace-fail "&& make &&" "&& make -j$NIX_BUILD_CORES &&" substituteInPlace solvers/patches/glucose421.patch \ --replace-fail "+CXX := g++" "+CXX := c++" ''; + preBuild = '' + export MAKEFLAGS="-j$NIX_BUILD_CORES" + ''; + propagatedBuildInputs = [ six pypblib ]; + pythonImportsCheck = [ + "pysat" + "pysat.examples" + "pysat.allies" + ]; + nativeCheckInputs = [ pytestCheckHook ]; - disabledTestPaths = [ "tests/test_unique_mus.py" ]; + # Due to `python -m pytest` appending the local directory to `PYTHONPATH`, + # importing `pysat.examples` in the tests fails. Removing the `pysat` + # directory fixes since then only the installed version in `$out` is + # imported, which has `pysat.examples` correctly installed. + # See https://github.com/NixOS/nixpkgs/issues/255262 + preCheck = '' + rm -r pysat + ''; meta = with lib; { - description = "Toolkit to provide interface for various SAT (without optional dependancy py-aiger-cnf)"; + description = "Toolkit for SAT-based prototyping in Python (without optional dependencies)"; homepage = "https://github.com/pysathq/pysat"; changelog = "https://pysathq.github.io/updates/"; license = licenses.mit; From b921ac91d1541d89826722bc79809ddde354280c Mon Sep 17 00:00:00 2001 From: Christoph Jabs Date: Wed, 17 Sep 2025 10:38:36 +0300 Subject: [PATCH 3/3] python3Packages.python-sat: 1.8.dev20 -> 1.8.dev24 --- .../python-modules/python-sat/default.nix | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/pkgs/development/python-modules/python-sat/default.nix b/pkgs/development/python-modules/python-sat/default.nix index 7ff726cb5daf..4624eb5cb6ef 100644 --- a/pkgs/development/python-modules/python-sat/default.nix +++ b/pkgs/development/python-modules/python-sat/default.nix @@ -9,7 +9,7 @@ }: buildPythonPackage rec { pname = "python-sat"; - version = "1.8.dev20"; + version = "1.8.dev24"; pyproject = true; build-system = [ setuptools ]; @@ -17,17 +17,9 @@ buildPythonPackage rec { src = fetchPypi { inherit version; pname = "python_sat"; - hash = "sha256-8uUi6DtPVh/87EWSgTtGq7UhAs+Glw8KARPkK3ukeMg="; + hash = "sha256-f9NnaPcHdNNInWTvpkg91ieaYejJ29kAAOLcbnbDmM0="; }; - # Fix hard-coded g++ reference for darwin, where stdenv uses clang - # FIXME: remove once https://github.com/pysathq/pysat/pull/204 is merged and - # has hit PyPI - postPatch = '' - substituteInPlace solvers/patches/glucose421.patch \ - --replace-fail "+CXX := g++" "+CXX := c++" - ''; - preBuild = '' export MAKEFLAGS="-j$NIX_BUILD_CORES" '';