airspeed-velocity / asv

Airspeed Velocity: A simple Python benchmarking tool with web-based reporting
https://asv.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
860 stars 180 forks source link

Don't hardcode Python implementations in the virtualenv integration #980

Open saaj opened 2 years ago

saaj commented 2 years ago

https://github.com/airspeed-velocity/asv/commit/f954511596d7f3020256e9a3ae65b2fc1f88721a added support for PyPy. Currently pythons configuration basically finds Python binary like below and passes it to virtualenv:

https://github.com/airspeed-velocity/asv/blob/9d5af5713357ccea00a518758fae6822cc69f539/asv/plugins/virtualenv.py#L63-L82

That's basically saying only CPython and PyPy are supported. That's not too wild assumption of course, as these two are the top two Python production-ready implementations, but of course not all. There are legacy Jython and IronPython. There are recent revivals, like Pyston, actively developed. There are x86 ports of Micropython, and probably more (e.g. your own builds with PGO using your workload). And it's quite interesting to see how your workloads, benchmarked by asv, fare on these Pythons. virtualenv support should already be there.

mattip commented 2 years ago

Probably the best thing to do here is to revert this change, under the assumption that alternative interpreters will alias python inside their virtual environments. This is the case for PyPy now. Does Pyston not provide a python alias?

saaj commented 2 years ago

Does Pyston not provide a python alias?

It does.

$ docker run --rm -it saaj/snake-tank:0.11
root@c47fef4522ce:/# pyston -m venv /tmp/venv
root@c47fef4522ce:/# ls -l /tmp/venv/bin
total 36
-rw-r--r-- 1 root root 8834 Jan 18 22:17 Activate.ps1
-rw-r--r-- 1 root root 2168 Jan 18 22:17 activate
-rw-r--r-- 1 root root 1220 Jan 18 22:17 activate.csh
-rw-r--r-- 1 root root 2372 Jan 18 22:17 activate.fish
-rwxr-xr-x 1 root root  225 Jan 18 22:17 pip
-rwxr-xr-x 1 root root  225 Jan 18 22:17 pip3
-rwxr-xr-x 1 root root  225 Jan 18 22:17 pip3.8
lrwxrwxrwx 1 root root   15 Jan 18 22:17 pyston -> /usr/bin/pyston
lrwxrwxrwx 1 root root    6 Jan 18 22:17 python -> pyston
lrwxrwxrwx 1 root root    6 Jan 18 22:17 python3 -> pyston