Python Eagle - v14


Introduction

The Eagle programming language evolved from a command line and macro language through to a high-level procedural script language with version 11.  Since then, and especially at the time of the porting to the Windows platform, the language has been enhanced in within those terms and parameters.

 

Many times it has been envisaged to evolve the Eagle language to an OOP language, or to embed a Visual Basic or Java interpreter in Eagle.  We have already integrated Eagle with the Windows Component Object Model (COM) and made the language more flexible by introducing DLL integration and Eagle EPIs (Eagle Programmer Interface), which allow a programmer to use alternative  high level language to write extensions to the Eagle language.

 

We have also developed an ActiveX for Eagle to enable compliant Windows applications to integrate with Eagle as a 3D graphic component, to the extent of integrating the Eagle ActiveX into the Internet browser and of the development of Eagle applications in HTML, JavaScript, XML, etc.

 

Despite all this flexibility we have always been conscious of the fact that our major market penetration problem was that our system isn't a CAD system but a development tool for graphics applications and, as such, our programming language despite being easy to use remains relatively unknown outside the user base, is proprietary, and is not widely spread in the education sector (universities, schools, research centres) like other high-level or scripting languages.

 

We had been working to make the Eagle environment for flexible and agile in the last decade, so the solution was easy and there, in front of us.   We needed an OOP language, widely spread and known, documented in books and present on the Internet with communities and forums, easy to integrate and extendible and ready to be integrated with Eagle calls and commands.   The solution was Python, a script type language like Eagle which can also be compiled.

 

Python was created in the 1990s, by a Dutch guru, Guido van Rossum, as an open and free, flexible and extendible. Python has a large community of developers and is documented from both a technical and an educational point of view.  What's more is Python is taken seriously by major developers including YouTube, Google, NASA, Industrial Light & Magic, Thwate and Red Hat amongst others.  Python has a large library of brilliant tools already available.  What's more is the quality of these tools is unrivaled by other languages.  Ready made tools such as HTML parsing, scientific calculation, artificial intelligence, signal processing  etc. are all freely available, many released in Open Source.  Python now regularly ranks amongst the top 10 programming languages

 

Eagle was the ideal environment to introduce this technology: object oriented programming in Eagle, with a language that is:

Easy to learn

Object oriented, procedural and functional

Easy to integrate

Well known

With a vast set of ready-to-use modules and libraries, free and easy to get from the Internet.

So, the concept for pyEagle (Eathon) was born.  We will refer to it both as pyEagle or Eathon.

 

Python Embedding

We are consistently aware of meeting new challenges with the need to respect the reusability of existing developers code. The Python parser is embedded in Eagle in a dual-parser configuration. This means that Python library is statically linked to Eagle and a new Eagle command triggers switching from one parser to another.   This means we can be using the Eagle parser and then dynamically shift to the Python parser in a flow such as this;

.      

.  Eagle commands

.      

eathon on

.      

.  Python (PyEagle) in action

.      

eathon off

.      

.  Eagle commands

.      

The “EATHON on” command initialises a session of the Python parser and the command “EATHON off” terminates the session.  This means that successive sessions initialised by “EATHON on” commands will start from scratch and will not  treat variables and modules created and imported in a previous sessions.  There are other possibilities to manage inter session data transfer.

 

When in Python mode the command line, accepts Python statements that are directly executed by the embedded Python parser.  At this time Python scripts can also be executed using the Python command import and calls can be made to  functions and classes defined inside these modules.   Python scripts can be in source format (extension .py) or compiled in byte-code (extension .pyc). Source scripts are compiled into byte-code by the parser at run-time or can be compiled offline by a command-line utility.

 

The Next Steps

The proven and growing popularity of Python (A list top 10 2008ref Tiobe) it's object orientated structure together with the possibility to script and compile has made it ideal to integrate in Eagle.  The next logical step is to expose Eagle functions as Python Classes.  This development will form part of the exciting future for Eagle and Python as a unique leading edge development platform for both prototyping graphics development and engineering the solution itself.