You are not logged in.

#1 2024-01-05 21:35:21

SchaengJuan
Member
Registered: 2024-01-05
Posts: 4

PKGBUILD review: python-julia

Hello everyone,

as I am pretty new to PKGBUILD and python package in general, I would like to get some feedbacks before I try to push my PKGBUILD. The current AUR version of python-julia is outdated and seems to be broken. Following is my attempt

# Maintainer: SchaengJuan
# Contributor: j605

_name="julia"
pkgname="python-${_name}"
pkgver=0.6.2
pkgrel=1
pkgdesc="python interface to julia"
arch=('any')
url="https://github.com/JuliaPy/pyjulia"
license=('MIT')
depends=('python' 'julia-bin')
checkdepends=(python-tox)
makedepends=('python-pypandoc' 'pandoc' 'python-setuptools')
source=("$pkgname-$pkgver.tar.gz::https://github.com/JuliaPy/pyjulia/archive/v$pkgver.tar.gz")
sha256sums=('ca2291bd5560535215f544ec44825a6435462a8c55820c253555b43648bc098d')

build() {
  cd "pyjulia-$pkgver"
  python setup.py build
}

check() {
  cd "pyjulia-$pkgver"
  # install PyCall is necessary to pass the test; change the python env might not be necessary
  julia -e 'using Pkg; ENV["PYTHON"]="/usr/bin/python"; Pkg.add("PyCall")'
  tox
}

package() {
  cd "pyjulia-$pkgver"
  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  install -Dm 644 LICENSE.md "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.md"
}

Other than changing the package version and checksum and add  python-setuptools as dependency, I added

 julia -e 'using Pkg; ENV["PYTHON"]="/usr/bin/python"; Pkg.add("PyCall")' 

. Otherwise, the test will not be passed with the following error

PyCall is not installed or built.  Run the following code in Python REPL:

    >>> import julia
    >>> julia.install()

See:
    https://pyjulia.readthedocs.io/en/latest/installation.html

Exit: PyCall not built
!!!!!!!!!!!!!!!!!!! _pytest.outcomes.Exit: PyCall not built !!!!!!!!!!!!!!!!!!!!

Installing the PyCall is just a quick workaround and as a result I need to put julia-bin as a dependence as well. Setting the python path to the system python might be unnecessary, but without it there might be some problems if one has used python-julia in some virtualenv.

So basically, I am not sure about if adding the julia commands is reasonable in the PKGBUILD. Any thoughts?

Last edited by SchaengJuan (2024-01-05 21:36:34)

Offline

#2 2024-01-06 17:23:49

yochananmarqos
Member
Registered: 2020-02-05
Posts: 192

Re: PKGBUILD review: python-julia

Either add python-pycall to the AUR or skip the tests. You're missing the other test requirements as well.

Upstream installs PyCall via their own CI script. I neither recommend doing it that way nor the way you attempted. That should only be run in a chroot or CI.

I don't know where PyPandoc and Pandoc are coming from, they're not used at all.

Why are you using julia-bin from the AUR instead of julia in the extra repo?

Something like this:


pkgname=python-julia
_name=pyjulia
pkgver=0.6.2
pkgrel=1
pkgdesc="Python interface to julia"
arch=('any')
url="https://github.com/JuliaPy/pyjulia"
license=('MIT')
depends=('julia' 'python')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
checkdepends=('ipython' 'python-mock' 'python-numpy' 'python-pycall' 'python-pytest-cov' 'python-tox')
source=("$_name-$pkgver.tar.gz::https://github.com/JuliaPy/pyjulia/archive/v$pkgver.tar.gz")
sha256sums=('ca2291bd5560535215f544ec44825a6435462a8c55820c253555b43648bc098d')

build() {
  cd "$_name-$pkgver"
  python -m build --wheel --no-isolation
}

check() {
  cd "$_name-$pkgver"
  python -m tox -- --verbose --cov=julia
}

package() {
  cd "$_name-$pkgver"
  python -m installer --destdir="$pkgdir" dist/*.whl

  install -Dm644 LICENSE.md -t "$pkgdir/usr/share/licenses/$pkgname/"
}

Last edited by yochananmarqos (2024-01-06 17:29:17)

Offline

#3 2024-01-07 20:27:58

SchaengJuan
Member
Registered: 2024-01-05
Posts: 4

Re: PKGBUILD review: python-julia

Thanks for the reply smile Your make and check dependencies make more sense. However, I tried my PKGBUILD with clean chroot without problems due to these packages. I thought it is what clean chroot is for, prevent missing deps?

yochananmarqos wrote:

Either add python-pycall to the AUR or skip the tests. You're missing the other test requirements as well.

PyCall.jl is a julia package and julia packages are usually controlled by julia's package manager. There is no python-pycall (well this pycall is something else). Can you elaborate on "missing other test requirements"?

yochananmarqos wrote:

Upstream installs PyCall via their own CI script. I neither recommend doing it that way nor the way you attempted. That should only be run in a chroot or CI.

Why are these not recommended? After all, PyCall.jl must be installed for python-julia to work properly, see the official installation guide.

yochananmarqos wrote:

I don't know where PyPandoc and Pandoc are coming from, they're not used at all.

You are correct, these are left by the current maintainer.

yochananmarqos wrote:

Why are you using julia-bin from the AUR instead of julia in the extra repo?

julia is compiled against system libs and julia-bin is against patched: see the wiki page of julia. Basically, in order to make julia "usable", it is probably a good idea to use julia-bin.

Last edited by SchaengJuan (2024-01-07 20:33:41)

Offline

#4 2024-01-07 20:58:39

yochananmarqos
Member
Registered: 2020-02-05
Posts: 192

Re: PKGBUILD review: python-julia

There's no way the tests passed without the required dependencies. See the upstream test requirements.

Last edited by yochananmarqos (2024-01-07 21:01:47)

Offline

#5 2024-01-07 21:13:00

SchaengJuan
Member
Registered: 2024-01-05
Posts: 4

Re: PKGBUILD review: python-julia

Are you referring to this line? It runs the script which install PyCall.jl.

Offline

#6 2024-01-07 21:18:03

yochananmarqos
Member
Registered: 2020-02-05
Posts: 192

Re: PKGBUILD review: python-julia

I think you may have seen my reply before I corrected it. See my most recent edit.

Offline

#7 2024-01-12 14:53:29

SchaengJuan
Member
Registered: 2024-01-05
Posts: 4

Re: PKGBUILD review: python-julia

Yes, absolutely. For whatever reason the setup.py doesn't say that some deps are misisng. This leads to another question, in the repo, there is no toml file for build and installer. Why does your PKGBUILD still work?

Also do you still think using the CI script or julia to install PyCall is ok in this case? Thanks

Offline

Board footer

Powered by FluxBB