sábado, 28 de septiembre de 2013

Python Package Managers

Python programming language is consolidating its position among the most used programming languages, only after more consolidated languages as C/C++ or Java.

Far from being just a scripting language, Python is being widely deployed to other functionalities such as Web programming (with Django as a powerful driver), Mathematics, Graphics and Game programming, and many other [1].

As a consequence of Python increasing popularity, many attention has to be paid on how Python programs are packaged and deployed, especially when talking about Open Source Python software.

For a Python programming newbie, it is essential to know the existence of Python Package Index (PyPI). But, which are indeed the main causes of having to use PyPI. Better than anyone, Alex Clark's blog collects a good reason of them [2]:

- "Everybody wins": As PyPI is the center, canonical place of Python packages.
- "It is the Right thing to Do": As PyPI is a software release server, that can even be considered as a backup for those software projects that host their own release servers.
- "Because it does not have to be perfect": As developers and maintainers of the place are happy to consider all recommendations, being conscious that it is not as "sexy" as Github, Bitbucket or other places.
- "Because it is not that hard": Packaging and deploying software on an structured basis as the one proposed by PyPI, and although some issues are still there, such as "easy_install" performance, important efforts are in progress for Python setuptools to improve day by day.

Besides this, some alternatives are being provided in order to fix issues with easy_install. In particular, a tool for installing and managing Python packages, PIP, appears as an alternative in order to provide some improvements such as [3]:

- Packages are downloaded before installation, meaning partially-completed installation are avoided.
- Improved usage on console is provided.
- PIP keeps track of the state, meaning that, for a particular package, PIP keeps a record of the reason why that package has been installed.
- Error messages provided are most descriptive
- Code is concise, cohesive, and easier to program.
- PIP allows the installation of flat packages, not as an egg archive.
- Support for other version control systems, in particular GIT, Mercurial and Bazaar, is provided.
- It is simple to define fixed set of requirements and reproduce a set of packages on a reliably way.

So, to summarize, and with alternatives available to those parts which are less robust, as happens with PIP to easy_install, there is no reason why a Python programmer should not release its software to PyPI.

[1] http://sarroutbi-fsw.blogspot.com.es/2013/09/best-python-open-source-libraries.html
[2] http://blog.aclark.net/2011/01/31/in-defense-of-pypi/
[3] http://www.pip-installer.org/en/latest/other-tools.html#pip-compared-to-easy-install

domingo, 22 de septiembre de 2013

Best Python Open Source libraries

Python programming language is one of the most widely used programming languages. Among the reasons of its success we can find:

1 - Ease of learning.
     It is a much faster language to learn compared to "its competitors", typically C++/Java/Perl.

2 - Documentation and support.
     There is a ton of documentation available on the Internet. Besides this, PyPI (Python Package Index) contain a whole bunch of Python modules strictly archived and easily installable.


3 - Dynamic typed language.
     Variable types are not needed to be declared, as happens with other languages as C++ or Java. This, in the end, means saving time.

4 - External modules. 
     There is a whole bunch of external modules developed in Python and ready to use in your Python programs.

Related to this last point, this post tries to analyze some of the most interesting modules developed in Python.  Among all the python developed modules, the most interesting modules I find are:

- pygame: A Python wrapper for SDL which allows gaming development. 
- googlemaps: An easy-to-use Python wrapper for Google Maps
- pyopenssl: Python interface to OpenSSL
- SqlObject: A Python module to provide object oriented access to several type of Databases.
- wxPython: A blending to the popular wxWidgets C++ library and Python programming language.
- PIL (Python Imaging Library): A powerful Python module to provide image manipulation and graphics handling functionality.
- SciPy: A Python-based ecosystem of open-source software for mathematics, science and engineering.
- gnuplot.py: Python package for interacting with GNU-Plot.
- Django: A high-level web framework.
- BeautifoulSoup: HTML/XML parser.
- IPython: An interactive shell to the Python programming language.
- coverage.py: A python tool that provides code coverage in Python.
- lxml: Very fast, easy-to-use XML parser.
- nose: A unit-test framework for Python.