Stephanie Watson (stefw) wrote,

My First Python Thing

Okay, so thanks to my experiences writing recipes and working with appliance agent code at rPath, I have already done a lot of Python coding. The difference there, though, is that it is Python syntax within a specific API. Outside of that, though, I had yet to write or contribute to original Python code.

Now I have! I cannot express thanks enough to Elliot for coming over after work hours and spending 15-20 minutes showing me some essential things to add to my code so I could call it with arguments at the command line. He also advised me on some best practices I had not really picked up on before. There are a lot of helpful resources online, but wading through to find what I needed was going to take more time than I wanted to put into this first effort.

So, what's the program do?

The problem I needed to solve was automating the retrieval of certain information from an installed JIRA (in this case, the rPath Issue Tracking System at issues.rpath.com). I needed to be able to provide a product and a fix version (equal to the release version) for that product, and then to retrieve issue IDs and "README" fields for every issue associated with that product and fix version. This would be a way of assembling the rough draft of the release notes for that product release.

My desired functionality was to run a single command, providing three arguments to that command, and to get the desired results printed to stdout. The arguments are the product ID and fix version, plus the desired type of output. The three types of output are:

(1) from the queried issues, the list of issue IDs for issues with blank "README" fields, needed to determine where we need to add information in rITS;

(2) from the queried issues, the contents of the "README" field plus the issue ID value (or a note that an issue still has no README field), needed to make a first editing pass with changes made directly in rITS as needed;

(3) from the queried issues, the DocBook XML markup needed to generate the release notes for publishing.

One additional need is to ensure that when addressing #2 and #3, identify whether or not an issue should be publicly visible, and only print the issue ID if it is. Markup will include linking these issues as appropriate, too.

The first code attempt created a class called "generel" (get it? GENErate RELease notes?). The class had four methods and allowed me to accomplish output types #1 and #2 (though not yet with the check for publicity).

I can't believe how simple the code is for this, thanks mostly to work already done by Dave Christian's Jiranemo that he programmed back in late 2006, and Andy Grimm's contributions working with pyjira. Thanks guys!

I'll blog more about this one again later when it is complete.

In other news... my first Java programming experiences at NCSU have been very smooth and easy. I look around the class, though, and I see people struggling to understand basic programming logic and syntax the same way I did my first time through it 17 years ago. Without any prior exposure to coding, it is difficult to connect some concepts for people. While I am relieved not to be in those shoes any longer, I am also glad to help those others when I can. Even though there is a bit of boredom to the class, I'm too busy with other things in life to worry about it at the moment... I'll be cherishing these simpler times soon enough, I'm sure. :-)
Tags: java, ncsu, python, rpath
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded  

  • 0 comments