Please use a crc library that provides a pure Python implementation
whitequark opened this issue · comments
Catherine commented
Right now, Apycula cannot be used with Pyodide:
>>> await micropip.install('Apycula==0.10.0')
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/lib/python3.11/site-packages/micropip/_commands/install.py", line 142, in install
await transaction.gather_requirements(requirements)
File "/lib/python3.11/site-packages/micropip/transaction.py", line 204, in gather_requirements
await asyncio.gather(*requirement_promises)
File "/lib/python3.11/site-packages/micropip/transaction.py", line 211, in add_requirement
return await self.add_requirement_inner(Requirement(req))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/lib/python3.11/site-packages/micropip/transaction.py", line 300, in add_requirement_inner
await self._add_requirement_from_package_index(req)
File "/lib/python3.11/site-packages/micropip/transaction.py", line 347, in _add_requirement_from_package_index
await self.add_wheel(wheel, req.extras, specifier=str(req.specifier))
File "/lib/python3.11/site-packages/micropip/transaction.py", line 385, in add_wheel
await self.gather_requirements(wheel.requires(extras))
File "/lib/python3.11/site-packages/micropip/transaction.py", line 204, in gather_requirements
await asyncio.gather(*requirement_promises)
File "/lib/python3.11/site-packages/micropip/transaction.py", line 208, in add_requirement
return await self.add_requirement_inner(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/lib/python3.11/site-packages/micropip/transaction.py", line 300, in add_requirement_inner
await self._add_requirement_from_package_index(req)
File "/lib/python3.11/site-packages/micropip/transaction.py", line 339, in _add_requirement_from_package_index
wheel = find_wheel(metadata, req)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/lib/python3.11/site-packages/micropip/transaction.py", line 431, in find_wheel
raise ValueError(
ValueError: Can't find a pure Python 3 wheel for 'crcmod'.
See: https://pyodide.org/en/stable/usage/faq.html#why-can-t-micropip-find-a-pure-python-wheel-for-a-package
You can use `await micropip.install(..., keep_going=True)` to get a list of all packages with missing wheels.
This is the only problematic dependency AFAICT (numpy is supported).
Pepijn de Vos commented
Any suggestions for such a library?
Catherine commented
Pepijn de Vos commented
It's only used here so the change should be simple.
Line 5 in fedab4c
I'm guessing we'll need these parameters, that's the main tricky part
https://reveng.sourceforge.io/crc-catalogue/all.htm#crc.cat.crc-16-arc
Actually, these are the current parameters:
https://crcmod.sourceforge.net/crcmod.predefined.html#predefined-crc-algorithms
Catherine commented
>>> import crcmod.predefined
>>> crc16 = crcmod.predefined.mkPredefinedCrcFun('crc-16')
>>> crc16(b"abcd")
14743
>>> calc = crc.Calculator(crc.Configuration(width=16, polynomial=0x8005, reverse_input=True, reverse_output=True))
>>> calc.checksum(b"abcd")
14743
Catherine commented
Thanks!