packages icon indicating copy to clipboard operation
packages copied to clipboard

python-uci: Update to 0.10.0

Open Nemirtingas opened this issue 1 year ago • 4 comments

Maintainer: @BKPepe

Description: Update to 0.10.0 (allows creation of anonymous config) https://gitlab.nic.cz/turris/pyuci/-/tags/v0.10.0

Nemirtingas avatar Oct 03 '24 08:10 Nemirtingas

Thanks for creating such an issue, but I haven't seen that Turris has been using that version since it was released, and that's for more than one year already. Most likely, Turris package managers such as @muzikr or @Zatharalex should look into it. It's their package, after all, and they use it daily on their routers.

BKPepe avatar Oct 03 '24 09:10 BKPepe

Hi, Any tips on how I could update it in my openwrt image? At my work here, they build their own openwrt image with embeded packages and kernel modules. I'm creating an ansible python module to manipulate uci configuration through python-uci.

I've updated the Makefile of feeds/packages/lang/python/python-uci like so:

#
# Copyright (C) 2018-2022 CZ.NIC, z. s. p. o. (https://www.nic.cz/)
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=python-uci
PKG_VERSION:=0.10.0
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://gitlab.nic.cz/turris/pyuci
PKG_SOURCE_DATE:=2023-08-03
PKG_SOURCE_VERSION:=89c638444207277cab8ac76c302c18df9775d1e2
PKG_MIRROR_HASH:=5806d2ff9001c6286e8ae7a89cc506eda62d749d147be227145f60744fc2e947

#PYPI_NAME:=pyuci
#PKG_HASH:=847b8f365d1b5ff5e241cd0a666dff23098be27021b5aca982a48235dc4aeca2

PKG_MAINTAINER:=Josef Schlehofer <[email protected]>
PKG_LICENSE:=GPL-3.0-or-later
PKG_LICENSE_FILES:=LICENSE

include ../pypi.mk
include $(INCLUDE_DIR)/package.mk
include ../python3-package.mk

define Package/python3-uci
  SECTION:=lang
  CATEGORY:=Languages
  SUBMENU:=Python
  TITLE:=Python UCI bindings
  URL:=https://gitlab.nic.cz/turris/pyuci/
  DEPENDS:=+python3-light +libuci
endef

define Package/python3-uci/description
  Python3 bindings for Unified Configuration Interface.
endef

$(eval $(call Py3Package,python3-uci))
$(eval $(call BuildPackage,python3-uci))
$(eval $(call BuildPackage,python3-uci-src))

It seems to build fine but fails with the following error: No such file or directory: '/workdir/openwrt/build_dir/target-x86_64_musl/python-uci-0.10.0//openwrt-build/python_uci-0.10.0-*.whl' The file in that directory is named pyuci-0.10.0-cp311-cp311-linux_x86_64.whl

Any idea?

Nemirtingas avatar Oct 03 '24 09:10 Nemirtingas

For the beginning, I think @shenek should upload new version of PyUCI to PyPI, because there isnt the latest one, which you can see here: https://pypi.org/project/pyuci/

BKPepe avatar Oct 03 '24 09:10 BKPepe

Fixed my compile issue, replace PKG_NAME:=python-uci with PKG_NAME:=pyuci, that'll be my workaround until the package is officially updated.

Nemirtingas avatar Oct 03 '24 09:10 Nemirtingas

Any plans to release v0.10.0 on PyPI?

Carmezim avatar Feb 03 '25 16:02 Carmezim

Hi, version 0.10.2 should be available in PyPI.

shenek avatar Feb 20 '25 15:02 shenek

Note that pyuci with another bugfix was released. So the current version is 0.10.3 now.

shenek avatar Feb 27 '25 08:02 shenek

Hi, thank you for the updates. I noticed that the anonymous section are quite buggy. If the uci configuration has been loaded, a call to .add will throw an "Duplicate Entry" exception, section too has an issue, you have to create a new section before applying any change to it or you will encounter "Duplicate Entry" or "Bad argument" exceptions.

For example, I create an anonymous section, if I rename it and then try to change its content, it throws an exception. But if you create the anonymous section, you update it and then rename it, there is no exception.

Nemirtingas avatar Feb 27 '25 10:02 Nemirtingas

If you got some time, I'd be really grateful if you could implement python_ubus notify and subscribe. There is already old tickets about that on the gitlab, but I cannot connect to it and know very little about Python bindings.

Nemirtingas avatar Feb 27 '25 10:02 Nemirtingas

Guys, @muzikr and @Zatharalex, are you interested to update it here, so you can use it in your distribution or not? If not, we might remove not maintained packages.

BKPepe avatar May 21 '25 10:05 BKPepe

I missed this. Sorry about that. I will update it here as soon as possible.

muzikr avatar May 22 '25 13:05 muzikr

Kind reminder. :)

BKPepe avatar Jun 11 '25 13:06 BKPepe

I haven't forgotten about this, but I am struggling with it. The problem is that in newer versions, @shenek used ext-modules from setuptools (see here). This feature was added to setuptools in v74.1.0 (see here).

If I understand correctly, the version used for the build on the host is the one specified in python3-version.mk. Updating it would result in build failures for many packages.

I am still trying to find some solution.

muzikr avatar Jul 01 '25 09:07 muzikr

I am thinking a little bit loud, but what is wrong to update Python in this repository? 🤔 It would solve your problem. Yeah, there might be some incompatibility, but that's can be fixed as well, right? 😇

BKPepe avatar Jul 14 '25 20:07 BKPepe

I am thinking a little bit loud, but what is wrong to update Python in this repository? 🤔 It would solve your problem. Yeah, there might be some incompatibility, but that's can be fixed as well, right? 😇

Well IMHO updating python to 3.12 won't be smooth as you expect. Because distutils package was removed from the standard library. Which may cause that all packages that were somehow using distutils will be broken. Note that it may be possible that such package will be created, but it will fail during the runtime (missing python import).

https://docs.python.org/3.12/library/distutils.html

And secondly it won't solve our problem, because we are not using distutils in pyuci but setuptools. Package setuptools in this repo is outdated. It uses a version which doesn't support working with pyproject.toml.

shenek avatar Jul 14 '25 20:07 shenek

Because distutils package was removed from the standard library. Which may cause that all packages that were somehow using distutils will be broken.

No worries over here, here! We already have support for building packages, which are using pyproject.toml. See: https://github.com/openwrt/packages/pull/20801

Package setuptools in this repo is outdated. It uses a version that doesn't support working with pyproject.toml.

In this repo? Nah. :) Not our fault. Python 3.11 and older versions are shipping bundled libs. Feel free to check it here: https://github.com/python/cpython/commits/3.11/Lib/ensurepip/_bundled while you are checking it, I have great news for you! It looks like the upcoming Python 3.11.14 will have updated setuptools, and as said by @muzikr, you defined ext-modules via pyproject.toml, and indeed, he is right, setuptools, which is bundled with the currently released Python 3.11, does not support it. I haven't checked if it is still experimental or not.

BTW: Python 3.11 is still supported till 10/2027, but updating to Python 3.12, 3.13 as proposed earlier by me, it needs to be done, no matter what and there is no reason for looking for excuses.


As a temporary solution, because it looks like you forgot about it (once again) or did not know how to do it properly, I prepared a pull request, where I added back setup.py, removed pyproject.toml to force the use of setup.py, and I was able to compile it. It was not so difficult, and there is no reason that this issue has been here for almost a year now.

BKPepe avatar Jul 15 '25 08:07 BKPepe