Starting from Developer Toolset 4.0 we have added the Eclipse PyDev tooling for writing and debugging Python applications. This article aims to give new users a whirlwind tour of some of the key features.
Installing and Configuring
PyDev is installed by default when you install the IDE component of DTS 4.0:
$ sudo yum install devtoolset-4-ide
Once you’ve launched Eclipse, the first thing you need to do is configure an interpreter to use. Open the preferences dialog by choosing “Preferences” from the “Window” menu, then navigate to the “PyDev -> Interpreters -> Python Interpreter” preference node. Simply hit the “Quick Auto-Config” button to automatically discover and configure the first Python interpreter that is encountered in your PATH.
It’s worth knowing that not only does PyDev work well with the default version of Python that ships with RHEL, it also works with the Python Software Collections. For example, if you’d like to work with Python 3 then you can also install the rh-python34 software collection:
$ sudo yum install rh-python3
Continue reading “Get Started: Eclipse and Python with PyDev in Developer Toolset 4.0”
This article is focused on MongoDB 2.4 packaged as software collections. Knowledge of MongoDB basics is recommended, but not required. In case you are not familiar with MongoDB and you’d like to learn more, try MongoDB’s online courses. These courses give you basic knowledge about MongoDB concepts, configuration, and deployment, as well as knowledge of how to program application for MongoDB.
This article is focused on what is different with Red Hat Software Collections (RHSCL) packages. These packages are available in RHSCL 1.1, and RPM packages are prefixed with `mongodb24`, which is also the name of the MongoDB24 collection.
Continue reading “How to Use MongoDB 2.4 with Python 3.3 from Red Hat Software Collections”
I’ve been getting more and more questions about using Python’s virtualenv with python27 and python33 collections from RHSCL, so I decided to write a very short tutorial about this topic. The “tl;dr” version is: everything works perfectly fine as long as you remember to enable the collection first.
Update 2018: An updated article has been published, See How to install Python 3, pip, venv, virtualenv, and pipenv on Red Hat Enterprise Linux.
What is Virtualenv
Citing Virtualenv official documentation: “virtualenv is a tool to create isolated Python environments”. In short, Virtualenv allows you to setup multiple runtime environments with different sets of Python extension packages on a single machine. Unlike Ruby’s RVM (Ruby Virtual Machine), it can’t install the language interpreter itself – just the extension libraries.
Continue reading “Using Python’s Virtualenv with RHSCL”
Although most of Python enterprise applications still use Python 2 (e.g. Python 2.4 on RHEL 5 or Python 2.6 on RHEL 6), Python 3 has already become a mature variant and is worth considering. Why, you ask?
- Python 3 series is being actively developed by upstream, while Python 2 now only gets security fixes and bug fixes. Python 2.7 is the latest minor release of the 2.X series and there will be no Python 2.8. This is very important since Python 3 will be getting new modules (check the new asyncio module coming in 3.4, for example) and optimizations, while Python 2 will just stay where it is and will be abandoned sooner or later.
- Although the initial Python 3.0 release had worse performance than Python 2, upstream has kept improving it and Python 3.3 is comparable to Python 2.7 performance-wise.
- Python 3 is already adopted by major libraries and frameworks: Django since version 1.5, SciPy since 0.9.0, mod_wsgi since 3.0, …
Migrating projects to Python 3 takes some time, but with RHSCL it’s as easy as it can get. Read on to get information about changes in the language itself and about the suggested approach to using RHSCL as a migration helper.
Continue reading “Migrate to Python 3 with RHSCL”
For RHEL6 and newer distributions tools are available to profile Python code and to generate dynamic call graphs of a program’s execution. Flat profiles can be obtained with the
cProfile module and dynamic callgraphs can be obtained with pycallgraph.
cProfile Python module records information about each of the python methods run. For older versions of Python that do not include the
cProfile module you can use the higher overhead
profile module. Profiling is fairly simple with the
Continue reading “Profiling Python Programs”
Red Hat intended for developers to integrate Developer Toolset 2.0 (DTS) and Red Hat Software Collections 1.0 (RHSCL). As you may not realize, inside the DTS is a copy of Eclipse and you can use that with any software collection. In other words, you can use PyDev, with the Python 2.7 Software Collection from RHSCL in the Eclipse from DTS. Let’s find out how.
Continue reading “Using DTS Eclipse, PyDev, and Python 2.7”
This article will show you how to use two software collections of RHSCL 1.0 Beta for cutting edge development. We will create a Django 1.5 application (running on Python 3.3), that will use PostgreSQL 9.2 as a database.
Continue reading Using RHSCL: Django on Python 3 with PostgreSQL
Recently, I needed to get Django installed with Python 2.7 on Red Hat Enterprise Linux 6. As this is not a directly supported activity, I wanted to document how I went about it. As you might imagine, the generally expected method for install would be to grab the Python 2.7 source tree and then build it. Obviously, that can be a lot of work; is not particularly repeatable; and, potentially, exposes you to more security flaws. As a result, I decided to try to leverage a “new’ish” technology developed (in the open) by Red Hat called Software Collections. An in depth discussion of Software Collections is for another post, for now we just need to know that Software Collections are rpms that contain all (or most) of their supporting libraries, install under /opt, are updatable through yum, and, the core software collections code (scl-utils) is supported by Red Hat. A number of collections have been created and released by the community at http://bit.ly/fedora-scl.
OK, getting started. I created a new VM using a RHEL 6.3 image on an instance of RHOS (Red Hat Open Stack),
Continue reading “Setting up Django and Python 2.7 on Red Hat Enterprise 6 the easy way”