Python: Difference between revisions

Jump to navigation Jump to search
1,269 bytes added ,  2 years ago
Rework the Availalable wheels section based on the 2.0 version of the script.
(Marked this version for translation)
(Rework the Availalable wheels section based on the 2.0 version of the script.)
Line 190: Line 190:
By default, it will:
By default, it will:
* only show you the '''latest version''' of a specific package (unless versions are given);
* only show you the '''latest version''' of a specific package (unless versions are given);
* only show you versions that are compatible with the python module (if one loaded), otherwise all python versions will be shown;
* only show you versions that are compatible with the python module (if one loaded) or virtual environment (if activated), otherwise all python versions will be shown;
* only show you versions that are compatible with the CPU architecture that you are currently running on.
* only show you versions that are compatible with the CPU architecture that you are currently running on.


<!--T:24-->
==== Names ====
To list wheels containing "cdf" (case insensitive) in its name:
To list wheels containing <tt>cdf</tt> (case insensitive) in its name:
{{Command|avail_wheels --name "*cdf*"
{{Command
name     version   build   python    arch
|avail_wheels "*cdf*"
-------  ---------  -------  -------- ------
|result=
netCDF4 1.4.0              cp27     avx2
name     version    python    arch
--------  ---------  --------  -------
h5netcdf 0.7.4      py2,py3  generic
netCDF4  1.5.8      cp39      avx2
netCDF4  1.5.8      cp38      avx2
netCDF4   1.5.8     cp310    avx2
}}
}}


<!--T:25-->
Or an exact name:
Or to list all available versions:  
{{Command
{{Command|avail_wheels --name "*cdf*" --all_version
|avail_wheels numpy
name     version   build   python    arch
|result=
-------  ---------  -------  --------  ------
name   version    python    arch
netCDF4  1.4.0               cp27     avx2
------  ---------  --------  -------
netCDF4  1.3.1              cp36     avx2
numpy  1.23.0     cp39     generic
netCDF4  1.3.1              cp35      avx2
numpy  1.23.0    cp38     generic
netCDF4  1.3.1              cp27      avx2
numpy  1.23.0    cp310    generic
netCDF4  1.2.8              cp27      avx2
}}
}}


<!--T:26-->
==== Version ====
Or to list a specific version:
To list a specific version, one can use the same format as with `pip`:
{{Command|avail_wheels --name "*cdf*" --version 1.3
{{Command
name     version   build   python    arch
|avail_wheels numpy{{=}}{{=}}1.23
-------  ---------  -------  --------  ------
|result=
netCDF4 1.3.1               cp36     avx2
name    version    python    arch
netCDF4 1.3.1               cp35     avx2
------  ---------  --------  -------
netCDF4 1.3.1               cp27     avx2
numpy  1.23.0    cp39      generic
numpy  1.23.0    cp38      generic
numpy  1.23.0    cp310    generic
}}
Or use the long option:
{{Command
|avail_wheels numpy --version 1.23
|result=
name   version    python    arch
------  ---------  --------  -------
numpy  1.23.0    cp39      generic
numpy  1.23.0    cp38      generic
numpy  1.23.0    cp310    generic
}}
With the <tt>pip</tt> format, one can use different operators : <tt>==</tt>, <tt><</tt>, <tt>></tt>, <tt>~=</tt>, <tt><=</tt>,<tt>>=</tt>, <tt>!=</tt>. For instance, to list inferior versions:
{{Command
|avail_wheels 'numpy<1.23'
|result=
name   version    python    arch
------  ---------  --------  -------
numpy  1.22.2    cp39      generic
numpy  1.22.2    cp38      generic
numpy  1.22.2    cp310    generic
}}
And to list all available versions:
{{Command
|avail_wheels "*cdf*" --all-version
|result=
name      version    python    arch
--------  ---------  --------  -------
h5netcdf  0.7.4      py2,py3  generic
netCDF4   1.5.8      cp39      avx2
netCDF4  1.5.8      cp38      avx2
netCDF4  1.5.8      cp310    avx2
netCDF4  1.5.6      cp38     avx2
netCDF4   1.5.6      cp37      avx2
netCDF4  1.5.4      cp38     avx2
netCDF4   1.5.4      cp37      avx2
netCDF4  1.5.4      cp36     avx2
}}
}}


<!--T:27-->
==== Python ====
Or to list for a specific version of python:
One can list a specific version of Python:
{{Command|avail_wheels --name "*cdf*" --python 3.6
{{Command
name     version   build   python    arch
|avail_wheels 'numpy<1.23' --python 3.9
-------  ---------  -------  --------  ------
|result=
netCDF4  1.3.1              cp36     avx2
name   version    python    arch
------  ---------  --------  -------
numpy  1.22.2    cp39     generic
}}
}}
The ''python'' column tell us for which python version the wheel is available, where <tt>cp36</tt> stands for <tt>cpython 3.6</tt>.
The ''python'' column tell us for which python version the wheel is available, where <tt>cp39</tt> stands for <tt>cpython 3.9</tt>.


===== A few other examples ===== <!--T:28-->
==== Requirements file ====
* List multiple packages and multiple versions: <tt>avail_wheels numpy biopython --version 1.15.0 1.7</tt>
One can list available wheels based on a <tt>requirements.txt</tt> file with:
* List the wheels for specific architectures : <tt>avail_wheels --arch avx avx2</tt>
{{Command
* List the wheels specifically for GPU and display only ''name'', ''version'', ''python'' columns: <tt>avail_wheels --column name version python --all_versions --name "*gpu"</tt>
|avail_wheels -r requirements.txt
* Display usage and help: <tt>avail_wheels --help</tt>
|result=
name      version    python    arch
---------  ---------  --------  -------
packaging  21.3      py3      generic
tabulate  0.8.10    py3      generic
}}
And display wheels that are not available:
{{Command
|avail_wheels -r requirements.txt --not-available
|result=
name       version   python   arch
---------  ---------  -------- -------
packaging  21.3      py3      generic
pip
tabulate  0.8.10    py3      generic
}}


=== Pre-downloading packages === <!--T:61-->
=== Pre-downloading packages === <!--T:61-->
cc_staff
284

edits

Navigation menu