Skip to content

p4a.plonecalendar 2.1 released

p4a.plonecalendar is a calendar for Plone. Mainly it is a set of calendaring views whose main feature is that can be used without Javascript.

Version 2.1′s main feature is that it adds Plone 4.3 support.

Development workflow and architecture

Back in the stone-age, when I started programming, the main development paradigms was “bottom-up” or “top-down”. Essentially, if you created the overall structure of the program first, and then started filling out details, or did you implement low-level functions first and then composited them together.

I never did any of those, I tended to do “start-finish”, I start with the first thing that needed to happen in the program and go from there. It was hard to get it into a “workflow” of things to do that resulted in anything else. So I shunted the whole idea of “bottom-up” or “top-down” to the side, and apparently so did everyone else because people stopped talking about it. I also think that many frameworks enforce their own workflow on things, so it’s therefore become less relevant because if this.

The last few years I have however found myself doing a lot of bottom-up development, and that’s because my tool kit now includes test-driven-development (TDD)

My workflow currently looks more or less like this: I fiddle around, test things, look at what others have done and use it if I like it. If I don’t like it I do a bit of rough “start-finish” development until I start getting the “feel” for what I’m doing and a rough idea of what I need.

Then I start a new module, and use TDD (more or less). And since I use TDD, and need something that is easy to test, and that results in a bottom-up modular approach where classes tend to be very independent of each other and their environment, simply because that makes them easy to test. It wouldn’t be possible, at least for me, to do this unless I had a clear idea of what I want, which means trying it out first. But in the end, once I start the module and the tests, even though I usually end up copying in what I already had, this quickly tend to get thrown out.

But the end result is that TDD makes me a better programmer, and makes me write code that is clearer and more modular and can be refactored more easily. And this is because TDD more or less forced me to write bottom-up. So maybe that paradigm was less irrelevant than I thought.

About finding a contractor to build your website

Once again I have been contacted by a consulting firm who asks if I can help them with some specific problem. Some quick poking reveals that the problem is that they are trying to develop a site in Python with Plone, and that they don’t know either Python or Plone. However, since they know ASP or PHP, they simply have assumed that they can do this, because it has to be the same, right? It’s just the same principals but another language?

Well, no it isn’t. And the end result is that they have problems, because they are doing things they should not be doing. And the way to fix those problems, is to stop doing it.

I’ve told them that they have two options:

  1. Hire somebody to teach them Python and Plone and Plone development, which will probably encompass at least two weeks of education for all of their developers, and even after that they will be very inefficient and it will take a long time to make the site.
  2. Cut their losses, tell their customer that they can’t do it, and take the hit of not getting paid for the effort they have put in so far.

I’m sure this hurts, but it’s true. Python is not like PHP or ASP, and Plone is not a web framework, it is a content management application. You can’t start using either without some investment in learning the technology. And there is another lesson here too: When a company tells you they can implement a complex website for a pittance, be prepared that what they come up with is no good. Assuming they come up with anything at all, that is.

Hire a contractor who knows the technology that is selected and is recommended by other people who also knows the technology that is selected. Yes, that will cost more. You won’t be able to hire the $25 per hour guys. But trust me: It is cheaper in the long run. Quality pays, and this is true also for contractors.

Discussion: Massively parallell CMS?

I’ve been thinking a lot about this lately, and I realize this is probably a question that can only be answered by actually trying, but still, I think it’s an interesting discussion to be had.

To what extent would it be useful to make a web application, such as a CMS, massively parallell? (or for that matter, concurrent, see comments)

And with that I mean, would it make sense to break the typical one thread per request model? Could we break it up so that fetching from the database is made in different threads or processes than rendering the template? Could the rendering be split up into smaller bits, so that parts of the template could be rendered while the data is still being fetched from the database? Are there other things that could be split up and made parallel?

Porting to Python 3 now available as PDF!

Front coverYou can now buy Porting to Python 3 as PDF, and enjoy it even when you are offline!

You’ll get a ZIP file with three PDF’s, one made for a typical computer/laptop screen and printer, with nice big margins. It will print well on both A4 and Letter paper. Another PDF is formatted to fit well when reading on a tablet, and the last one is made as small as possible, so you can read it on your smartphone.

All three PDF’s for the low price of $12.

PyCon US 2013 Wrap Up: Ambitions and results

I have definitely never been so ambitious about a conference ever before, and to a large extent this as came out nicely. In fact in my huge list of ambitions I only failed in one thing.

The presentation

hovercraft_logoI wanted to use impress.js for my presentation. But already in September it was clear to me that I didn’t want to write the HTML directly, as I did when preparing an earlier version of the talk for PyCon PL. I wanted to use ReStructuredText. And I wanted to position the slides somewhat automatically. This ambition lead to the following for goals:

  1. Create a presentation software that uses ReStructuredText to generate impress.js-style presentations.
  2. Create a library to handle SVG paths.
  3. Update Pyroma so tests run on Python 3.3, so I can use it on the software I make.
  4. Update my talk to use ReStructuredText, and make the slides more useful by themselves.

All of these goals were fulfilled.

  1. The presentation software is called Hovercraft! and 1.0 was released the 22nd of February. Three main presentations and one lightning talk used Hovercraft! during PyCon, which I declare a success!
  2. The SVG path library that Hovercraft! uses for it’s most complicated and likely least useful feature: Positioning along SVG Paths, is called, unsurprisingly svg.path.
  3. Pyroma was updated for Python 3.3. It also got some cleanup and now installs hooks for zest.releaser, so it will run Pyroma on the package before releasing.
  4. I updated my talk to use ReStructuredText, and it now has better slides. It also available on video.

If you really want to see somebody use Hovercraft! in a useful way, check out Chris Withers talk “Things to make writing tests easier“, where he is using the pan and zoom features to increased pedagogical effect, which is absolutely awesome! Look for example at 5 minutes into the talk.

The PEP

I have also the last few months been writing a Python Enhancement Proposal on getting full time zone support into Python 3.4. It was important to get that PEP reasonably finished before PyCon, as I intended to implement it during the sprints. The idea here was that I would more or less merge pytz into the standard library, with just a bit of refactoring. And this is the ambition that I failed to achieve. Mostly the failure is related to the way pytz works around some limitations in the datetime library. Since we are now enhancing the datetime library, we don’t want to work around those limitations, but we want to instead fix them. Doing that the simple way turned out to be impossible, and the result is instead that timezone support needs to be more or less reimplemented from scratch. The three days I was sprinting ended up with me diving deep into both pytz and also dateutil.tz, comparing them and deciding what needed to be done, so that I now have a plan.

An implementation of the time zone support for Python 3.4 will therefore have to wait a bit, although I still aim to have it done by the first Python 3.4 alpha, which is planned for August.

The book

BFlvouoCAAA-DhV.jpg:largeNow, doing a good presentation and implementing a PEP are reasonable goals for a PyCon, even if it’s a bit over the top to have to write your own presentation tool for it. But I didn’t stop there, oh no! I also decided to update my book on Porting to Python 3. So both leading up to and during the conference I would sit and go through the changes needed to update it for Python 3.3, and on Sunday of the conference I released the second edition of the book! I had hoped to do the release during a lightning talk but competition for those were so tight that it was practically impossible to get them. So I released it during a countdown in the green room instead, with the event captured by David Kua.

The book is now 14 pages longer, includes examples for Unicode-aware sorting and how to deal with the changes in the CSV API and many minor improvements. It is currently only available as HTML, but I hope to get time to make PDF versions in the near future. Perhaps it will even be available in paper again. Only time will tell.

The Plone RV

IMG_20130316_181727The last ambition of mine was to also have fun! This was made much easier thanks to the Plone Community having a strong presence on this years PyCon. This was to a large extent thanks to the amazing Spanky and Liz, who not only manned a Plone booth in the expo hall and held a Plone poster session, but also rented an RV, so that us Plonistas could avoid the amazingly boring Santa Clara (the conference center was great, but it is a mile long walk even to the closest restaurant) and instead go into San Francisco every night, and back to PyCon in the morning!

This impeded on my contributing to evening activities such as the Porting to Python 3 clinic, and evening sprinting, but on the other hand, the trips in the RV were a hoot. I’ll probably opt for a hotel room in the future anyway, they are warmer, and it’s less competition for the shower.

Pyroma 1.2 released – A checker for your package metadata

Sometimes making a release of a software makes it used, and people come with bug reports and suggestion for improvements and the end result is that you make a lot more releases very quickly.

I wrote Pyroma, a module to check the quality of your Python modules packaging, just before PyCon 2011, and during the sprint I extended it to be more useful. It didn’t get a lot of attention so that was it. I run it from time to time on my own packages, to make sure they are OK.

Then, yesterday, almost two years later, I decided to run it on Hovercraft! to make sure the package data was good. But since I’ve developed Hovercraft! primarily using Python 3.3, and I never even ran Pyroma under Python 3.3, so I decide to first make sure the tests for Pyroma run. They don’t. This turns out to be just testing-errors, but still. I fix the tests and decide to release 1.0. It has after all been stable for two years. Mostly because only I used it.

Well, this time it got re-tweeted a bit, and it immediately turns out it doesn’t work with Twisted. I add some support for that use case and release 1.1 just hours later.

More tweets shows up check-manifest, a new package from Marius Gedminas that checks that the files specified by MANIFEST.in matches the ones checked into the VCS, which is usually what you want. Someone says that the release software zest.releaser should do these checks. Turns out zest.releaser has hooks for that, and Marius adds check-manifest to them, so when you now call fullrelease, check-manifest is called. Well, that’s a great idea, so I now add a hook for pyroma as well! And 1.2 gets released, just the day after 1.0 and 1.1. :-) Well, it happens.

Anyway, the end result of this frenzy is quite nice. If you now install zest.releaser, check-manifest and pyroma, you get a triple whammy of:

1. A software that will make releases quick and painless.

2. A check that your MANIFEST.in file is correct before the release is done.

3. A check that the release-tag will have sane metadata before uploading to PyPI.

All by just typing “fullrelease” and pressing enter a couple of times. :-)

Well, I like it.

Pyroma 1.0 released

Pyroma checks your Python packages friendliness to packaging tools and other Python tools. Some of the things it looks at is if you have filled in all the meta data you should fill in, that there are tests and that they pass.

New in Pyroma 1.0 is official support for Python 3.3 (it worked before, but wasn’t tested) and a test that the packages version complies with PEP-386.

Where I explain why SOPA, ACTA and the Aaron Swartz case happened.

Up to probably around a thousand, maybe two thousand years ago, metalworking was special. It was not just a skilled line of work done by a special knowledgeable few, it was magic. There’s a reason Thor wields a big magic hammer. Nobody understood it, not even the metal workers themselves.Through experimentation they came up with rules of how to do things, in a particular sequence, but they did not know why it had to be done exactly like that. And metals generally don’t come in pure forms. The best copper during the copper age was hard. They didn’t know why. Now we know it is because it had high amounts of arsenic in it. Many early metalworkers probably died from strange diseases brought on by being poisoned by metals. What was going on was clearly a dark, dangerous magic.

Today we understand chemistry quite well. And with “we”, I mean humanity, to me it’s still a sort of dark dangerous magic. But when hunter-gatherers see the world as full of small spirits, and there is no difference between religion and daily life, with the start of metal working some people were clearly doing different kinds of magic than others. It may not be a coincidence that everywhere we look around the world, when metal working arrives we see the rise of religions and priesthoods.

And today, we have a new technology that many people do not understand. Just like everyone used metal tools, but very few was able to make them, everyone uses computers today, but most people can not program them. Computers also are incomprehensible, and you often need to do things in  a special order even if you don’t know why. Using a word processor or a content management system can become a ritual, where you do a certain list of steps in  a particular order, without fully understanding what you are doing. I’ve seen many people have notebooks or word documents full of step-by-step instructions for doing things like posting a new press release on the web page, etc.

For most people, computers are simply magic. But we computer programmers, we seem to make computers and the internet do our bidding. We can handle this magic, and we don’t even die of arsenic poisoning. There is a theory that the legend of drawing a sword from a stone started as a metaphor for metal working. Computer programmers are today’s metal smiths, and we seem to be able to command a kind of magic that enables us to draw information from the internet.

There are no priesthoods yet, partly because society already has it’s own priesthoods to do not embrace this new magic. But where you get stale priesthoods threatened by something external, you also get these priesthoods defending themselves. And that defence comes in two major versions.

The first version is simply a general oppression, reducing freedom and attempting to make the new thing illegal. That is what both SOPA and ACTA is about. They are the establishment reacting to a technology they don’t understand, and hence view like magic. So they are trying to stop it, mainly by simply making it illegal. In Sweden, since the Pirate Bay case, it is illegal to link to material that is infringing on copyright. And since you have no control over what you link points at, any link can be changed at the receiving end, you can suddenly find yourself a criminal. Do I think that will happen? Yes.

Because in some cases the general oppression leaks over into an effort of getting to one particular individual, no matter what. Or in other words, a witch hunt. And in that case, anything that can be used against that person will be used against that person. And since as a part of the general oppression it has become illegal to do what everyone is already doing, anyone can tied to the pole and set on fire.

Aaron Swartz was, in the eyes of those prosecuting him, a magician. They would never admit to this, because they don’t believe in magic ahaha that would be ridiculous. But the fact is they they don’t understand what he did, or how he did it. To them, computers, internet and open source is incomprehensible, and therefore dangerous and therefore it must be stopped at whatever the cost. And as long as these people run the courts and big business and sit in political offices, this will be the case.

And if these people and their witch hunts aren’t stopped soon, anyone with a smart phone will be a criminal.

Django Sprint 2013 report

This weekend there was a yearly global bug fixing sprint for Django. It apparently took place in seven places around the world, stretching from South America to Japan! One of these places was Kraków, organized for the second year in a row by Pykonik.

As an extra incentive this year there was an application written by Aleksandra Sendecka and  Tomasz Paczkowski (I think, if I got that wrong, tell me and I’ll change to the correct credits). This app looks at the bug tracker (and I maybe also the github repo, I’m not sure) and gives people achievements according to what they do, such as commenting, adding patches etc. According to the results table there was a total of 43 people involved in the sprint somehow, which is pretty cool.

I personally concentrated on the templating system and threw in a Python 3 fix as well. I added a couple of patches and improved some others. Two of them has been merged to trunk already. It felt like a productive weekend, especially thanks to the achievements app!

Follow

Get every new post delivered to your Inbox.

Join 1,225 other followers