PythonistaAppTemplate icon indicating copy to clipboard operation
PythonistaAppTemplate copied to clipboard

Anyway to add new modules?

Open eminarcissus opened this issue 8 years ago • 11 comments

In a native pythonista implementation we cannot add cython modules because we don't have a c compiler in iOS runtime. Is there anyway to add a cython module to a Xcode project to pre compile the module and have it linked in the project?

eminarcissus avatar May 04 '16 07:05 eminarcissus

Hello emin, I have the exact same problem... I would like to create a standalone app but my script need 3 more modules to work properly : twisted, PyNacl( require libsodium a C librairies) and pyblake2 ! Did you find a solution to link thoose modules in the project ?

Cerise1 avatar Jul 09 '16 14:07 Cerise1

Have no way out until now. I guess Pythonista itself is a self contained lib, so there's no way to extend our c lib unless re-compile python with it.

eminarcissus avatar Jul 09 '16 14:07 eminarcissus

And do you think its possible to recompile Python with it ? I am stuck on my project be cause of that ! I thought it was a great way to run Python 3.5 code in an iOS app as i dont know other way to install Python 3.5 on the idevice even if its jailbroken.. And i cant use Python 2.. :(

Cerise1 avatar Jul 09 '16 14:07 Cerise1

Pythonista isn't a platform to magically make your Python scripts run as an iOS app. You'll have to compile the C libraries yourself and link them with Python. You'll probably need more technical knowledge than it sounds like you have

controversial avatar Jul 09 '16 14:07 controversial

Yes i agree with you i need more Technical knowledge to do that but i ve been searching for 3 days on the Internet how to manualy compile and link C lib with Python i dont find anything ! I am sure its long to explain but could you redirect me some where i could learn that or could you Tell me what should i learn i am ok to work and spend Time ! Or if you have a better idea to run Python 3.5 code in iOS app i would be gratefull :)

Cerise1 avatar Jul 09 '16 14:07 Cerise1

The easiest thing to do is wait until @omz updates the template.

allanburleson avatar Jul 09 '16 14:07 allanburleson

Right. This template does not yet support Python 3.

You can install Twisted by copying its files to site-packages, I think you'll need zope.interfacefirst as well. You're out of luck for libsodium though. Could you rewrite your code not to use it?

controversial avatar Jul 09 '16 15:07 controversial

I think that the default script is written in Python 3 ( print('hello world') ) with the () ! You sure that it doesnt support Python 3 ?

Yes you are right i had the zope.interface error when i tested to add twisted file manualy ! No i cant i woud not be able to rewrite all its very long and complex : a lot of thing are on top of pyNacl.. :(

Cerise1 avatar Jul 09 '16 15:07 Cerise1

I'm pretty sure it doesn't. That's just good practice for when it is ready for Python 3 since that's backwards-compatible.

allanburleson avatar Jul 09 '16 15:07 allanburleson

Why the default script main.py would be written in Python 3 ( with print interpreted as a function with parenthesis) if the template is not compatible with Python 3 though ?

Cerise1 avatar Jul 09 '16 15:07 Cerise1

@Cerise1 That's perfectly valid Python 2 code.

controversial avatar Jul 09 '16 15:07 controversial