Skip to main content

Ralsina.Me — Roberto Alsina's website

Posts about nikola (old posts, page 5)

PyCamp 2012 - Day 3

So, day 3 and nex­t-­to-last of Py­Camp is done.

  • Great day, sun­ny, not all that cold

  • Em­­panadas at lunch, piz­za for din­n­er, cake for tea. Feel­ing kin­­da spoiled to­­day.

  • Lots of hack­­ing at Niko­la-as-a-ser­vice (de­­tails be­low)

  • PyAr meet­ing by a huge, some­what scary bon­­fire ear­li­er tonight

So: Niko­la-as-a-ser­vice is an idea where you can keep your blog some­where, and this ser­vice will get the data, and pub­lish a nice site for you.

Here's the cur­rent work­flow, which is just one of a dozen that can be im­ple­ment­ed be­cause this thing is quite sim­ple:

  1. The au­then­ti­­ca­­tor

    Cur­ren­t­­ly it has twit­ter au­then­ti­­ca­­tion. You nev­er need to cre­ate an ac­­coun­t, just lo­­gin with some ser­vice you al­ready have ac­­counts with. Any­thing with OAuth will work.

  2. The da­­ta provider

    Cur­ren­t­­ly, github. Soon, Ubun­­tu One. Lat­er, who knows. A da­­ta provider is some­thing from where we can grab data, and that can no­ti­­fy us (au­­to­­mat­i­­cal­­ly or by hav­ing the us­er click on a but­­ton) when we should get that da­­ta and re­build the site.

  3. The ren­der­er

    I am do­ing it with Niko­la, of course :-)

  4. The in­­fra­struc­­ture

    Jobs us­ing Re­dis and Cel­ery, serv­er app us­ing Flask, ren­der­ing us­ing Niko­la

  5. How does it work?

    You go to github, clone a bare­bones blog. Do your mod­­i­­fi­­ca­­tion­s. Go to niko­la-as-a-ser­vice, and lo­­gin via some­thing. Then you give Niko­la your github re­po's URL, and you get a we­b­hook URL. Go back to github, and con­­fig­ure the we­b­hook.

    From that mo­­ment on, ev­ery time you push to github, your blog is up­­­dat­ed :-)

    In the fu­­ture: ev­ery time you save to Ubun­­tu One, your blog is up­­­dat­ed. In the fur­ther fu­­ture: Ev­ery time you X to Y, your blog is up­­­dat­ed.

It's go­ing to be cool :-)

New Nikola Feature: code listings

This is a new fea­ture in Niko­la, my stat­ic web­site and blog gen­er­a­tor.

It's aimed at show­ing pieces of files in the post­s, and giv­ing you a link to the full file, does rea­son­able syn­tax high­light thanks to pyg­ments, and the syn­tax for em­bed­ding in your posts is not ex­ces­sive­ly aw­ful, so I can use it for some of my tu­to­ri­al / book project­s.

Here's an ex­am­ple:

.. listing:: md.py python
   :start-at: def compile_html
   :end-before: output =

Sys­tem Mes­sage: ER­ROR/3 (<string>, line 14)

Er­ror in "list­ing" di­rec­tive: un­known op­tion: "s­tart-at".

.. listing:: md.py python
    :start-at: def compile_html
    :end-before: output =

This is not merged in­to mas­ter yet, but should be soon.

PyCamp Day 1

Go­ing to sleep, so here's a quick run­down of my 1st day at Py­cam­p:

  • Woke up at 6AM, and af­ter tak­ing train­s, bus­es and au­­to­­mo­­biles, ar­rived around noon. Place is nice, wheather is cold. Beds are bunks.

  • Pre­sen­t­ed ideas, vot­ed work­ing slots

  • Im­­ple­­men­t­ed a Niko­la fea­­ture to get themes from http://­­bootswatch.­­com

  • Im­­ple­­men­t­ed first draft of pipe­­lines for post-pro­cess­ing gen­er­at­ed files

  • Martín Gaitán is work­ing on im­prov­ing the im­age gal­­leries

  • Hugo Rus­c­it­ti is do­ing some cel­ery+flask mag­ic to cre­ate a Niko­la host­ing ser­vice

  • Had fun with lots of oth­­er things and talk­ing with a lot of peo­­ple.

  • Played some ta­ble ten­­nis (won 1, lost 1)

  • Got a fire­­fox t-shirt

  • Got a Nin­­ja-IDE mug that changes colour with tem­per­a­­ture.

Now, ex­haust­ed, go­ing to bed.

Nikola Ideas for PyCamp

This fri­day is the be­gin­ning of Py­Cam­p, four days of python hack­ing with­out dis­trac­tion or pause. And I want to code a lot. My main tar­get is fea­tures for Niko­la my stat­ic blog gen­er­a­tor.

If you are at­tend­ing Py­Camp (or even if you are not), you are wel­come to join me in im­ple­ment­ing these in a marathon of kick­ass cod­ing start­ing this fri­day and last­ing all week­end.

I have a few ideas in my head, but I want more. These are the ones I have, please add more in the com­ments if you have any:

Code Gallery

Like im­age gal­leries but for code. Put code in a fold­er and it will be beau­ti­ful­ly dis­played. With the ad­di­tion of a "list­ings" do­cu­tils di­rec­tive, it will make show­ing code in de­tail and in con­text easy and pow­er­ful, and make Niko­la more at­trac­tive to pro­gram­mer-blog­ger­s.

Gallery Polishing

Im­age gal­leries are im­ple­ment­ed and work, but they could use a lot of pol­ish. From mak­ing them more net­work-­ef­fi­cien­t, to im­age RSS feed­s, re­cur­sive gal­leries, gallery meta­data, im­age texts, and much more.

File Pipelines

Want to min­i­mize your CSS? Tidy your HTM­L? pngcrush your im­ages? ap­ply HTML trans­for­ma­tion­s? Oth­er things I can't imag­ine?

File pipe­lines would bring the pow­er of the unix shell to a site gen­er­a­tor, let­ting you con­nect lego-­like fil­ter­s, some pro­vid­ed, some from the com­mu­ni­ty, in­to a pow­er­ful ma­chin­ery.

Online Editing (Alva)

While stat­ic site gen­er­a­tors have lots of ben­e­fit­s, they have one sig­nif­i­cant down­sid­e: you ed­it the files in your own de­vice. A on­line ed­i­tor for Niko­la lets you ed­it them through a web in­ter­face for blog­ging-from-ay­where good­ness.

Nikola Hosting (Shoreham)

Why not cre­ate a ser­vice where the us­er feeds posts to a serv­er and then the serv­er pub­lish­es them? The feed­ing can be via a DVC­S, or a file sync ser­vice, or via on­line ed­i­tors, and the out­put is pub­lished au­to­mat­i­cal­ly or at the push of a but­ton.

Drafts

I don't do draft­s. I type and that's it. But oth­ers pre­fer more cau­tious and sane ap­proach­es. So, how should drafts work? While the fea­ture may be easy to im­ple­men­t, it's a good be­gin­ner pro­gram­mer's task, where you have to think more about what you want to achieve and pro­vid­ing a good us­er ex­pe­ri­ence than about just bang­ing code.

So, is there some­thing you saw in an­oth­er stat­ic blog gen­er­a­tor and Niko­la lack­s? Any cool ideas and want a friend­ly code­base to hack them on? Do you have any crazy ideas noone would touch with a ten-­foot-pole but you think would be awe­some to have?

Well, now's a good time to talk about it!

PyCamp Starts This Week

This fri­day marks the be­gin­ning of the 2012 Py­Cam­p. What's Py­Cam­p? It's a lot of python pro­gram­mers (this year, about 50) gath­er­ing in an iso­lat­ed place for a long week­end, with noth­ing to do ex­cept code. We will have our meals catered, there are no TVs, there is hard­ly any­thing with­in walk­ing dis­tance, and it's go­ing to be very cold.

So, it's go­ing to be awe­some. It's a rare chance for me to spend a few days hack­ing at my own per­son­al pro­ject­s, un­in­ter­rupt­ed by more im­por­tant things like fam­i­ly, work, cook­ing, or so­cial­iz­ing ex­cept be­tween nerd­s.

Sure, there is the oc­ca­sion­al mono­cy­cle rid­ing, or jug­gling lesson, or shoot­ing prac­tice, but re­al­ly, three or four sol­id days of hack­ing.

I in­tend to work on projects re­lat­ed to Niko­la my stat­ic site gen­er­a­tor, so if you are in­ter­est­ed in that and go­ing to py­cam­p, I want to talk with you.

And if you are in­ter­est­ed but not go­ing to py­cam­p, there is no rea­son not to join in a vir­tu­al sprint. We'll have in­ter­net. There is IR­C. I will have time. It's a week­end! Please share any in­ter­est­ing ideas you have about stat­ic site gen­er­a­tors in the niko­la-dis­cuss group and we'll see how much can get im­ple­ment­ed or at least start­ed.