Latest News on Python / Updates in Python / Discussions on Python

Python apps might soon be running on Android - Developers of Python push for Python-built applications running on mobile devices

Python creator Guido van Rossum and some Python developers have hoped that apps written in Python may one day run natively on iOS and Android devices.

This could now happen thanks to BeeWare, (an open-source project) which is porting CPython to Android, so apps written in Python can run natively on Android.

What is BeeWare?

BeeWare is aiming to let developers write apps in Python and get that code running everywhere using user interface (UI) widgets. It wants to help developers write Python apps using the same codebase running on iOS, Android, Windows, macOS, Linux, browsers, and tvOS.

What is CPython?

CPython is the reference implementation of the open-source Python language used by other implementations such as Jython, which is written in Java that relies on a Java virtual machine (JVM).

Why did a mobile implementation of Python take so long? 

Simply put, Python is not cut out for mobile in the way it has been for desktop systems.

To address this shortcoming, last year the Python Software Foundation awarded the BeeWare project a $50,000 grant to bring its level of Android support up to par with its tools for iOS.

The CPython Android port would have to support most modern Android hardware running version 4.4 or later.

BeeWare Plan of Action

Originally BeeWare's Android strategy was to compile Python to Java bytecode.

However, Android devices have improved significantly so much that the Android kernel permissive enough, to run CPython itself,

A major obstacle the open source project faced was the size of Android apps written in Python because they require their own copy of the Python runtime, meaning Python needed to be shrunk down for mobile

Some have suggested solving this problem by creating a stripped-back 'kernel' version of Python in combination with a package installer (pip) that lets developers install packages for a target platform rather than just the system it's running on. 

Another issue raised by the open source project was that to regular Python programmers, the mobile environment is an alien planet - There are no sub processes; sockets, pipes and signals all behave differently than on regular Unix; and many system calls are prohibited. Transport Layer Security (TLS) certificate handling on Android is particularly quirky. For the CPython test suite to pass on mobile, it must skip the numerous tests that use fork or spawn, or use signals, or any other APIs that are different or absent. 

And with all these issues...

The founder of BeeWare, Russell Keith-Magee announced the project's first major Android milestone after getting a 'pure' Python application to run on an Android device.

Source:

https://www.zdnet.com/article/programming-languages-python-apps-might-soon-be-running-on-android/


The final release of Python 2.7

Timeline

Python 2.7.0 was released on July 3rd, 2010. Python 2.7 was scheduled to be the last major version in the 2.x series.

When Python 3 arrived in December 2008 it was as a backwards incompatible major release and there was a lot of resistance to upgrading

Python 2.7 support was meant to end in 2015 but was extended five years until 2020, six years after Python's creator, Guido van Rossum, announced Python 3 and implored users to "move on to Python 3". 

January 1, 2020 also looked set to be the end of life for Python 2.7, but it was eventually decided that should happen in April 2020 with the just-released Python 2.7.18. 

The Python Software Foundation have confirmed this is the last ever update for it and is urging users to move on to Python 3 to continue receiving first-party support.

Why did it take so long?

Python core developers' policy dictated that no new features should be added to maintenance releases

Large changes occurred midway through Python 2.7's life, such as PEP 466's feature backports to the ssl module and hash randomization.

So the developers decided to make an exception because of how important Python had become to the web and because using an outdated version of OpenSSL in Python 2.7 had broader implications for internet security.

In addition, it took many years for major Python users like Facebook, Instagram, and Dropbox to fully move to Python 3

The future of Python

In the early years of Python 3 there were some justifiable reasons for sticking with the established and well embedded Python 2 - mainly many of its popular librairies were slow to support Python 3 . This excuse ran out quite a while ago.

Python 2 will however no doubt linger on. A survey from Active State found that fewer than half its respondents had planned for the end of support of Python 2 and that for over a third half of their Python apps were on the Python 2 branch

Due to the corona virus pandemic PyCon 2020 which would have been taking place right now in Pittsburgh, Pennsylvania, had to be cancelled, so depriving the community its chance for giving Python 2 a final emotional send off.

Source:

https://www.zdnet.com/article/goodbye-python-2-programming-language-this-is-the-final-python-2-7-release/

https://www.i-programmer.info/news/216-python/13640-final-ever-release-of-python-2.html

https://www.theregister.co.uk/2020/04/21/the_final_python_2_release/


The need for Data Scientists in businesses and Python

The History of Data Science

Businesses are continually investing in ways that they can expand and grow. One of the ways in which they choose to this is with the use of data.

Businesses that have a vast and growing pool of data regarding key performance indicators such as customer experience. Their needs to be a method of making sense of the data.

This is where data scientists can be advantageous, data scientists identify problem areas of their businesses, or to plan new marketing initiatives. This would give the business competitive insights to help them pull ahead.

Why choose Python for Data Science 

The simplicity of Python has made it very popular among data scientists. Python is easy to learn compared to the likes of R and MATLAB, it offers a myriad of inbuilt features that lend itself to developers, is highly extensible, and is excellent for implementing algorithms and managing data.

Data scientists often need to incorporate statistical code into the production database or integrate the existing data with web-based applications. Apart from these they also need to implement algorithms daily. Python makes all these tasks a hassle-free affair for data scientists

Data scientists can approach a problem using a variety of strategies, there is flexibility compared to more rigid languages that mandate only a certain way of doing things.

Data scientists can utilize data science libraries such as NumPy and SciPy to quickly start on scientific computing and technical computing tasks. And because so many data scientists already know Python, this also means that new data science libraries are likely to support it from the get-go.

Finally, the popularity of Python lends itself to a virtuous cycle of success: As more data scientists use Python, more code and tools will be created solely for Python. And what it all means is this: an aspiring data scientist will need to brush up on Python to excel.

Source:

https://www.cdotrends.com/story/14792/why-data-scientists-must-learn-python?refresh=auto


Successfully using Python for both prototyping the machine learning pipeline as well as deploying at scale in a production HPC environment

Researchers from the University of California Davis alongside the National Energy Research Scientific Computing Center, and Intel are working together the DisCo project.

What is the DisCo project?

The DisCo project stands for the Discovery of Coherent Structures. 

What do the DisCo project do?

A major challenge of deep learning is that it requires large amounts of labeled training data. 

The DisCo project aims to extract insight from complex unlabeled data.

Examples of unlabeled data such as extreme weather events in atmospheric dynamics

The use of Python in the DisCo project

Python’s simplicity has made it a go to language for data scientists. However that does not come with its own set of issues;

Python prototypes must be rewritten for production deployment using lower-level languages like C/C++. While this produces high-performance code, it can incur considerable costs. 

The DisCo project have come up with a way of using Python for both prototyping the machine learning pipeline as well as deploying at scale in a production High-performance computing environment.

The ability to run Python code in production by achieving similar performance as the C/C++ code is important.

Intel added support for distributed clustering via Intel daal4py and optimized library functions for the high-dimensional problem datasets used in DisCo

How was this achieved?

The use of Open source libraries and tools such as Numpy and the Numba open source JIT compiler allowed the team to optimize the full pipeline.

By parallelizing and vectorizing portions of the Python pipeline that are not part of Intel MKL and Intel DAAL, they ensured the end-to-end machine learning workflow was optimized for performance.

The DisCo algorithm approximates causal equivalence using two stages of clustering, assigning the same local causal state label to all effectively equivalent points. The reconstructed local causal states then identify distinct space-time structures in the data.

Future aims for DisCo

  • First distributed-memory implementation of local causal state reconstruction opening the door to processing very large real-world causal data sets.
  • Performs unsupervised coherent structure segmentation on complex realistic fluid flows.
  • Achieved good single-node, weak scaling, and strong scaling performance up to 1024 nodes.
  • Use Python to achieve high performance while maintaining developer productivity by using a vendor optimized version of Python, various supporting libraries, and compilers.

Source:

https://www.nextplatform.com/2020/04/15/python-delivers-big-on-complex-unlabeled-data/

https://ieeexplore.ieee.org/document/8950692


Python Visual Studio Code Update Introducing a new debugger ‘debugpy’

The current issue with debugging

Sometimes you may want to attach the debugger to a Python process that is running on your machine, but that can be tricky if, for example, you don’t have control over the application that launched that process. To resolve this VS code has introduced debugpy

What is debugpy?

debugpy implements the Debug Adapter Protocol: debugProtocol.json

How can I use debugpy?

Its as simple as selecting ‘Add Configuration…’ then selecting ‘Attatch using Process ID’ this will add the following code to your launch.json file

“name”: “Python: Attach using Process Id”, 
“type”: “python”, 
“request”: “attach”, 
“processId”: “${command:pickProcess}” 
}

When you start a debug session with this configuration selected, a list of processes to which you can attach the debugger will be displayed, and once you pick one, the debugger will attempt to attach to it.

For more information:

Wiki: https://github.com/microsoft/debugpy/wiki

Github: https://github.com/microsoft/debugpy

Source: https://devblogs.microsoft.com/python/python-in-visual-studio-code-march-2020-release/


Uber introduces Fiber – A python library that promises to deal with challenge of large-scale distributed computation

Distributed Computing for AI Made Simple

In an ideal world, scaling an application that runs on one machine to an application that runs on a cluster of machines should be as easy as changing a command-line argument. However, that is not an easy task in the real world.

The issue is:

  • There is a huge gap between making code work locally on laptops or desktops and running code on a production cluster. You can make Message Passing Interface work locally but it’s a completely different process to run it on a computer cluster.

  • No dynamic scaling is available. If you launch a job that requires a large amount of resources, then most likely you’ll need to wait until everything is allocated before you can run your job. This waiting to scale up makes it less efficient.

  • Error handling is missing. While running, some jobs may fail. And you may be put into a very nasty situation where you have to recover part of the result or discard the whole run.

  • High learning cost. Each system has different APIs and conventions for programming. To launch jobs with a new system, a user has to learn a set of completely new conventions before jobs can be launched.

The new Fiber platform addresses each of these issues explicitly, potentially opening up seamless large-scale distributed computing to a much wider population of users.

What is Fiber?

Fiber is a Python-based distributed computing library for modern computer clusters. Instead of programming your desktop or laptop, now you can program the whole computer cluster. The key features of Fiber include:

  • Easy to use. Fiber allows you to write programs that run on a computer cluster without the need to dive into the details of the computer cluster.

  • Easy to learn. Fiber provides the same API as Python’s standard multiprocessing library that people are familiar with. If you know how to use multiprocessing, you can program a computer cluster with Fiber.

  • Fast performance. Fiber’s communication backbone is built on top of Nanomsg, which is a high-performance asynchronous messaging library to allow fast and reliable communication.

  • No need for deployment. You run Fiber application the same way as running a normal application on a computer cluster and Fiber handles the rest for you.

  • Reliable computation. Fiber has built-in error handling when you are running a pool of workers. Users can focus on writing the actual application code instead of dealing with crashed workers.

For more information on fiber: https://uber.github.io/fiber/

github: https://github.com/uber/fiber


The use of Python in Financial Technology?

The majority of applications used in banks have been written in COBOL or .NET. Newer applications have been written in JAVA due to its reputation of being the ‘enterprise solution’ whose stability makes it a safe choice for large banks. However the recent surge of pythons popularity has caught the attention of the financial sector. Python is known for its speed to program and easier syntax. Programmers can do as much with 10 lines of Python code as they can with 20 lines of Java. Aside from the productivity gain, this means that there is less chance of making errors. As the sector
becomes increasingly regulated, a low error rate is important, especially to senior business managers traditionally somewhat oblivious to development matters. In addition, with time being every company’s most critical resource, Python offers financial technology startups a much faster alternative to languages that are statically typed, quicker deployment and less required code.

Python was first, or at least most notably, brought into the banking sector by Kirat Singh, the former Goldman Sachs and JP Morgan investment banker, who has been at the forefront of several high-profile technology initiatives. As Bank of America Merrill Lynch’s managing director and head of global risk systems, Singh built the bank’s main platform for pricing trades, managing positions and computing risk exposure across all asset classes. Started in 2010 and named Quartz, this project is believed by many observers to mark the first significant arrival of Python in the sector.

Matthew Harris, director at STX Next, a Python development firm, agrees that Python’s popularity has been due to its simplicity. Harris sees momentum being driven by the appetite for data and AI projects, rather than purely fintech, among the bigger banks. Harris continued to say that in addition to Python being a core language for JPMorgan’s Athena and Bank of America’s Quartz program, from June 2018, Citigroup joined a list of investment banks that wanted its analysts and traders to have strong Python coding skills and a month later, added Python training classes for bank analyst new hires.

Then, in October 2018, JPMorgan announced that it would be putting hundreds of its recently hired investment bankers and asset managers through mandatory coding lessons in Python. Elsewhere, increasing numbers of banks are using the programming language to solve problems in pricing, trade management and risk management problems.

Within financial services, there has never been a shortage of data to analyse. Python has positioned itself as the machine learning (Learn about machine language here) language of choice to tackle this complexity of information and extract actionable insights said Matthew Harris

William Hayes, tech lead at iwoca, believes that success could be found in a combination of Python with Pandas (Learn Pandas here) , a software library that has been written for the programming language to enable data manipulation and analysis, which the fintech uses for “exploratory modelling and data analysis performed in Jupyter notebooks (Learn Jupyter notebook here) .” Hayes went on to say: “This can then be deployed on the main webservers with minimal alteration, allowing us to test new ideas as quickly as possible. We’re also more able to share knowledge between our tech and analytics teams.”

While there are use cases of Python for banks and fintechs alike, Harris suggested that when building a Financial Technology app, “success can often be measured in time to market: getting the app in front of your customers quickly and gathering feedback.”

However, it is not just about a race to market, choosing the correct technology stack is a crucial decision, commercially as well as technically. The right technology choices serve as the foundation for any development as the product scales.

Harris advised that while many in the company may think that a developer would be the best person to ask because of their experience working ‘hands on’ with different tech stacks, problems may arise because: “The developer may choose a tech stack based on their familiarity or based solely on technical merit, without taking into account the business needs of the new application.”

‘A tech stack is defined as the set of technologies an organization uses to build a web or mobile application. It is a combination of programming languages, frameworks, libraries, patterns, servers, UI/UX solutions, software, and tools used by its developers.’

He also suggested that prospective ‘fintech founders’ should question whether a particular tech stack would reduce time to market, prohibit performance or scalability, and also who will build the application when it scales.

“When choosing a tech stack, it’s important for a fintech CEO or CTO to consider the current and future availability of the labour pool supporting any technology options. This can be done by tracking trends in education, the Stack Overflow community or the number of Github contributors. The best server-side languages have a strong and active community of developers,” Harris said.

Discussing the subject, Hasemi drew parallels between the success rate of a tech stack and the talent pool that is available to it: “Fintech tends to prefer senior engineers, and education’s decade-long shift toward Python is finally being felt, even in the most selective corners of industry.”

Source: https://www.finextra.com/the-long-read/28/is-python-storming-ahead-of-java-in-fintech