loading...
Cover image for Wow can python do that?

Wow can python do that?

gillarohith profile image Rohith Gilla ・2 min read

can python do that (6 Part Series)

1) Wow can python do that? 2) Wow can python do that? -2 3 ... 4 3) Package Managers in python πŸš€ 4) Making neural nets uncool, Open GPU Data Science, Simple. Flexible. Powerful. 5) Wow can python do that πŸ€” 6) Hey Python 🐍, say cheese πŸ§€

Hey everyone, I wanted to start a new series in dev.to with name can python do that.

This series aims to cover python libraries which are amazing and beginner friendly. As a part of this series I will include 3 libraries every week. If this seems less in number please feel free to comment the frequency of the articles to be posted. I would love to catch up with the speed.

Ready

TLDR;
Libraries we will be glancing today are

  • Kivy
  • Toga
  • Dash

For all those JS fans out there you know you can develop application in Javascript for Mobile (iOS and Android), Desktop(macOS, Linux and Windows) using technologies like Electron, React Native.
Spoiler Alert: React Native for macOS and Windows. Microsoft blog post

Would you be amazed if I say we can do same native application development using Python πŸ€” πŸ™ŒπŸ»
Mind Blown Gif

Kivy

Kivy Logo

Kivy - Open source Python library for rapid development of applications that make use of innovative user interfaces, such as multi-touch apps.

PYPI
Docs

There is an application which was used in Pycon India 2018 which is built entirely on Kivy.

GitHub logo pythonindia / PyCon-Mobile-App

PyCon India App developed with Kivy

PyCon India 2018 Application

Mobile App for PyConIndia

Requirements:

Kivy Installation:

Dependencies-

Install from pip

  • pip install -r requirements.txt

WIP

To test install kivy and run the following::

$ python eventsapp/main.py -m screen:droid2,portrait -m inspector
$ python3 eventsapp/main.py -m screen:droid2,portrait -m inspector

Help on screens

To change images in app

  • Paste/change the image in PyCon-Mobile-App/tools/theming
  • Change your directory to PyCon-Mobile-App
  • Run command make theming

This command will aggregate all the png images in your file to one atlas from which the images are loaded.

to make apk prefer linux

  1. Install buildozer: pip install buildozer
  2. Edit the buildozer.spec to specify if you have android ndk and sdk if not they will be automatically be downloaded by the next step.
  3. Connect your mobile, enable usb debugging, Then goto PyConIndia folder and type make apk

Link to a existing vm that can be re-used will be added for convenience.

to make

…

Toga

Toga Logo
Toga uses native system widgets, not themes. When you see a Toga app running, it doesn’t just look like a native app - it is a native app. Applying an operating system-inspired theme over the top of a generic widget set is an easy way for a developer to achieve a cross-platform goal, but it leaves the end user with the mess.

Fun Fact
So, why is it called "Toga"?
When in Rome, do as the Romans do. And what does a Roman wear? A Toga!

PYPI
Docs

Dash

Dash Logo
Dash is a Python framework for building analytical web applications. No JavaScript required.Built on top of Plotly.js, React and Flask, Dash ties modern UI elements like dropdowns, sliders, and graphs directly to the python code.
The Dash platform empowers Data Science teams to focus on the data and models, while producing and sharing enterprise-ready analytic apps that sit on top of Python and R models. What would typically require a team of back-end developers, front-end developers, and IT can all be done with Dash.

PYPI
Docs

Follow me so that you won't miss new posts under this series.

gillarohith image

Thanks

Spoiler Alert: Next week we will see a framework with which building data apps would be like eating a pie πŸ₯§

Peace ✌🏻,
Rohith Gilla

can python do that (6 Part Series)

1) Wow can python do that? 2) Wow can python do that? -2 3 ... 4 3) Package Managers in python πŸš€ 4) Making neural nets uncool, Open GPU Data Science, Simple. Flexible. Powerful. 5) Wow can python do that πŸ€” 6) Hey Python 🐍, say cheese πŸ§€

Discussion

markdown guide
 

Just FYI, if you're hoping to deploy a Kivy application to Linux, you're in for a world of pain. Learned that from personal experience. The problem is that you cannot pip install Kivy and its Cython depedency in the same command, breaking nearly every known packaging tool and pattern. PyInstaller works, but only if you ignore good packaging practice and allow it to bundle nearly everything, wherein it cannot be packaged on Linux portably at all. You'll even notice their official packaging guide does not talk about how to package for Linux.

In case anyone is wondering, this wasn't "me". I got help from one of Kivy's core developers (tshirtman), from a primary Snapcraft developer (Alan Pope), one of the core AppImage developers (TheAssassin), and a Debian packaging mentor (pabs) in turn. After months of this, the end conclusion was simple: NOPEnopenopenopenopeNOPEnopenope. (I believe that incident is why the Kivy documentation now fully acknowledges that the Linux wheels are "experimental".) The bug is known, isolated, and documented. It's just harder to fix than anyone anticipated.

Long story short, while Kivy is "compatible" with Linux, it isn't packagable with Linux. Stick with PySide2 for portable desktop UIs.

 

Oh thanks for the note.
Will keep that in mind.
Btw were you able to deploy the Linux app finally?

 

Nope! When I have the time, I have to rebuild it in PySide2. Three years wasted.

Ouch πŸ˜“
Thanks for the review, it will help others who are reading the post.

 

Why a week consists of 7 days, not less? Waiting for next week's post.

 

Wow that’s so nice. I’m happy that you liked my post.
I’ll make sure my next post is worth all the wait.
Thanks