How to override disabled nature for python package (want to install aiohttp with python3.8)

I’d like to try to use Nix to install python3.8 with aiohttp, knowing some tests fail. But I can’t because the package announces it is disabled for python3.8. So, I copy the aiohttp from nixpkgs, and remove the disabled clause, and try to install it with callPackage ./aiohttp.nix:

{ lib
, stdenv
, buildPythonPackage
, fetchPypi
, pythonOlder
, pythonAtLeast
, attrs
, chardet
, multidict
, async-timeout
, yarl
, idna-ssl
, typing-extensions
, pytestrunner
, pytest
, gunicorn
, pytest-timeout
, async_generator
, pytest_xdist
, pytestcov
, pytest-mock
, trustme
, brotlipy
, freezegun
}:

buildPythonPackage rec {
  pname = "aiohttp";
  version = "3.6.2";
  # https://github.com/aio-libs/aiohttp/issues/4525 python3.8 failures
  #disabled = pythonOlder "3.5" || pythonAtLeast "3.8";

  src = fetchPypi {
    inherit pname version;
    sha256 = "09pkw6f1790prnrq0k8cqgnf1qy57ll8lpmc6kld09q7zw4vi6i5";
  };

  checkInputs = [
    pytestrunner pytest gunicorn async_generator pytest_xdist
    pytest-mock pytestcov trustme brotlipy freezegun
  ];

  propagatedBuildInputs = [ attrs chardet multidict async-timeout yarl ]
    ++ lib.optionals (pythonOlder "3.7") [ idna-ssl typing-extensions ];

  # disable tests which attempt to do loopback connections
  checkPhase = ''
    #cd tests
    #pytest -k "not get_valid_log_format_exc \
    #           and not test_access_logger_atoms \
    #           and not aiohttp_request_coroutine \
    #           and not server_close_keepalive_connection \
    #           and not connector \
    #           and not client_disconnect \
    #           and not handle_keepalive_on_closed_connection \
    #           and not proxy_https_bad_response \
    #           and not partially_applied_handler \
    #           ${lib.optionalString stdenv.is32bit "and not test_cookiejar"} \
    #           and not middleware" \
    #  --ignore=test_connector.py
  '';

  meta = with lib; {
    description = "Asynchronous HTTP Client/Server for Python and asyncio";
    license = licenses.asl20;
    homepage = "https://github.com/aio-libs/aiohttp";
    maintainers = with maintainers; [ dotlambda ];
  };
}

only to realize it has a bajillion dependencies, and I don’t know where each of them come from. So I try to override it, and that doesn’t work. Neither does overrideAttr. So, is there any way to do a python38.withPackages and use my overridden aiohttp. The context is that it’s needed by some other package in the dependencies for pytorch, and I have no idea which one or why. But I really want the ability to use cygdb and apparently, since building a debug python is hard, using a python with the same ABI for debug and non-debug is the way to go. Is what I’m trying to do reasonable, possible, etc?

It’s been since I’ve used aiohttp… The dependencies don’t seem to
be so many and usually they are defined inside the setup.py at the
package root. Anyway, usually to build a package without testing you
can set doCheck = false; on the derivation.

What’s the error message for the derivation above?

First the successful case: install holidays in python38

[henry@bollum:~/nix-home]$ nix-shell -p ‘python38.withPackages(ps: [ ps.holidays ] )’
these derivations will be built:
/nix/store/gswzkc6m5ji92jdvvpv0qivi12nlwsa0-python3-3.8.2-env.drv
these paths will be fetched (12.08 MiB download, 67.08 MiB unpacked):
/nix/store/0lqir3jgid0jv6sq1g2yb51wja2v3jwa-python3.8-PyMeeus-0.3.7
/nix/store/2gvz2f615978cgd5rngzd3nrvxb31x3p-python3.8-pytz-2019.3
/nix/store/9kkbiym3xynqmy514a0jb53nm5z1l7ar-python3.8-six-1.14.0
/nix/store/cgi6hs3cbazb4hqh6f5q6ynjz3bzb4g2-python3.8-setuptools_scm-3.4.3
/nix/store/d27ihabal1lgajnjj56i0kg02fnavs5a-bash-interactive-4.4-p23-dev
/nix/store/fqxbd01x0hdlcs2h6d5jd3ngnb777gkq-python3-3.8.2
/nix/store/fz37723jf42jyaixjqk01fhlid5wbr40-python3.8-holidays-0.10.1
/nix/store/gb7bx3sx58jzflay53ppbhx21m14f78i-python3.8-convertdate-2.2.0
/nix/store/xcqj3km89x7xdr8067hgx97w0dz88dv7-python3.8-python-dateutil-2.8.1
copying path ‘/nix/store/d27ihabal1lgajnjj56i0kg02fnavs5a-bash-interactive-4.4-p23-dev’ from ‘https://cache.nixos.org’…
copying path ‘/nix/store/fqxbd01x0hdlcs2h6d5jd3ngnb777gkq-python3-3.8.2’ from ‘https://cache.nixos.org’…
copying path ‘/nix/store/0lqir3jgid0jv6sq1g2yb51wja2v3jwa-python3.8-PyMeeus-0.3.7’ from ‘https://cache.nixos.org’…
copying path ‘/nix/store/2gvz2f615978cgd5rngzd3nrvxb31x3p-python3.8-pytz-2019.3’ from ‘https://cache.nixos.org’…
copying path ‘/nix/store/cgi6hs3cbazb4hqh6f5q6ynjz3bzb4g2-python3.8-setuptools_scm-3.4.3’ from ‘https://cache.nixos.org’…
copying path ‘/nix/store/9kkbiym3xynqmy514a0jb53nm5z1l7ar-python3.8-six-1.14.0’ from ‘https://cache.nixos.org’…
copying path ‘/nix/store/xcqj3km89x7xdr8067hgx97w0dz88dv7-python3.8-python-dateutil-2.8.1’ from ‘https://cache.nixos.org’…
copying path ‘/nix/store/gb7bx3sx58jzflay53ppbhx21m14f78i-python3.8-convertdate-2.2.0’ from ‘https://cache.nixos.org’…
copying path ‘/nix/store/fz37723jf42jyaixjqk01fhlid5wbr40-python3.8-holidays-0.10.1’ from ‘https://cache.nixos.org’…
building ‘/nix/store/gswzkc6m5ji92jdvvpv0qivi12nlwsa0-python3-3.8.2-env.drv’…
created 232 symlinks in user environment

Next: the unsuccessful case, nothing tried yet

[nix-shell:~/nix-home]$ nix-shell -p ‘python38.withPackages(ps: [ ps.aiohttp ])’
error: aiohttp-3.6.2 not supported for interpreter python3.8
(use ‘–show-trace’ to show detailed location information)

Next up: the override

henry@bollum:~]$ nix-shell -p ‘python38.withPackages(ps: [ (ps.aiohttp.override {disabled = false; >doCheck=false;}) ])’
error: aiohttp-3.6.2 not supported for interpreter python3.8
(use ‘–show-trace’ to show detailed location information)

test this

./result/bin/python3.8
Python 3.8.2 (default, Feb 25 2020, 10:39:28) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import aiohttp
>>> 
  • nix config
1 { stdenv
   2 , python38Packages
   3 , python3
   4 , lib
   5 }:
   6 with python3.pkgs;
   7 python38Packages.buildPythonPackage rec {
   8 │  pname = "aiohttp";
   9 │  version = "3.6.2";
  10 │  │src = fetchPypi {
  11 │  ││ inherit pname version;
  12 │  ││ │sha256 = "09pkw6f1790prnrq0k8cqgnf1qy57ll8lpmc6kld09q7zw4vi6i5";
  13 │  │};
  14 │  │doCheck = false;
  15 │  │checkInputs = [
  16 │  │pytestrunner pytest gunicorn async_generator pytest_xdist
  17 │  │pytest-mock pytestcov trustme brotlipy freezegun
  18 │  │];
  19 
  20 │  │propagatedBuildInputs =  with python38Packages; [ attrs chardet multidict async-timeout yarl ]
  21 │  │++ lib.optionals (pythonOlder "3.7") [ idna-ssl typing-extensions ];                                                            
  22 }
  • build paths
 (pkgs.python38.withPackages (pkgs: with pkgs; [ aiohttp
        ]))