Hi, thanks for creating this!
I noticed you implemented add
, which I desperately want to have.
Would you mind taking the time to publish 0.10 to pypi? Thanks!
setup.py
to pyproject.toml
hatch
DEPRECATION: pyuci is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for pyuci ... done
I have a distinct ever-growing-never-freed memory usage in the following simple python main; tracemalloc points to the anonymous uci.get. On our host, firewall is the biggest (wc) config, but the leak is evident in smaller configurations too (though more slow).
Is this a known issue? The machine is an ar300m-gl-inet sbc with custom image, compiled off openwrt 22.03.5. If you are wondering whether tracemalloc could be the curlpit - I reproduced the "leak" without it, and added it later, as a measure of troubleshooting.
import time
import tracemalloc
import uci
tracemalloc.start()
def loop_memory_test() -> None:
iterations = 10000
one = 0
while one < iterations:
with uci.Uci() as _uci:
_ = _uci.get("firewall")
one += 1
snapshot = tracemalloc.take_snapshot()
top_stats = snapshot.statistics('lineno')
for stat in top_stats[:10]:
print(f"{stat=}")
if one % 100 == 0:
time.sleep(2)
tracemalloc.stop()
if __name__ == "__main__":
loop_memory_test()
Štěpán Henek (004c6468) at 03 Aug 11:34
Release version 0.10.0
Štěpán Henek (89c63844) at 03 Aug 11:33
Release version 0.10.0
Štěpán Henek (549922b0) at 03 Aug 11:32
Štěpán Henek (f0034365) at 03 Aug 11:32
Štěpán Henek (549922b0) at 03 Aug 11:30
Release version 0.10.0
Štěpán Henek (d29a2f2a) at 03 Aug 11:30
Release version 0.10.0
Štěpán Henek (f0034365) at 03 Aug 10:59
Štěpán Henek (f0034365) at 03 Aug 10:59
euci: implement add for both anonymous and non-anonymous sections
Štěpán Henek (f0034365) at 03 Aug 10:57
euci: implement add for both anonymous and non-anonymous sections
Štěpán Henek (726ac36f) at 03 Aug 10:52
euci: implement add for both anonymous and non-anonymous sections
... and 2 more commits
Looks good, don't have any further concerns. You may rebase and merge it.
Štěpán Henek (aa47dd01) at 27 Jul 14:34
fixup! euci: implement add for both anonymous and non-anonymous sec...
Thanks for the quick check. I hope that I addressed all your concerns.
The anonymous section are always created and if the section already exists no exception is thrown. If the section_type of existing named rule differs. The section_type is overridden by the new one.
It behaves in the same way as cmd
uci set firewall.named_rule='new_name'