Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retire ujson for being in maintenance mode #2791

Closed
Elypha opened this issue May 18, 2024 · 4 comments
Closed

Retire ujson for being in maintenance mode #2791

Elypha opened this issue May 18, 2024 · 4 comments
Labels
dependencies Pull requests that update a dependency file enhancement
Milestone

Comments

@Elypha
Copy link

Elypha commented May 18, 2024

Hello,

The dev team of ujson has announced the project being in maintenance mode since 12 May 2024 (ultrajson/ultrajson@e595354), and encourges users to migrate to orjson.

Although ujson still works very well as of the time of writing, an earlier migration might benefit later developments, before ujson-exclusive features being heavily used.

Would you think it's better to retire ujson and introduce orjson instead?

@nicolargo
Copy link
Owner

Thanks for the head up @Elypha

We will migrate from UJson to Orjson in future release.

@nicolargo nicolargo added this to the Glances 4.1.0 milestone May 18, 2024
@nicolargo
Copy link
Owner

First test done in the issue2791 branch.

Result:

  • Unitest: OK
  • Unitest-Resfull: OK
  • Unittest-XmlRPC: all FAILED
./venv/bin/python ./unittest-xmlrpc.py
XML-RPC API unitary tests for Glances 4.1.0_beta01

==============================================================================
INFO: [TEST_000] Start the Glances Web Server
Run the Glances Server on port 61234
Please wait...
Glances XML-RPC server is running on localhost:61234
.
==============================================================================
INFO: [TEST_001] Connection test
XML-RPC request: getAll()
Announce the Glances server on the LAN (using 127.0.0.1 IP address)
E
==============================================================================
INFO: [TEST_002] Get plugins list
XML-RPC request: getAllPlugins()
E
==============================================================================
INFO: [TEST_003] Method: getSystem()
E
==============================================================================
INFO: [TEST_004] Method: getCpu(), getPerCpu(), getLoad() and getCore()
E
==============================================================================
INFO: [TEST_005] Method: getMem() and getMemSwap()
E
==============================================================================
INFO: [TEST_006] Method: getNetwork()
E
==============================================================================
INFO: [TEST_007] Method: getFs(), getFolders() and getDiskIO()
E
==============================================================================
INFO: [TEST_008] Method: getSensors()
E
==============================================================================
INFO: [TEST_009] Method: getProcessCount() and getProcessList()
E
==============================================================================
INFO: [TEST_010] Method: getAllLimits()
E
==============================================================================
INFO: [TEST_011] Method: getAllViews()
E
==============================================================================
INFO: [TEST_012] Method: getIrqs()
E
==============================================================================
INFO: [TEST_013] Method: getViewsCpu()
E
==============================================================================
INFO: [TEST_999] Stop the Glances Server
Stop the Glances Server
.
======================================================================
ERROR: test_001_all (__main__.TestGlances.test_001_all)
All.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nicolargo/dev/glances/./unittest-xmlrpc.py", line 64, in test_001_all
    req = json.loads(client.getAll())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not Binary

======================================================================
ERROR: test_002_pluginslist (__main__.TestGlances.test_002_pluginslist)
Plugins list.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nicolargo/dev/glances/./unittest-xmlrpc.py", line 73, in test_002_pluginslist
    req = json.loads(client.getAllPlugins())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not Binary

======================================================================
ERROR: test_003_system (__main__.TestGlances.test_003_system)
System.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nicolargo/dev/glances/./unittest-xmlrpc.py", line 81, in test_003_system
    req = json.loads(client.getSystem())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not Binary

======================================================================
ERROR: test_004_cpu (__main__.TestGlances.test_004_cpu)
CPU.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nicolargo/dev/glances/./unittest-xmlrpc.py", line 90, in test_004_cpu
    req = json.loads(client.getCpu())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not Binary

======================================================================
ERROR: test_005_mem (__main__.TestGlances.test_005_mem)
MEM.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nicolargo/dev/glances/./unittest-xmlrpc.py", line 107, in test_005_mem
    req = json.loads(client.getMem())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not Binary

======================================================================
ERROR: test_006_net (__main__.TestGlances.test_006_net)
NETWORK.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nicolargo/dev/glances/./unittest-xmlrpc.py", line 118, in test_006_net
    req = json.loads(client.getNetwork())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not Binary

======================================================================
ERROR: test_007_disk (__main__.TestGlances.test_007_disk)
DISK.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nicolargo/dev/glances/./unittest-xmlrpc.py", line 126, in test_007_disk
    req = json.loads(client.getFs())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not Binary

======================================================================
ERROR: test_008_sensors (__main__.TestGlances.test_008_sensors)
SENSORS.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nicolargo/dev/glances/./unittest-xmlrpc.py", line 140, in test_008_sensors
    req = json.loads(client.getSensors())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not Binary

======================================================================
ERROR: test_009_process (__main__.TestGlances.test_009_process)
PROCESS.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nicolargo/dev/glances/./unittest-xmlrpc.py", line 148, in test_009_process
    req = json.loads(client.getProcessCount())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not Binary

======================================================================
ERROR: test_010_all_limits (__main__.TestGlances.test_010_all_limits)
All limits.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nicolargo/dev/glances/./unittest-xmlrpc.py", line 159, in test_010_all_limits
    req = json.loads(client.getAllLimits())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not Binary

======================================================================
ERROR: test_011_all_views (__main__.TestGlances.test_011_all_views)
All views.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nicolargo/dev/glances/./unittest-xmlrpc.py", line 168, in test_011_all_views
    req = json.loads(client.getAllViews())
                     ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/xmlrpc/client.py", line 1122, in __call__
    return self.__send(self.__name, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/xmlrpc/client.py", line 1461, in __request
    response = self.__transport.request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/xmlrpc/client.py", line 1166, in request
    return self.single_request(host, handler, request_body, verbose)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/xmlrpc/client.py", line 1182, in single_request
    return self.parse_response(resp)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/xmlrpc/client.py", line 1351, in parse_response
    return u.close()
           ^^^^^^^^^
  File "/usr/lib/python3.12/xmlrpc/client.py", line 668, in close
    raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault 1: "<class 'TypeError'>:Dict key must be str">

======================================================================
ERROR: test_012_irq (__main__.TestGlances.test_012_irq)
IRQS
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nicolargo/dev/glances/./unittest-xmlrpc.py", line 176, in test_012_irq
    req = json.loads(client.getIrq())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not Binary

======================================================================
ERROR: test_013_plugin_views (__main__.TestGlances.test_013_plugin_views)
Plugin views.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nicolargo/dev/glances/./unittest-xmlrpc.py", line 184, in test_013_plugin_views
    req = json.loads(client.getViewsCpu())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not Binary

----------------------------------------------------------------------
Ran 15 tests in 3.204s

FAILED (errors=13)
make: *** [Makefile:73 : test-xmlrpc] Erreur 1

@Elypha
Copy link
Author

Elypha commented May 18, 2024

ah I guess this might be related to an orjson feature that it loads and dumps utf8 encoded bytes instead of python str

@nicolargo nicolargo added enhancement dependencies Pull requests that update a dependency file labels May 20, 2024
@nicolargo
Copy link
Owner

Merged into the develop branch.

UJson is no longer a Glances dependency.

Thanks for the recommendation @Elypha !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement
Projects
None yet
Development

No branches or pull requests

2 participants