You are not logged in.

#1 2021-06-24 15:56:42

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Desire to package pip installation [SOLVED]

I am wondering about the feasibility to write a PKGBUILD that will mirror the upstream recommended pip install but I am not very adept using python.  Wondering if anyone with some background would offer some advice.

I did read https://wiki.archlinux.org/title/Python … elines#pip but find the software without a foo.whl file.

Studying the pip logs, it seems to call out some depends, but I am not sure how to direct the PKGBUILD to build/install.

Draft:

pkgname=stressberry
pkgver=0.3.3
pkgrel=1
pkgdesc='Stress tests and temperature plots for the Raspberry Pi'
arch=(any)
url='https://github.com/nschloe/stressberry'
license=(GPL)
depends=(python-matplotlib python-yaml python-importlib-metadata)
makedepends=(python-pytest python-setuptools twine)
source=("$pkgname-$pkgver.tar.gz::https://github.com/nschloe/$pkgname/archive/v$pkgver.tar.gz")
b2sums=('3ebdcc0f0a951b9a0c8a5a35d96cda2edc535b58f08abeb3eefb281a7bb6c582e66e9eb601acce6c79ad92320c0b97ef481d2e76ffa97ae7e7033a5a7e9c38a3')

For reference, pip output:

% pip install stressberry
Defaulting to user installation because normal site-packages is not writeable
Collecting stressberry
  Downloading stressberry-0.3.3-py3-none-any.whl (23 kB)
Collecting matplotlib
  Downloading matplotlib-3.4.2-cp39-cp39-manylinux2014_aarch64.whl (9.0 MB)
     |████████████████████████████████| 9.0 MB 57 kB/s 
Collecting dufte
  Downloading dufte-0.2.20-py3-none-any.whl (18 kB)
Collecting pyyaml
  Downloading PyYAML-5.4.1-cp39-cp39-manylinux2014_aarch64.whl (788 kB)
     |████████████████████████████████| 788 kB 11.1 MB/s 
Collecting numpy
  Downloading numpy-1.21.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (13.0 MB)
     |████████████████████████████████| 13.0 MB 8.3 MB/s 
Requirement already satisfied: pyparsing>=2.2.1 in /usr/lib/python3.9/site-packages (from matplotlib->stressberry) (2.4.7)
Collecting python-dateutil>=2.7
  Downloading python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
     |████████████████████████████████| 227 kB 13.3 MB/s 
Collecting cycler>=0.10
  Downloading cycler-0.10.0-py2.py3-none-any.whl (6.5 kB)
Requirement already satisfied: pillow>=6.2.0 in /usr/lib/python3.9/site-packages (from matplotlib->stressberry) (8.2.0)
Collecting kiwisolver>=1.0.1
  Downloading kiwisolver-1.3.1-cp39-cp39-manylinux2014_aarch64.whl (78 kB)
     |████████████████████████████████| 78 kB 2.3 MB/s 
Requirement already satisfied: six in /usr/lib/python3.9/site-packages (from cycler>=0.10->matplotlib->stressberry) (1.16.0)
Installing collected packages: python-dateutil, numpy, kiwisolver, cycler, matplotlib, pyyaml, dufte, stressberry
  WARNING: The scripts f2py, f2py3 and f2py3.9 are installed in '/home/facade/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts stressberry-plot and stressberry-run are installed in '/home/facade/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed cycler-0.10.0 dufte-0.2.20 kiwisolver-1.3.1 matplotlib-3.4.2 numpy-1.21.0 python-dateutil-2.8.1 pyyaml-5.4.1 stressberry-0.3.3

Last edited by graysky (2021-06-25 01:36:22)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#2 2021-06-24 19:32:53

loqs
Member
Registered: 2014-03-06
Posts: 17,369

Re: Desire to package pip installation [SOLVED]

Based on https://github.com/archlinux/svntogit-c … k/PKGBUILD

_pkgname=dufte
pkgname=python-dufte
pkgver=0.2.20
pkgrel=1
pkgdesc='Creates clean and beautiful plots that work on light and dark backgrounds.'
arch=(any)
url='https://github.com/nschloe/duf'
license=(GPL3)
depends=(python-matplotlib python-numpy)
makedepends=(python-pytest python-setuptools python-build python-install python-wheel)
source=("$pkgname-$pkgver.tar.gz::https://github.com/nschloe/$_pkgname/archive/v$pkgver.tar.gz")
b2sums=('131896389112dbc5e8aee1844ee2576bc90fcf52d9c57f4663f354cefecefa1e82977ab392d5584362ab0c7abc477346264a1db1f174d0ef0a7dc7e970e87629')

build() {
  cd $_pkgname-$pkgver
  python -m build --wheel --skip-dependency-check --no-isolation
}

check() {
  cd $_pkgname-$pkgver
  mkdir -p temp
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  python -m install --optimize=1 --destdir=temp dist/*.whl
  PATH="$PWD/temp/usr/bin:$PATH" PYTHONPATH="$PWD/temp/$site_packages" python -m pytest
}

package() {
  cd $_pkgname-$pkgver
  export PYTHONHASHSEED=0
  python -m install --optimize=1 --destdir="$pkgdir" dist/*.whl

  # Symlink license file
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  install -d "$pkgdir"/usr/share/licenses/$pkgname
  ln -s $site_packages/$_pkgname-$pkgver.dist-info/LICENSE \
    "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
}
pkgname=stressberry
pkgver=0.3.3
pkgrel=1
pkgdesc='Stress tests and temperature plots for the Raspberry Pi'
arch=(any)
url='https://github.com/nschloe/stressberry'
license=(GPL3)
depends=(python-matplotlib python-yaml python-dufte stress)
makedepends=(python-pytest python-setuptools python-build python-install python-wheel)
source=("$pkgname-$pkgver.tar.gz::https://github.com/nschloe/$pkgname/archive/v$pkgver.tar.gz")
b2sums=('3ebdcc0f0a951b9a0c8a5a35d96cda2edc535b58f08abeb3eefb281a7bb6c582e66e9eb601acce6c79ad92320c0b97ef481d2e76ffa97ae7e7033a5a7e9c38a3')

build() {
  cd $pkgname-$pkgver
  python -m build --wheel --skip-dependency-check --no-isolation
}

check() {
  cd $pkgname-$pkgver
  mkdir -p temp
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  python -m install --optimize=1 --destdir=temp dist/*.whl
  PATH="$PWD/temp/usr/bin:$PATH" PYTHONPATH="$PWD/temp/$site_packages" python -m pytest
}

package() {
  cd $pkgname-$pkgver
  export PYTHONHASHSEED=0
  python -m install --optimize=1 --destdir="$pkgdir" dist/*.whl

  # Symlink license file
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  install -d "$pkgdir"/usr/share/licenses/$pkgname
  ln -s $site_packages/$pkgname-$pkgver.dist-info/LICENSE \
    "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

Offline

#3 2021-06-24 23:40:46

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: Desire to package pip installation [SOLVED]

Thanks, I will test these out.  If good, I will push to the AUR.  Shall I credit you including your email addy or just username (point me to a pkg with your email addy if you want that).


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2021-06-24 23:43:22

loqs
Member
Registered: 2014-03-06
Posts: 17,369

Re: Desire to package pip installation [SOLVED]

Just the username is fine.  Let me know if there are any issues with the builds.

Offline

#5 2021-06-25 02:12:51

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Desire to package pip installation [SOLVED]

This violates the current packaging guidelines, and pip should NEVER be used to install anything in a PKGBUILD.

Last edited by eschwartz (2021-06-25 03:06:02)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#6 2021-06-25 02:57:20

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: Desire to package pip installation [SOLVED]

eschwartz wrote:

This violates the current packaging guidelines, and pip should NEVER be used to install anything in a PKGBUILD.

What is the source of the violation?  Not using pip.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#7 2021-06-25 10:16:42

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,920

Re: Desire to package pip installation [SOLVED]

man python wrote:

-m module-name
    Searches sys.path for the named module and runs the corresponding .py file as a script.

There is some usage of python -m on the python package guidelines page, but none of those load an install module .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#8 2021-06-25 10:33:39

loqs
Member
Registered: 2014-03-06
Posts: 17,369

Re: Desire to package pip installation [SOLVED]

Lone_Wolf wrote:
man python wrote:

-m module-name
    Searches sys.path for the named module and runs the corresponding .py file as a script.

There is some usage of python -m on the python package guidelines page, but none of those load an install module .

See Talk:Python_package_guidelines#Future_of_Python_packaging_in_Arch_Linux?

Offline

Board footer

Powered by FluxBB