Installing ZNC on FreeBSD

If you chat in IRC more or less frequently, you definitely should use IRC bouncer. ZNC is one of the most advanced and popular. And as there could not be too many manuals in the internet — in this post I want to store the report of the installation (though, it is quite simple). In the text below ZNC is ZNC 1.2 and OS is FreeBSD 10.0-RELEASE-p1.

Read more >>>

Testing on multiple versions of Python

Adding support to another version of Python requires proper testing on all supporting Python platforms. The changes you make most likely will break something and will not work for older versions.

Of course, OpenStack has configured Jenkins that will test your code under different Python versions. But it is really inconvenient when you try to find tricky fix, that will work and for Python 2.6 and ideally all versions, up until recent 3.4. Nobody wants to clean-up the commit and commit message just to determine, that your changes fail under 2.6. As an additional problem is that my favourite OS – ArchLinux – uses py27 and py34, so was missing two major versions to test – py26 and py34.

Of course, obvious solution is to use virtual machine to test the changes. So now I am experimenting using Ubuntu 12.04, managed by Vagrant. In addition to preinstalled py27 by using ppa:fkrull/deadsnakes I have py26, py33 and py34 installed. Mentor asked me to test changes for PyPy too, so one more member appeared in the family using ppa:pypy/ppa – PyPy2.3.

Except well-known problems with unicode/bytestring, iterators, sometimes incompatibilities are minor, and therefore harder to find. Here is example for you.

Trying to run Marconi server under the Python 3.4 (as you remember ArchLinux etc) I got simple problem: it fails during log configuration, giving something similar to:

...
File "/usr/lib64/python3.4/logging/__init__.py", line 178, in _checkLevel
    raise ValueError("Unknown level: %r" % level)
ValueError: Unknown level: 'Level WARN'

After checking in IPython for different versions of Python, I knew what was the problem. It was pretty simple. It appeared that since Python 3.4 logging.getLevelName works only as expected – returns levelname for level, not vice versa.

# in py < 3.4
logging.getLevelName(10)
> 'DEBUG'
logging.getLevelName('DEBUG')
> 10

# in py3.4
logging.getLevelName(10)
> 'DEBUG'
logging.getLevelName('DEBUG')
> 'Level DEBUG'

But why does someone actually need to use it to get integer code by level name? Because in Python 2.6 there is a difference whether you setting level as integer code or as string name.

# in py26
logger = logging.getLogger()
logger.setLevel('DEBUG')
logger.level
> 'DEBUG'
logger.setLevel(10)
logger.level
> '10'

# in py > 2.6
logger = logging.getLogger()
logger.setLevel('DEBUG')
logger.level
> 10
logger.setLevel(10)
logger.level
> 10

The problem is simple, but I just wanted to clarify my understanding. After some investigation I found that changes was introduced in this commit. To find this I actually needed to do blame of CPython’s repository. It is that kind of change, that is not reported in ’What’s new in Python 3.x’ and even is not listed in full changelog of changes.

It is why testing on all versions of Python you want to support is critical – you cannot know where the problem could come from.

Python3 for Openstack/Marconi

So my project for the OPW is to help OpenStack with the support of Python3. In particular, the goal is to make the Marconi project Py3k compatible.

If you are just wondering, why someone could possibly need Py3k support in OpenStack you could read good post with motivation. Like it or not, but Python 3 exists and will exist and sooner or later will be dominant. Current state for Py3k support in Openstack is represented in the wiki/Python3. The overall summary is – ‘Work Is In Progress’, the clients for services are mostly ported, the services themselves are mostly not.

So why Marconi is good candidate to start with?

  • Marconi is a new project and it is not good to create the technical debt from the beginning.
  • with relatively small codebase – the task could be accomplished by one person in one internship.
  • and the most important – nearly all dependencies already support Python3. One of the biggest issues for other Openstack services remains python-mysql driver, which fortunately isn’t a critical dependency for Marconi (MongoDB is the primary storage backend).

And, in the nutshell, project will include:

  • actual changes to the source code.
  • managing dependencies and dealing with requirements.txt. Although critical dependencies are ported, there are problems with python-memcached. Common way in Openstack now is to use two separate requirements.txt (requirements-py3.txt for Python3) to deal with incompatibilities of dependencies.
  • work with tests. Tests are cool and important.
  • changes to gate configuration (the ultimate goal, in the end of internship, make py33 gate voting).

Applying for OPW: my experience

This is the first and introductory post to the blog. Main purpose of it to “break the ice” of empty page and write something about OPW 2014.

Note: You can read what is OPW here – OutreachProgramForWoman.

In this post I want to give some tips for future applicants. It is the summary of my experience for applying and getting the internship.

don’t think you have no time to apply

I managed to select an organization, write project proposal for it, do the required contribution (even two of them) in six days.

So don’t panic, if you like me learn about existance of this program the week before the deadline. It was just like boom! – if you want to participate, there is no time to loose.

don’t be silent

If you are from that kind of people, that just enters any room and gets everyone’s attention and you even enjoy this, free to skip this item. All above is not about me – I’m shy and self-inconfident and I know this. But also I know, that doesn’t mean that I should be silent. So I force myself to ask question, answer other’s question, just post random smiles from time to time. Of course, first several messages are usually like

Hey, I’m completely unsure, but it seems like …

For some unknown reason, I don’t know the answer yet, so may I ask the question…

After extremely friendly answers, all this boilerplate unsureness desappeares, and — hey, I managed to speak to complete strangers :)

about finding the project

There should be some clever advises about how to select the project etc. If you need some, there are really good post. But I was so lucky to skip it all (and I definetely have no time). For me it was like

  • filter list of participating organizations for use of Python
  • hey, there is OpenStack
  • write to general IRC #openstack-opw
  • meet aggressively friendly mentor from OpenStack/Marconi flaper87, who just literally pushes me to #openstack-marconi. And the whole Marconi was so aggressively friendly and so ignorant of my shyness, so it was impossible to leave them.
  • done :).

getting the internship is not the most important

The most important is that contribution you do, people you talk, task solved. In the end, it was completly irrelevant, would I get those internship or not. Because main outcome I got – experience of contributing to big open-source project and confidence that I will contunue to contribute in future.