Working on Projile: Oh my God – Refactoring Woes

Yeah, I took a closer look at Trac and well, oh my god! I’m thinking I’m jumping in the deep end without learning to swim first. That is usually how I roll.

Starting Out: Creating Web Installer

I think I’m going to look at two things. The first is writing a web installer that obsoletes and eventually replace the trac-admin cmd line tool. This will also involve at some point moving the wiki to the database. I suppose the next two or so weeks will be involved in this project. I’m going to refactor also how the htdocs is setup. I want it to be more how a web server should behave, but this will be a learning process as to whether the python modules work that way. Regardless, it should be fun throwing a wrecking ball into that and see what comes out of it.

Most likely the end of my attempting to refactor Trac for another year or two. The experience will be well worth it, even if all of it will most likely be unusable.

I think this will be a good start and will teach me about Python install scripts, entry points, and creating packages and plugins. It will also teach me how the various Apache HTTPd modules work with Python web sites and CherryPy. Even if I decide to stop after this, the next two to four weeks will be well worth learning these topics from an established product.

Depth Of the Web Installer

Starting the web installer should be neat in that it will give me experience with CherryPy and passing execution off to Trac. My goal in particular is attempting to replace the installer (setup.py) script. However, this might prove to be a little bit difficult, depending on permissions. In which case, if it can’t call the setup.py, it will instead work off the existing code, albeit probably a lot slower than what it could be. The installer will also attempt to configure the trac.ini script and create a base project, if one does not exist or attempt to discover existing projects.

The plan is to do this separate from the existing Trac code. Other optional goals will be to convert the Sqlite to MySQL or PostgreSQL or simply keeping it Sqlite. I think this will allow me to jump into the existing Trac code without having to completely rewrite giant portions of the code simply to get something working. Also, being separate, it should allow installing existing Trac installations without many or any modifications. Or at least that is the plan.

Rationale For Web Installer

I read an interesting article about Cluelessness and it had a profound impact on me. The problem I’ve had in the past with Trac and why I often cringed at setting it up was that it took far too long. The process has vastly improved and there are Linux repositories that make installing Trac as easy as typing a single command. The problem with downloading and installing Trac has been solved. The problem with setting up Trac is a little bit more involved.

Given how easily and quickly it is to install WordPress, it is no wonder there are many installations. It would be easier, I think, to convince my boss to use Trac, if I could say without a doubt that it would only take 5 minutes to completely setup and get Trac up and running. This time quote does not include installing python and the apache modules, which also only take less than a minute to get up and running as well.

Well, there is much to say about spending upwards to 4 weeks attempting to create a web installer simply to save at most 2 hours as a novice with setting up Trac. However, it is more, I think, about the perception, which is to my boss, that it isn’t worth the time investment. Also, with existing and awesome online bug and project trackers, it is a even easier to simply buy an account rather than spend any time setting up a private tracker.

While this task is, I think, a little much to be cutting my teeth with starting to really truly learn Python and Python web development. I think the complexity now is something I’ll rather enjoy rather than starting at some point after I’ve started. In other words, I’ll be damned if I’m going to attempt something like this after a couple of months and I’ve learned as much as possible about Python and realize just how crazy attempting this actually is. Right now, ignorance is bliss and I’m thinking, “How hard can it be,” and deep down, I know it is impossible, but I’m still a bit unsure. I’m going to attempt it and when I fail, I’ll be all the wiser for the attempt.

Lessons

  1. HTTP modules WSGI, FastCGI, SCGI and standalone (CherryPy).
  2. CherryPy web site development
  3. Python setuptools module
  4. Permissions revolving around calling setuptools in a web installer.
  5. Permissions and also hopefully downloading and installing optional plugins in a web installer.
  6. Setting up Trac using a web installer.
  7. Creating a simple, easy to use web installer providing some initial configurations.
  8. Optional SQL Alchemy for converting Trac databases.

Task List

  1. Successfully get CherryPy accepting HTTP requests with the aforementioned Apache modules.
  2. Test whether there is an existing Trac project setup and successfully bypass the installer (preventing the installer from even being started) to start Trac.
  3. Attempt to call setuptools in the web installer and figure out if it is even possible even with permissions.
  4. Attempt to create a Trac Project trac.ini file.
  5. Start replacing and complementing the trac-admin command line script.
  6. Unit tests.
  7. Release for cash and profit

Possibly Related Posts:


Comments are closed.