Mic92 / nixpkgs-review

Review pull-requests on https://github.com/NixOS/nixpkgs
MIT License
356 stars 59 forks source link

shell completions with argcomplete #296

Closed figsoda closed 11 months ago

figsoda commented 1 year ago

closes https://github.com/Mic92/nixpkgs-review/issues/294

Mic92 commented 1 year ago

Thanks for adding this. But now that I see the myrad of build dependencies that argcomplete now adds, I am a bit worried I first thought this is just a build dependency...

these 64 derivations will be built:                                                                                                     
  /nix/store/1prrbs69g1m0j7lgnivjgd1wjwzk4rr2-python-namespaces-hook.sh.drv                                                             
  /nix/store/49zikdp55c8kgxshq83qhj0ly57lp4j8-python-remove-tests-dir-hook.drv                                                          
  /nix/store/5svn4nc8q33267x40b30a9n45rb47g88-hook.drv                                                                                  
  /nix/store/6ck5pgy98w91439f933kpk9jr2wkfmyb-python-imports-check-hook.sh.drv                                                          
  /nix/store/2d6045752ybzmjzlybzj2877x26qvixq-setuptools-setup-hook.drv                                                                 
  /nix/store/9fh2mfxcb5q14i71j1yk3pnf66wywxql-setuptools-65.3.0-sdist.tar.gz.drv                                                        
  /nix/store/raa0ip88gfmikz0g7314jx0pds7k60fh-pip-install-hook.drv                                                                      
  /nix/store/lwrbaydf2733840w1dmihc1bqvsig790-python3.12-bootstrapped-pip-22.2.2.drv                                                    
  /nix/store/nplc5vx2xiibywkx8sffvm3pinmqzgxw-python3.12-setuptools-65.3.0.drv                                                          
  /nix/store/vrafkwf521a33ly9hr89y5wyl3v86v8h-python-catch-conflicts-hook.drv                                                           
  /nix/store/mpsgdjqriqzk1lynnkd8fsv2hvvqkgk1-python3.12-pip-22.2.2.drv                                                                 
  /nix/store/88x2a2kzs5k60chrpljx55dfhm77xr2p-pip-install-hook.drv                                                                      
  /nix/store/d0qnzka9nahc9cff4izpi883xrk9cyfn-python3.12-wheel-0.37.1.drv                                                               
  /nix/store/j9x5vyjcr4b2mkrd6b6l4ln7hb0ch7cz-setuptools-setup-hook.drv     
  /nix/store/baa2agdlk10j1zyjpy16kz404mys70qj-pip-build-hook.sh.drv      
  /nix/store/3n43gsw9lr9cv6hc5vzby31h8g3s8hgi-python3.12-flit-core-3.7.1.drv
  /nix/store/0ml7wmgzblk5p46p3jhjll66rw6hsa1g-python3.12-typing-extensions-4.3.0.drv
  /nix/store/bp44x6qy4a01ckq172kqd5kbngqkm23m-unittest-check-hook.drv       
  /nix/store/h647vy5kbbbcdbs3k8f62qz4sg37nd4a-python3.12-tomli-2.0.1.drv            
  /nix/store/fwxaxcf2ka6c9hjrpmbjddpfya59m11z-python3.12-pyparsing-3.0.9.drv
  /nix/store/wp181zzqglfpr6s1yvbwz9rmrzgp7p56-python3.12-packaging-21.3.drv 
  /nix/store/rdm2aqwarza1ap22wnjrikgppmr1ijka-python3.12-setuptools-scm-7.0.5.drv
  /nix/store/9g26qf6lscindavc4madgbmb0a22d95f-python3.12-py-1.11.0.drv      
  /nix/store/aq4jydsyix56m8mzbp4p2mzz178jyi7l-python3.12-iniconfig-1.1.1.drv     
  /nix/store/ls464dgvqh64fxfgcl3w76xfw36i60pv-python3.12-pluggy-1.0.0.drv  
  /nix/store/rgqbdm57dxi4p9jbpa63h2jfhxxwp6s6-pytest-hook.drv               
  /nix/store/vvayni6jh3ixp5z0rp6m59s7f4hxf6wn-python3.12-attrs-22.1.0.drv    
  /nix/store/ybfh7hjqlgjvwb22d9zr2ypah2vx11am-python3.12-pytest-7.1.3.drv 
  /nix/store/0mspmz0cxc2gixpljap4z9frfrfqhq7y-pytest-check-hook.drv      
  /nix/store/4zi9m224sfb2m84v6ccknqy3hpv8ksna-python3.12-editables-0.3.drv
  /nix/store/flvgw9iq587fdg9xpxwpcmb8hiy3189j-python3.12-pathspec-0.10.1.drv    
  /nix/store/ry228ynmn94a3dbv72cjd0ad9wl0m28h-python3.12-hatchling-1.11.1.drv  
  /nix/store/rk2rka0vvqq275x61924mwkr753s0y8a-python3.12-hatch-vcs-0.2.0.drv
  /nix/store/0jqgs1dsz213myp1v7czxb19rx0b15n6-python3.12-apipkg-3.0.1.drv    
  /nix/store/71w4j0vl99sqi9nilfmis2kiaq5b6cc4-python3.12-filelock-3.8.0.drv 
  /nix/store/7c9zsw868x0n872v0s92babr1k162miv-setuptools-check-hook.drv  
  /nix/store/7x34b3js9nhz9b21isny2x2hsvnlncsw-python3.12-ptyprocess-0.7.0.drv
  /nix/store/d599dx8lyb8rb7kqjgyh1kkrz4yd52yf-python3.12-pexpect-4.8.0.drv    
  /nix/store/gxb6d00d616r4bm2bivgbaklaygkf1an-python3.12-psutil-5.9.4.drv    
  /nix/store/sgfnqvzcl2l7qzgj8j4jd0j7x1qmbiv6-python3.12-execnet-1.9.0.drv  
  /nix/store/zbiv126lmgi0jfqzxmhafqy26wyl3476-python3.12-pytest-forked-1.4.0.drv
  /nix/store/13v37ryq6khd31dbi2a090j544rrxn3l-python3.12-pytest-xdist-2.5.0.drv
  /nix/store/dxzyy6pzrxfv57zzi4g234zjn97s8cqg-python3.12-pysocks-1.7.1.drv        
  /nix/store/ib8pgj4w6xbsg91j7iw2nil3sn0g8nkb-python3.12-brotli-1.0.9.drv      
  /nix/store/37a03lyhgnh46njprzvinjcwxs99v2g6-python3.12-urllib3-1.26.12.drv         
  /nix/store/3pwvkbzghr1jl8db6f8l8r1mjx8d9y0v-python3.12-mock-4.0.3.drv  
  /nix/store/qpl7rvs074na3kn5v9kpfiwadir7vi62-python3.12-wcwidth-0.2.5.drv     
  /nix/store/4b28x21pdmh99icn1aavnrhdc4d6a142-python3.12-prettytable-3.4.1.drv 
  /nix/store/8nsnhf804hrcgs4v1v1q5jx8n6r9x8sz-python3.12-toml-0.10.2.drv  
  /nix/store/a02h8609844glhhlrlpygddxzqwggydh-python3.12-dicttoxml-1.7.4.drv  
  /nix/store/m72mz97zlb8jsbigvz899h1yxm3jscpm-python3.12-pycparser-2.21.drv
  /nix/store/d1358v1qqagzhk4lq2aayfmw74fw2byn-python3.12-cffi-1.15.1.drv            
  /nix/store/szx47dbrb8lrpdcy7rn7j67g57wnq79d-python3.12-pytest-asyncio-0.19.0.drv    
  /nix/store/dgymzmjsl7fhwssdlmjnzpp16z14cmfq-python3.12-pytest-mock-3.8.2.drv
  /nix/store/hv2dfgf4bj6bv09bw12c3292597wlxv1-python3.12-charset-normalizer-2.1.0.drv
  /nix/store/icr1x94vck95frf17vy2ziwqylqfsr4s-python3.12-zipp-3.10.0.drv      
  /nix/store/il4pp8izav3k168fqkxlwp7mp4i1lc43-python3.12-brotlicffi-1.0.9.2.drv      
  /nix/store/n5qp2dsbxmnc54k0wwr4g9bapxhncj02-python3.12-certifi-2022.12.07.drv            
  /nix/store/plj2imvqysiic8ck14dkrrlxpkibkzhn-python3.12-idna-3.4.drv          
  /nix/store/xc9g67lxv468wqch3ijxjc74fcvjgzqs-python3.12-requests-2.28.1.drv                                    
  /nix/store/icslwgpfhv329pb25655vkg7m732010v-python3.12-betamax-0.8.1.drv
  /nix/store/q271xjgfx0asik442vl2ayxgdkfwy7l9-python3.12-requests-toolbelt-0.9.1.drv
  /nix/store/scsmknzq6yjw26riwkhrfcg9c3k1zjy3-python3.12-importlib-metadata-4.12.0.drv                                       
  /nix/store/ij31ay8ml1fin8hsv22wjlxqic7p0gnn-python3.12-argcomplete-2.0.0.drv                                               
these 9 paths will be fetched (38.92 MiB download, 107.46 MiB unpacked):                                                                
  /nix/store/1zzykxmkppl07hj2k6qbcq92xwdf903j-dicttoxml-1.7.4.tar.gz                                                         
  /nix/store/8h0bmayirbwawvsik7bf4x3v4sq4lpgm-wcwidth-0.2.5.tar.gz                                                                      
  /nix/store/bwlf012yybyyilmglbs312lwf0f5cjra-8a3c2c816d789639b49d3ae867213393ed7abdff.diff                                             
  /nix/store/gk6601fayqc2b209zcmg39siy8xxsv1r-zipp-3.10.0.tar.gz                                                                        
  /nix/store/j2c3m37jm9b7irsn6dj6xzijcsq0ijr2-source                  
  /nix/store/p0nrhwm4036h0zk7d7hhq7diasxp0li7-python3-3.12.0a3                                                                          
  /nix/store/qkbl3d4fxskc0zqijav0mdrw6kdjkiaf-prettytable-3.4.1.tar.gz                                                                  
  /nix/store/qygwf1v3pq1c3pvshicsc89j7781ljlm-argcomplete-2.0.0.tar.gz                                                                  
  /nix/store/xcay56nmi4li9z3y3rhzc9wi1gzaacx2-importlib_metadata-4.12.0.tar.gz  

By adding these libraries we make them build blockers of nixpkgs.

Mic92 commented 1 year ago

Another problem is that we currently unset PYTHONPATH to not pollute nix-shell when reviewing python libraries.

# we don't have any runtime deps but nix-review shells might inject unwanted dependencies
"--unset PYTHONPATH"
Mic92 commented 1 year ago

It seems that there is also support for external argcomplete script for auto completion of the executable. Can we use that?

figsoda commented 1 year ago

By adding these libraries we make them build blockers of nixpkgs.

There is probably not a good way a solving this if we want to use argcomplete, maybe make completions opt-in?

Another problem is that we currently unset PYTHONPATH to not pollute nix-shell when reviewing python libraries.

completions seems to still work even if PYTHONPATH is unset, I don't think that would be a problem

It seems that there is also support for external argcomplete script for auto completion of the executable. Can we use that?

iiuc we would still need to depend on the python library, the only thing we can do here is to create another derivation for completions only

Mic92 commented 11 months ago

@mergify queue

mergify[bot] commented 11 months ago

queue

🛑 The pull request has been removed from the queue

Unexpected queue change: the updated pull request #296 has been manually updated. You can take a look at `Queue: Embarked in merge train` check runs for more details. In case of a failure due to a flaky test, you should first retrigger the CI. Then, re-embark the pull request into the merge queue by posting the comment `@mergifyio refresh` on the pull request.