pendulum
pendulum copied to clipboard
pendulum does not seem to be compatible with zipapp
The new zipapp module permits one to create a bundled python program inside of a zip file. I went ahead and made such a program but I have an issue when I try to execute it, it seems like pendulum is not able to locate the locale files.
import pendulum
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "dist/bobctl.pyz/pendulum/__init__.py", line 9, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "dist/bobctl.pyz/pendulum/datetime.py", line 11, in <module>
def _cmp(x, y):
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "dist/bobctl.pyz/pendulum/date.py", line 10, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "dist/bobctl.pyz/pendulum/helpers.py", line 43, in <module>
File "dist/bobctl.pyz/pendulum/formatting/difference_formatter.py", line 12, in __init__
File "dist/bobctl.pyz/pendulum/locales/locale.py", line 38, in load
ValueError: Locale [en] does not exist.
Where u ever able to fix that?
It's been a really long time. I think I ended up using pyinstaller.
I don't think it is possible to package pendulum into a zipapp because pendulum includes C extensions. As per "Caveats" (https://docs.python.org/3.9/library/zipapp.html#caveats), packages with C extensions cannot be used in zipapp.
You could build a pure-python version from source if you really need to. I don't think we will be providing non-C wheels. I consider this issue resolved.
You could build a pure-python version from source if you really need to. I don't think we will be providing non-C wheels. I consider this issue resolved.
Actually simply building from source is not enough since an extension is still created and zipapp does not work with extensions. So this won't work:
pip install --no-binary :all: pendulum
What may work is installing pendulum without extensions:
PENDULUM_EXTENSIONS=0 pip install --no-binary :all: pendulum
.
You could build a pure-python version from source if you really need to. I don't think we will be providing non-C wheels. I consider this issue resolved.
Actually simply building from source is not enough since an extension is still created and zipapp does not work with extensions. So this won't work:
pip install --no-binary :all: pendulum
What may work is installing pendulum without extensions:
PENDULUM_EXTENSIONS=0 pip install --no-binary :all: pendulum
.
That is exactly what I meant by building pure-python version from source