Bystroushaak's blog / Paperclips / Things that disappeared / PyAtom disappeared

PyAtom disappeared

I've used pyatom module to generate Atom feeds for my blog, but also generally for all kinds of stuff for maybe four or five years. Then it disappeared.

It is no longer on GitHub (webarchive), and no longer on pypi. This forced me to use something else, and I have chosen feedgen (there is not much choice). So if your reader got confused, I am sorry.

The disappearance kinda pissed me off, because PyAtom was one of those modules, that had really good and intuitive architecture. You create an instance of the Feed, add some entries and you are done.

Feedgen is this weird abstraction of toughly-coupled code with the actual XML representation. It uses some weird reverse OOP, where you call methods, which return empty instances, and you then fill them by calling methods.

Instead of this:

feed.add(
    title=title,
    content=post.description_clean or "No description.",
    content_type="text",
    author=settings.twitter_handle.replace("@", ""),
    url=url,
    updated=dateparser.parse(raw_date)
)

You have to use something like this:

entry = feed.add_entry()
entry.id(url)
entry.title(title)
entry.link(href=url)
entry.updated(pub_date)
entry.published(pub_date)
entry.author({'name': settings.twitter_handle.replace("@", "")})
entry.summary(post.description_clean or "No description.", type="text")

I really don't get why they can't just use constructors for the new Entry, or just method calls. And why half of the setter/getter methods (I kid you not, in python! At least they avoided using get/set prefixes, but created hermaphrodite methods instead) expect dictionaries with parameters. Why don't they just use keyword arguments? And sometimes they do use keyword arguments, but for really wtf lowlevel stuff like "href" parameters.

Become a Patron