Interested in learning about Pyramid's traversal approach for sites with hierarchies? For my Pyramid tutorial in Brazil last October, I wrote a "quick" Traversal Tutorial. I didn't talk too much about it, as it had some typos. I just fixed the wording and also confirmed that it runs under Python 3.4.
This tutorial tries to introduce traversal in some bite-sized chunks with working code:
- A Bootstrap-layout that places the elements used in the tutorial
- A basic root object with a view at
/hello....with no routes
- Views that get their information and security retrieved and passed in by the framework
- A nested hierarchy of resources
- Ditto, but with resources of different types, with type-specific views...and no
/sometype/1/anothertype/2in the resource location (URL)
- Adding any kind of thing inside any kind of thing
- Persistence, first with ZODB then with SQLAlchemy (using adjacency list relationships and polymorphic tables)
PyCon 2014 in Montréal was a great conference! Check out the Agendaless PyCon 2014 talks:
Paul Everitt presented a half-day tutorial, "Python 3/2 Web Development with Pyramid ":
Tres Seaver gave a talk, "By Your Bootstraps: Porting Your Application to Python3":
We had lots of good conversations with folks, both in the "hallway track" and at the Pyramid booth. Great job by the Montréal Pythoneers organizing and running such a terrific conference! And for those who didn't get one there, the "Hacker" T-shirt is available online:
Chris and I have given our talks at PyTennesse 2014. Mine was a two-hour tutorial, "Pyramid Development in a Nutshell", which I cut down from Paul's Quick Pyramid Tutorial. (See my slides here; examples are on github)
Chris' talk was his "Substance D: Build Civilized Web Applications" talk. See a video of the same talk from the RuPy 2013 conference).
This episode covers adding objects to a folder, and editing those objects' properties.
This episode covers updating object properties, and undoing those changes..
This episode provides a quick tour of the SubstanceD management interface (SDI), including navigating through the "tree" of objects in the database.
This episode demonstrates starting the WSGI server in development mode, viewing the default splash page in the browser, and logging into the the SubstanceD admin interface.
For those who'd like to read rather than listen, this is the set of commands outlined:
- Start the server using the development configuration:
$ ../../bin/pserve development.ini
- Grep the generated, random password from the config file:
$ cd src/myintranet $ grep passwword development.ini
- View the default splash page at http://localhost:6543/.
- Log into the SubstanceD management interface at: http://localhost:6543/manage.
This episode demonstrates generating the initial version of the
myintranet project, checking it into Git, and installing
it and its added dependencies into the virtual environment.
For those who'd like to read rather than listen, this is the set of commands outlined:
- List the templates available for generating a project:
$ bin/pcreate --list-templates
- Generate the
$ cd src $ ../bin/pcreate --template=substanced myintranet $ cd myintranet
- Check the initially generated code into a local Git repository:
$ git init . $ cat > .gitignore *.pyc __pycache__ *.egg-info *.fs* blobs tmp ^D $ git add . $ git commit -m "Initially-generated project."
- Install the project and its extra dependencies into the environment:
$ ../../bin/python setup.py develop
- Verify that
myintranetis importable from our checkout:
$ cd ../.. $ bin/python ... >>> import myintranet >>> print(myintranet.__file__)
This screencast is the first in a series of short tutorials on installing SubstanceD and using it to build a simple intranet application.
This episode demonstrates creating a Python virtual environment and installing the SubstanceD software into it.
For those who'd like to read rather than listen, this is the set of commands outlined:
- Create a Python 3.3 virtual environment:
$ /opt/Python-3.3.3/bin/pyvenv intranet $ cd intranet
- Install and update
$ wget https://bitbucket.org/pypa/setuptools/downloads/ez_setup.py $ bin/python3 ez_setup.py $ bin/easy_install -U setuptools
- Check out SubstanceD from Github:
$ mkdir src $ cd src $ git clone firstname.lastname@example.org:Pylons/substanced $ cd substanced
- Run SubstanceD's
setup.pyto install it in the environment:
$ ../../bin/python3 setup.py developNote that this step also installs SubstanceD's dependencies.
- Verify that SubstanceD is importable from our checkout:
$ cd ../.. $ bin/python ... >>> import substanced >>> print(substanced.__file__)
We're starting a series of short (3 - 5 minute) screencasts, demonstrating the SubstanceD application development platform. The series is built around the tasks needed to set up a simple intranet site.
For an overview of SubstanceD as a development platform, start with the talk given by Chris McDonough at the RuPy 2013 confernce: "SubstanceD: Building Civilized Web Applications".
Recently we held a 3-day-long Python sprint in Budapest before the RuPy conference. Here's what got done.
Substance D (web application server)
Participating: Chris McDonough, Balázs Reé, Godefroid Chapelle
- Allow management views to be categorized.
- Allow deletion of objects that cannot successfully be unpickled.
- Add an API for get_editable_adapter.
- Allow schemas that inherit from substanced.schema.Schema to be used successfully in non-FormView code (no longer necessary to call .bind() on these to run things through deserialization).
- Grid error messages caused by connectivity problems now disappear if the client notices that the server is back up via SSE.
- Attempted to figure out how to more better show "global" views (like the auditing tab, the database tab, and the undo tab).
- Various small UI improvements.
Deform (form library)
Participating: Domen Kožar, Balázs Reé, Chris McDonough
- Experimented with using angular.js for client-side validation (fairly successfully).
- Refactored and improved resource registry.
Pyramid (web framework)
Participating: Fabian Neumann
- Audit docs for places we could better use .. deprecated:: and other Sphinx/RST directives.
Months ago I thought it would be fun to interview some people, and I always knew who I wanted first. Liz Leddy: Plone core developer, former Plone Foundation board member, speaker, and rabble-rouser of the group-hug variety. Below is a transcript, with an audio version available.
1) Tell us a little about yourself, the stuff you're currently doing, and the awesomest thing you've done in the last year.
I'm Elizabeth Leddy, I've been working with Plone since I was 19 years old, and I'm 30 years old this year, can you believe it! I got into Plone when I was working in college as part of a student internship where I was learning this new thing called CSS (can you believe it? tech comes a long way.) It's amazing to me that I'm still doing it this year.
I've done quite a few things with Plone: government intelligence, medical startups, internal implementations, and I've been working as a consultant for the last four years based out of the Bay Area. Currently working with Eric Steele and Ryan Foster on a startup doing an athlete management platform on top of Plone. Turns out a lot of the problems in elite athelete management can be solved with proper content management and communications. In fact we just got back from training the Cleveland Cavaliers (professional basketball team.) Work a lot with the US ski team and some other big names coming through, so we're really excited.
It has been interesting to see how, once you get outside the standard intranet domain, how many of the standard patterns solved by Plone can apply, just with some different wording.
Me: I've been thinking about that lately. We all come from a background where we solve a certain class of problems about how people work together. Other systems and approaches don't even try to solve those problems.
Liz: Yes, I see this throughout other platforms and systems outside of Plone, I call this the shiny object syndrome, where decision makers are really drawn to pretty graphs etc., which for example IBM are really amazing at doing. But then you get down to the real problems, like communication, knowledge management where you get people out of emails and into systems. That's where the real problem is and if we can have that conversation to get decision makers beyond shiny object syndrome, we can really get change both internally and when communicating with their customers.
2) What's one of the awesomest things you've done in the last year?
I do a lot of shenanigans, but the thing I'm most proud of is where we've taken sponsorship. The donations we had coming in were these really great companies. When I started on the Plone Foundation board this year, I really wanted to get our sprint funding together, with some brazen comments like "If we spend $25,000 we can raise $25,000." Of course I then had to back up a statement like that, and we did, we're back on track to reach our high-water mark from 2009 levels of sponsorship.
We've already raised enough money to continue the sprint funding next year, which is the main thing, taking it year-by-year. We have big Plone 5 push, and getting the right people to the right places at the right time and making sure they're productive, we'll see a really big release come.
Furthermore, the excitement that comes behind knowing that sponsors still care enough about Plone that they just need to be asked in the right way is just awesome. I love that.
3) How did you find Plone, what kind of stood out and made 19-year-old Liz want to do it?
Actually I came across Plone the way a lot of people do: somebody paid me to do it. I was getting a blazing $8/hour, but I was 19 at the time and trying to get my computer science degree, it was a good thing. At the time I wasn't technical, and most people's introduction to Plone is, you're handed the system and you can customize via the browser and do all these things. You don't need to be technical. As I learned computer science and object orientation, then I could dig more and more into Plone and do technical things.
When I graduated from college, I didn't expect to do Plone. After a couple of post-college jobs, I got hired at BAE Systems to do Java JSR-168 templates, really portlet standard back then. Luckily a guy said "I heard you know a little bit about Python and Plone, do you think you want to do a Plone install?" Of course I said yes, save me! From there it has just continued, I've never had issues finding work and interesting projects.
4) What piques your interest in Plone these days?
Interestingly I do use other systems for smaller projects and keep an open mind, but each time on bigger projects and clients that last multiple years, every time it turns out, "All of this is solved by Plone already." You can just get up and go.
I specialize in startup types with a lot of one-off prototypes to get funding. Even if Plone isn't the end game, it's there for a few years, get them going quickly, let them flesh out their thinking, change directions, etc.
People think startups are, have an idea and eight months later, sell to Facebook. But the reality is, it's a four year process to even get going. It's a moving target that they have follow constantly, thus it doesn't make sense to invest in a platform until you've really figured out what you're trying to sell, who are your investors, and how much they care. It's a different reality than "The Social Network" would like us to believe.
5) Let's change gears away from technology. I'm more of a Plone observer these days. Just watching, it seems like the world of Plone has gotten a second wind.
It definitely has. A lot of factors going into it. First, we have new energy on the development side, people like Rok Garbas and all these young people from countries such as Brazil. These people that haven't become curmudgeonly old developers yet, taking ownership, filling places where people have left. There's a natural cycle where, if you've worked in a project for ten years, you can get cynical after a while, just like any relationship, you definitely get some kind of itch.
We've had people naturally fade away: their businesses went a different direction, or they had twins. Then we have young people who come in and think, "Well, nobody's going to do it so I'm going to do it, and I'm going to do it my way." We've needed that kind of fresh blood for some time. They're very exciting, they get other people excited.
Also, as soon as we said "Seriously, we are going to do Plone 5", people start getting their changes lined up, saying "Yeh, let's do it!" This is combined with a cash influx from the Plone Foundation for sprints. We then go to symposiums and talk with Plone companies who are excited about Plone 5. All we had to do was ask for sponsorship.
6) On a related question, there's Plone-the-Software and Plone-the-Community which makes the software. But there's this other thing, Plone-the-Foundation. How is it doing?
The motto of the Foundation is "Protect and Promote Plone". This is my first year on the board. Managing sprints and sponsorship was one of my main things coming in.
They (the PF) does everything from handling GPL issues, what licenses go in which new packages, trademark violation stuff that we handle on a regular basis, the contributor agreement, marketing and sending people to events. This year we've expanded the scope to be more aggressive at sponsorship to help make sprints happen. That's part of protecting Plone, to make sure it sticks around, and that's why people want to donate. I think we've been doing a pretty good job this year.
Me: I think May of next year will be around the ten year anniversary of the wheels getting in motion for the Plone Foundation. The Plone Foundation is a pretty good success story as it changed hands from the founders and first generation and now getting a good second wind. That's a neat story that not every community has.
Liz: Ten years, wow! It's actually a story I've told a couple of times this year, for example at OSCON. Not all software makes it to twelve years. What does that kind of durability mean and what are the implications? The younger open source people aren't aware of what happened in the late 90's with software getting acquired and the legal battles, so I spend time talking to new sofware projects about why a foundation is a good idea if they plan on sticking around.
It (the Plone Foundation's durability) is something we should be proud of.
7) Zoom out a little: what kinds of things are on Plone's plate for the next two years?
The next major release is the biggest thing, being the new plan for Plone 5. We have a lot of things to get rid of by updating our code base, get rid of a lot of legacy stuff. That's a hard job that usually nobody wants to do but we've discovered is more important.
We're at a point where we can modernize our front-end tools, get rid of legacy code, and do things that make it a better development platform, not just for developers but more friendly for people that don't want to write any Python. I'm really excited to see what happens with Plone 5.
Also, moving on to CSS and other frameworks that aren't custom to Plone, borrowing tools instead of building our own, to kind of move on and learn our lesson to integrate other tools. We have this bad rep from around the Plone 3 timeframe. Now we're reaching a generation that has either never heard of us or have forgotten that, so that's an awesome opportunity to kind of rebrand and say: "You've never heard of Plone, but it's pretty legit."
We have plone.com as well, a three-year process at figuring out marketing when you don't have a "BDFL" company to lead the marketing. Instead we have a group of companies and we've yet to figure that out, because there aren't a lot of those kinds of success stories to pull from. We know if we had better marketing we could do more. That's our biggest challenge in the next year, figuring out how that works and what are the politics behind it, just try some things and amend them if they don't work.
Me: It's interesting that you tied Plone 5 and the marketing push together. With Plone 5 as kind of a relaunch, you have a chance to sharpen up the story and get some consensus on the storytelling. Not just refactoring the software and tossing out cruft, but maybe there's cruft in the story?
Liz: Definitely, and I hope it's something I hope we figure out. Something I think is pretty cool, Heidi Reinke from the Universtiy of Wisconsin Oshkosh is having her marketing students to a marketing plan for Plone. They'll do interviews and make proposals, but it's nice to have a third-party bring a new perspective where we learn from them. I'm fascinated to see how this little experiment works.
8) The RV that you rented for PyCon 2013 was absolutely fabulous. You've set the bar so high now. What other shenanigans do you have up your sleeves?
We've constantly bugged the Plone Foundation to buy a hot air balloon. Carol Ganz at SixFeetUp is two hours away from getting her hot air balloon pilots license so stay tuned.
9) How many times have you been on the road this year? When is the next time people can get their dose of the fabulous Liz Leddy experience?
So far this year, 3 sprints, 2 non-Plone conferences talking about Plone, two conferences, on the road two times a month the whole year. I'll have a some down time. I'd really like to make the Arnhem sprint in November. Some people are sprinting a whole month there! If not, a sprint at Bodega Bay in February. I talked ostensibly forever about a sprint in Hawaii, so I'm going to make that happen next year. And of course, PyCon.
Next Thursday, Oct 17, I'm doing a webinar with the good folks doing PyCharm at JetBrains. I'm use PyCharm pretty heavy, and recently I'm doing nearly everything (including my Pyramid work) using Python 3 in PyCharm.
Drop by the webinar, see what PyCharm looks like, and ask me some pointed questions, like that time in Vienna when I....oh right, that's a secret.
Last month we unveiled the Quick Tour of Pyramid, a high-level presentation of the basic features in Pyramid. The tour got positive feedback and has been updated and refined as work on Pyramid 1.5 progresses.
We now have something to accompany the Quick Tour: the Pyramid Quick Tutorial. 21 steps through the basic features, with working code, analysis, and linking to reference material. The tutorial is the result of a serious, sustained effort including several for-fee engagements, resulting in an open-content, commercial-quality tutorial that is part of the core Pyramid docs.
We're quite happy to have this available for evaluators and new developers. Over time, we'd like Pyramid to be a fantastic starting point for new Python web developers, with lots of evaluator-friendly resources.
Here's a bit of a look inside.
How It's Made
A couple of years ago I taught a Pyramid tutorial, for-fee, at a Plone Conference. I chose a different approach to tutorials: break the work into independent sections, one concept per section, and make it so even a room full of students would be successful doing it themselves. That formula has been tweaked quite a bit. Here's how the Pyramid Quick Tutorial is produced.
Each of these section is done as Sphinx documents with a common structure:
- Explain the background and give the objectives of that section
- Provide a series of steps to produce a working example in that topic
- The steps link to a subdirectory with a working Python package and link in the code
- Following the steps, some analysis of what was done
- For people that finish faster than others, some extra credit questions
- Lots of deeper linking to the official docs
I then let them go off and do the work for the step, then we reconvene and talk about it. Some students cut-and-paste, some type it all. If they get too far behind, they can just get the package from GitHub and teleport themselves into the present. All the material is available online in the official Pyramid docs, so they can come back later and freshen up.
The sections also have a modest amount of test code, to make sure what is being taught continues to work in the future.
Have tutorial, will travel
Have an in-house team of developers interested in Python 3 for web development? Running a conference with tutorials and up for a high-quality, open-content half/full/two-day tutorial? I know somebody that might be interested. [wink]
Lately I've given my Python 3 Web Development With Pyramid tutorial in some cool venues (Cambridge UK, Brasilia) and now this material is a part of the core Pyramid docs. Still, for each venue, I produce some new sections relevant to the particular needs of that organization or context.
I'm hoping to do more events and more material (next up: a traversal tutorial and an add-on development tutorial for more advanced usage.) Give me a shout, @paulweveritt on Twitter.
tl;dr Training and talks, meeting old friends, Plone getting a new burst of momentum.
Last week I was in Brasilia for the joined-up Plone Conference 2013 and Python Conference Brasil. Below is a trip report.
At first I was surprised. Giuseppe Romagnoli invited me to give a keynote at the conference and I had some reluctance. I've been out of the loop for a while. Would I have anything useful to say? Well, that's never stopped me before, so I said yes.
I then had, of course, a visa issue. Last time I went, in 2002, you just strolled up to the embassy and got your visa. Since then, the good ol' US of A has apparently "enhanced" its treatment of Brazilians. Turnabout's fair play, so in return, getting a visa there was a ten-business-day process involving your passport. Thanks to Ana Maria Amorim, a wonderful woman whose husband was recently the ambassador to the US, I dodged a bullet.
I also signed up for a two-day Pyramid training course and a "State of Pyramid" talk. Since I was giving the training course two weeks earlier in Cambridge UK, I thought I was in good shape. Alas, I couldn't resist the urge to tinker, so I was frantically creating material all the way up to the last moment.
The flight was uneventful and actually, fun…I got on the Atlanta->Brasilia hop and heard Chrissy Wainwright from Six Feet Up call out my name. Yay! Hanging out with Chrissy was one of the treats of the conference. She's a superb traveler.
The hotel for the speakers was directly on the Brasilia equivalent of the "Mall" in Washington…a long strip of open space with government buildings lining each side. Though the training venue required a bus ride, the conference venue was only a sub-kilometer walk.
The first night before the training I got to have dinner with Chrissy, Vitória Vasconcelos, and my longtime dear friend Luciano Ramalho.
Over the years I've developed a certain approach for training. I break a course into a series of bite-sized chunks, each on a specific topic that students want/need to learn. I make a LOT of these sections. For two days, over 30 in my "Python 3 Web Development with Pyramid."
More later on how I do the tutorials, but for now: it was a lot of fun. I enjoy getting feedback and improving the material. I also enjoy doing my little part to push Python 3, as it is the first-class citizen for the tutorials.
Our hotel had a nice restaurant, fancy outside deck, nice handsome staff, modern music, and a nice menu.
Around the corner was a parking lot where, for the last 18 years, a local entrepreneur brought a portable grill and served kabobs, a rice dish, and beers. You would sit on little plastic stools underneath a string of lights powered by an electric cord going across the street. Each item was around $2, paid on the honor system.
We went there every night.
This was a real highlight of the conference. Authentic food, fantastic conversation. Under mango trees that the gentleman planted himself many years ago.
It's been a while since I hung around with the Plone folks for a sustained period. Two things really jumped out at me:
- The new generation of Plone leadership is really, REALLY good. From all over the world, a refreshing new viewpoint on what things to do and how, and a tangible feeling of joy and purpose.
- Plone itself seems to have a new dose of momentum. Certainly having the President of Brazil launch a new Plone-powered website for the Brazilian government is a notable sign. But there's more to it. The Plonistas seem to be making some serious steps forward.
There were four simultaneous tracks as well as two keynotes per day in a ginormous (2,500 person) auditorium. The conference sold 500 tickets but I suspect the high-water mark on attendance was 400 on a single day. Probably 3/4 of the talks were in Portuguese, which seemed like a very good idea. On both the Python side and Plone side, new generations of Brazilian free software developers were being minted quickly (as the entrance fee was kept very low.)
Lots of good talks on the Plone side, plus a mini-track for Pyramid. I alas didn't see too many talks. The first day was spent tweaking (i.e. writing) my State of Pyramid talk. I also decided, late on the first day, to rewrite my keynote. Sigh. Bad Paulie.
In particular, I liked Mikko's talk. He helped poke at some questions and thinking that I wanted to get my brain wrapped around, and let's face it, he is a very hilarious and quite charismatic speaker.
Érico Andrei was quite a force at the conference, both from a Brazilian side and a Plone side. He has a lot of leadership qualities. It's fun to see him in action. Ditto for Paul Roeland, who several people noted to me in private has a real gift for bringing the various forces together in the world of Plone.
Getting to see Alan Runyan, Sidnei da Silva, and Matt Hamilton again after quite some time was worth the trip, just for that. To think how long we've all known each other and everything we've gotten to work on together…it's quite neat.
State of Pyramid
On the afternoon of the first day, I usurped Chris McDonough's throne and gave a past/present/future talk on Pyramid. Typical Paulie presentation, all sauce, no steak. Lot of fun, though.
I got a lot out of it, I must say. I listened to some of the feedback to learn more about how people see Pyramid in the continuum of Python web frameworks. Our marketing message of "The Start Fast, Finish Big, Stay Finished Framework" seems to match what people are looking for, as well as were they have slotted Pyramid in their heads. I also gave a demo of Substance D (demo.substanced.net), Chris's content framework atop Pyramid.
What Pyramid means for the world of Plone was an undercurrent of the conference. I tried to keep my mouth shut and my ears open, so this was a useful aspect to attending.
The second day I gave a keynote that was a series of funny stories masquerading as lessons learned. It was intended to be, largely, the same talk I gave at PyCon DE in Leipzig, 2011. However, the afternoon before the talk I got a bug up my ass and decided, well hell, why not just rewrite it. Which was risky due to the stage layout: I wound up with 82 slides and no presenter mode to see the next slide (to time the jokes), and had to ask Luciano to be on stage and press "next".
Which meant I had to memorize all 82 slides. I'm no Randy Pausch, Paul Graham, Eben Upton, Paul Hildebrandt, or any of the other extremely smart keynoters with important things to say. Sitting in their keynotes is always a humbling experience…even if I tried really hard, I know I couldn't match them.
Lately, though, I've tossed out my "just wing it" approach and actually prepared and rehearsed. It's not fair to far-travelling audiences to put in a weak effort. Also, for the topic of this talk, I think there are some experiences that we in the Python/Zope/Plone world went through that are worth imparting.
I wouldn't mind giving the talk again. I already know some changes to the material I'd like to make and some work I should do on the delivery. Anybody need an above-average-funny, below-average-profundity speechifier?
Paul Hildebrandt's Keynote
This was my first time meeting Paul, a senior software engineer at Walt Disney Animation Studios. We hung out together at the meat-on-a-stick soiree the first night. What a wonderful person, very smart but quite human and with a heart most certainly in the right place. (More below.)
He gave a deeply enjoyable keynote called "Under the Hat" which, alas, wasn't recorded. My 7th grade son would have flipped out if he could have seen it. Not just a talk on how technology can enable creativity. Not just a talk on the pervasiveness of our little child Python in the digital entertainment business. But also, the human side of building organizations that actually value people.
The evening of the second day saw an official party on the lake at the Navy base outside Brasilia. Well done, conference folks! Time flew by as people ate, drank, and even danced until the wee hours. 60 people from probably 20 countries.
At the risk of leaving out so many other memorable moments, one seemed to capture the real spirit of this event.
During my talk I made reference to the legendary Castle Sprint (must…write…blog post…) and, as analysis-in-hindsight, wondered what prompted underpaid people from 30 countries to travel to Austria and work for free on software given away to others. Sure the beer was good, but that's quite a thing to do.
In the talk I concluded that there was a social element going on that I hadn't understood. Most of these developers were probably the smartest person in their little town. Too smart for the others to really appreciate. They got out of school and maybe got a decent job at some soul-sucking enterprise.
Then, they go online, peek their head in the Plone/Python world, and discover…a whole bunch of people just like them, from wonderful places across the globe. Not only that, but these people valued them, understood them, and in fact, wanted them to come join the fun. Go to Austria, soak in some high-octane thinking, hang around for once with people who get me? Sure, sign me up!
After that talk a young man from Brazil came up and told me that was indeed his story, and here he was at a Python event in Brazil, getting to be a part for the first time of something big. But even more…he always wanted to be a digital animator, and unbelievably, the conference had The Disney Guy! He tweeted Paul Hildebrandt to say thank you for coming.
What did Paul do? Not only did he reply, he memorized the young man's face, found him in the crowd, and introduced himself. Then proceeded to tell him the steps he should take to start his journey possibly to Disney Animation Studios. Paul didn't have to do that: it's just who he is, and he did it, and now that young man's journey is so much different than if he didn't stick his head in the door of free software and look around.