It is already time for another year in dgplug summmer training . This will be sixth year of the training.
If you heard about this training before then you already know that I teach programming with help of Python. It will be even more intensive this year. More amount of code reading and more writing. Yes, we teach our students how to read code and learn from others.
The number of demo projects will also increase this year. We will make sure that the students work hard.
Two years back we did a bit of experiment in the training by letting students go slow, we stopped asking for regular reports and found most of the students just vanished during this 1-2 weeks of low sessions.
From last year we are back into more strict sessions and we keep the tab on missing students in every session. At the beginning of the training we get around 20-30 students in the IRC channel, but as the sessions progresses during first one month, many of those students start vanishing. In the end of 3 months, we generally get 2-5 students who become very active contributors in different upstream projects. As we do the sessions generally in Indian evening time, few sessions go very late, we even saw sessions continuing till 1am with a break for dinner. The students, who stay in the training after one month, don't mind staying up late for the sessions on IRC.
I don't mind the low number of active students during the end of the training as these people will serve FOSS world in various forms for sure.
We ask students to use any latest Linux distro, but I prefer if all of them are using the latest Fedora. Around two years back we asked them to install gcc and I gave the corresponding yum command, only one student came back saying it is not working, so after trying to debug his problem for some time we figured out that he did # apt-get install yum on a Ubuntu box and then tried to use yum as we told so. So now we ask the distribution and environment details first from every student.
During the training sessions we ask many upstream developers to spend 30-60 minutes in IRC channel and talk with the students, this really give them a moral boost. If you want to help us out please drop a mail or tweet, we will find some suitable time for your sessions in the training.
We have pss packaged in Fedora.
pss is a tool for searching in source code or text files. It searches recursively in the directory structure. By default it skips directories like .svn or .git.
Example: Searching tok_new in the C source files.
$ pss tok_new --cc ./Parser/tokenizer.c 43:static struct tok_state *tok_new(void); 113:tok_new(void) 768: struct tok_state *tok = tok_new(); 785: struct tok_state *tok = tok_new(); 816: struct tok_state *tok = tok_new();
In the same way to search in only python files use --python option.
$ pss enqueue --python ./tests.py 41: self.assertTrue(queue.enqueue(t)) 57: queue.enqueue(t) ./examples/async_producer.py 8:job = queue.enqueue(task1) ./examples/sync_producer.py 7:job = queue.enqueue(task1) ./examples/producer.py 9:queue.enqueue(task1) 10:queue.enqueue(task2) ./retask/queue.py 183: def enqueue(self, task): 203: >>> job = q.enqueue(task)
To know different available options one can pass -h or --help to pss and view all options.
Install it using yum:
# yum install pss
If I have to publish this post in twitter it will simply become "Best conference ever, thank you @pycon".
Conferences are always a good place to meet old friends or make new ones, to meet like minded people with whom you can share your passion, discuss technical and non technical things in the same pace. There are few conferences where you will see work getting done in a fast pace, PyCon was one of them. Of course we have the extra toppings of great food, drinks and stories.
PyCon US 2013 had all of them but in much larger plates. Nine days full of excitement, 2500+ people under one roof, 6 parallel tracks of talks, the language summit, first ever education summit, 4 days of continuous hacking on your favorite projects are a few things which are coming in my mind in less than 10 seconds.
I reached SFO around 1:20pm on 11th March. Took a cab to Ramada in Santa Clara. This was my first USA trip and after reaching hotel I found the place kind of empty. It was a strange feeling about not finding any person outside cars :)
Luckily saw Douglas Napoleone's email telling volunteers already reaching the venue. So, I just took a cab and reached venue.
In the office room I met Douglas, Noah Kantrowitz, Laurens Van Houtven, Oskar Żabik and later Ewa Jodlowska. Started setting up the "green room" with Douglas and had enough fun while testing each of the radio equipments for volunteers. Met the amazing AV team, they need a special thanks as the event reaches to many more people through their dedication and hard work. Had dinner with others and came back to the hotel late at night.
I have to mention one thing, the warm welcome I received from everyone through out the conference. I never felt for a moment that I was there for the first time or meeting them first time. We always talk about how open the communities should be or how diversity should help. Trust me when I say that the Python community at PyCon will give you the same warm feeling which you get from your close friends or relatives. This is just another reason to be in PyCon, be the part of the bigger family.
Next day reached venue by 9am, through out the day many more people started coming down. Registration was started by 3pm, so did the needful.
By afternoon Toshio reached the venue. It is always fun to meet to people whom you know him/her for long time and I was sure this PyCon is going to be full with those fun moments as I will be meeting most people for the first time face to face. Met lmacken, threebean also in the hotel.
At nigh around 12 of us went out for dinner to a restaurant, the food was amazing.
I came back to the hotel around midnight and found Ramki and Konark already reached.
Had to wake up by six so that we can get ready and reach venue by 7:30am but reached few minutes late and straight went behind registration desks, the queue started growing as the day progressed but it was never too long. The custom application we were using for registration was one of the main reason to get things done in a fast pace.
After the queue started staying empty for long, I rushed to the language summit before it started. The details from the day is in this post. The young coders tutorial was going on up in the tutorials room at the same time.
Morning met Mark Shannon in hotel and we all shared a cab to reach venue. After the usual registration desk work done I moved to the education summit. During all the three panels we heard some great success stories and discussions went on. The panels were on "Curriculum", "Teaching" and "Engagement". I found that in dgplug summer training we are actually executing many of the suggestions came up in the panels.
After lunch I went in to the "Python 3 Metaprogramming" by David Beazley. He already tweeted that brains might explode during this tutorial and it actually did for many of us.
PyCon SWAG bag stuffing party was in the late afternoon. This is generally a difficult task in a conference where you have high number of people turning up. But within couple of hours we finished off 2500+ bags and had too much fun.
In the evening there was "Opening Reception!". Alex Gaynor and myself became the bouncers and guarded the door :p
Later at night we had the volunteers and speakers meet. Every little steps were explained in great details.
Queues started becoming long in the early morning but due to great setup of morning breakfast tables and event-bag pickup counter, it never felt much. We managed to finish off the registration without any trouble.
Jesse Noller started the day with some exciting announcements, one of them was about a raspberrypi for each attendee.
Next was the keynote by Eben Upton from Raspberry Pi Foundation. After the keynote people started moving into different rooms and hallways were also full of people.
I attended Ned Batchelder's talk on Loop like a native: while, for, iterators, generators, and Raymond Hettinger's talk on Transforming Code into Beautiful, Idiomatic Python and finally Mike Müller's Functional Programming with Python. Most of the time in the day, I was meeting people and discussing various technical aspects of different projects. These kind of hallway tracks are of course the best part of the conference.
At night after another awesome dinner, packaging and distibution tools mini-summit started in room 206. The current status and future goals of various projects including setuptools, distribute, wheels, pip, virtualenv, zc.buildout, PyPi were discussed.
Reached hotel around 1am and just crashed.
Woke up early. Day started with lighting talks, I spoke about retask project, somehow I was feeling uneasy about showing only code in the slides, strange!. Through out the day there were many fantastic talks, more interesting discussions on hallways. Sometime in the afternoon Tavis Rudd gave a personal demo of his system, completely blown away with the accuracy.
In the evening there was "Porting to Python3" session in open space. I never had any of my modules ported to Python3. Barry Warsaw led the session, we quickly went through the basic differences between 2 and 3 and saw some common problems people get into. I started porting retask to Python3. Toshio introduced me to six and by the end of session I managed to port retask into Python3.
At night we as usual sat down in hotel bar and pool side, met many new faces from Montreal, who will be leading the event next year.
Reached venue around 9am and went directly to the poster session venue, put up my poster on darkserver. Missed both the keynote sessions due to this but people started coming in as the keynote finished.
One good thing about poster session was direct interaction with audience. The major feedback I received during the day was the following
Many devels acknowledged that becoming single source for all different GNU_BUILD_ID(s) from the distribution is important.
In between Dave Malcolm took the charge of the explanation of the project to the audience and we also had few pictures taken.
In the closing ceremonies Diana Clarke took the charge of running next year's PyCon from Jesse.
Next was introduction of various sprints by the leaders. It was very clear that the number of people attending sprints is also going to be high. We slowly started moving things back to the sprint rooms.
First time managed to sleep more, till 9am, it was much required extra sleep. We reached venue, Ramki went to PyData, me and Konark moved to different sprint rooms.
Through out the first half all the different bugs in cpython I tried to work on were either not-reproducible or can not be introduced in 2.x as they were new features.
At night started discussing about retask with Maximiliano Curia, he submitted many patches since then. Later started port rst module into Python3.
Finished rst porting to Python3, so now it supports both 2 and 3. Had long discussion with Dave Malcolm on his current projects. Later he helped me to explore more on elfutils and how to go ahead to have a library around it so that we can bindings in different languages as required. I also showed my work on the Python bindings to elfutils.
Started working on few smtplib related bugs in cpython, R. David Murray already committed one of the patch and the other one is up for review. His help to the new-comers was really helpful.
We all moved to one single space, even at the end there were around 50 people working in various projects. Met the mailman team.
Though out the sprint days mane left and it was time for me to say good bye to everyone. Toshio dropped me to Lawrence caltrain station and I came back to SFO and stayed back at Yannick's place for the night, I had my flight back home around noon next day.
I personally found the development sprint days very much useful, we just sat back and hacked on our favorite projects, many projects got work done, many new developers joined the teams.
In betwen I was trying to figure out if we can get some hardware donation to our Bijra project , which got slowed down due to hardware issues. Mark shannon heard the issue and donated his Raspberry-Pi and later Harry Percival donated his. Steve Holden also came up to help and he promised to send a few more devices to the school. We will still require some more help in finding some cheap HDMI to VGA adapters.
Personally this trip was very meaningful in many ways, being in the venue during the event is of course a different experience. If you are a Python programmer or someone who loves new technologies or someone who just loves to meet interesting people, come down to PyCon, find the nearest one in your region. PyCon India will be happening from August 30 to September 1st in Bangalore this year. Hope to meet many of you again there and in future PyCon(s).
This is set of portraits from the event, please help me to tag the people properly with names in the comments.
Day one of PyCon and I spent the whole day at the language summit. This post contains the notes I took during the day.
PyPy works :) 10th anniversary was few days back , 2.0 is coming. More near to c extension modules. Alpha version targeting Python 3.2 will come in. Currently buildbot has around 20 modules fail in the same.
Both python 2.7 and python 3 will be supported. Greenlets or stackless support, it is fast now. Gambit research paid for greenlet support work to fijal.
Code wise rpython is now different, pypy uses rpython as a library. Final goal is to split it out. STM: attempt to remove GIL, it kind of works, it leaks memory now.
Jython 2.7 beta 1 released last month. No python 3 support yet, but the developers really want to work on it. Utilizing Java 7 features is yet to be done.
2.7 is there for couple of years. Not many contributors. Trying to get whole .NET plugins directly be used in ironpython. It is on github as apache2 license. Developers like to get Python3 support this year.
There will be many packaging changes. Just convince him and he will figure the required people for peps. around half dozen projects on packaging standard. The new approach is to evolve the echo system than changing the world.
setup.py install must die. It should go away, metadata 2.0 can be the future, move installation and metadata move away from setup.py
Lot of metadata peps important people to accept them are not python devs. setuptools, distribute, zc.builtout, condor etc they need to approve the metadata standard.
Decouple buildsystem from the tool people choose to install the software. Metadata 2.0 is to clearly differentiate between installer and buildsystem.
Metadata 2.0 will have one post-install hook, there will be sane API. All discussions on metadata is on distutils-sigs, people are frustrated as discussion needs to happen in distutils-sig and also python-dev lists.
Nick wants to change the away PEPs get approval. The PEP on metadata stuff should happen in distutils-sig only.
People in the summit agreed on sub-topic mailing lists as discussion places.
Related peps: 426
Lot of problems in XML. People were saying "If you are accepting unsafe data you should check it before using it". Should be turned on in 2.7 also (the monkeypatching code from Christan) or not was the main discussion. People talked about many use cases which we might break if we turn it by default. Alex reported that Django project is keeping in touch with Christian on XML issues.
PEP380 was "yield from". Incredibly easy and difficult at the same time. We can do better with "yield from". Start a fresh in the standard library and wanted to have an unified event loop. All in PEP3156. there is a standard interface which everyone can use, one such implementation must be in the stdlib, different library can provide their own implementation.
Talked about his love for microsoft products and snakebite project details.
http://hg.python.org/sandbox/trent px branch
Work started from late December (full time until mid Feb-ish). Code is in prototype condition. Only works on Vista+ (for now) Aim is to get everything working first and then refactor/review, review support for other platforms etc.
My favorite line from the talk is about telling one good thing about Windows is that it will not change :p
All existing solutions on table are mostly "paradigm shift" but most of the users and Guido does not want a paradigm shift.
Then he talked about www.snakebite.net project, check the about page for more information.
It is a working prototype. DSL as in comments to the c functions. Mostly people ignored it in python-dev. Stephen's competing PEP, Nick is now reviewing it 0437. Step 1. Build vanilla python step 2. make the changes step 3. use the vanilla python3 to recreate the .c files from the DSL
Proposal is to include cffi in the stdlib.
Ctypes is bad, complex API.
CFFI will help not segfaulting by using compiler. It uses the compilers to verify the signatures. The scope here is calling C. It is doing verify during setup.py level. hash inside verify method. Broken down to compile step to generate cache step, load step to fail if no cache. Runtime to load only
Proposal is not deprecating ctypes. (fijal) while answering to one of Barry's question.
Too early to put in standard library as Thomas thinks , Nick thinks 3.4 is still an option for it. Standard question on python-dev, I crashed python, did you import ctypes ? come back when you don't and still crash :D ctypes has lots of overhead in import so it will be hard to slower than ctypes. ply is good be in stdlib (bdfl). Putting things in stdlib and then telling it is implementation details is not good. answering eli.
Go through the unfortunate world, users don't have c compliers and want to use it. (Ned)
3.3.0 is first to cross build for different architectures. backported to 2.7. Changes were in configure stuff, extensions to the stdlib.
get rid of access to sys modules, replaces sys.platform to host.platform, get the information from sysconfig.
Difficult to do cross builds, people tend to break things. make cross test, for particular build slaves, not to run make test but only cross
Working on various tests suites. shift our norms on test, less comfortable.
keep it simple or support every usecase you can think of. -- different dimensions Derived from int or act like an int in all cases. PEP 435
We will give you couple of simple things and then build complex things using meta classes. (Guido) pointed that out and One enum in stdlib, may be a BDFL.ENUM :D
Large chunks will benefit from it.
Larry informed at the very end that Kenneth is ok to have requests in stdlib. New implementation on the same API on top of tulip (Guido) as everyone agreed that requests is awesome API but needs reimplementation.
At the end Nick also suggested to have a legacy index in the docs which can clearly tell readers that don't use this in the new code.
During 5th and 6th February, dgplug arranged workshops related to Fedora and Python in Dr. B. C. Roy Engineering College. More than 120 students attended the workshops in two days, we never managed to fit them all in the lab so we had to split them up into two different batches.
Day one we started with a generic talk about programming and about Fedora. Around 11:40 am we started moving the students into the lab. At first we discussed more on our ideas and benefits of contributing to free software projects, from there we started demoing Fedora and available tools. I followed my normal flow of introducing Fedora and later Python. As many of them never used Linux before, students were excited and few were even new to programming in general. We took a lunch break and started with the second batch in the next half.
We had around 12 students attending the hacknight. The idea was to have a working system which will allow trusted remote systems to submit C programs to a central server and the few build workers will keep monitoring the job queue, they will compile the code and execute it and return the result or any errors back to the users to the remote systems. In the college lab there were many Windows machines which they use for first year students to teach C using Turbo C IDE. As the client code students wrote were using default python modules, it was easy to have those Windows computers as target audience.
We started after dinner around 11 pm, after I explained the whole idea to them we divided the students into two groups, one group was writing the client side code on Windows systems and the second group was writing the server side build workers. As Sayan was the senior most in between them he started writing the Django server which will listen to the clients, create build jobs and return results.
I slept for next few hours as I had to wake up early next day for the workshops, but students stayed up and they kept working on the problem. Around 4 am they woke me up and by 4:35 am they produced a fully working code as an initial solution to the problem. As there were no network in the hostel I carried my wifi router and we were using just the local network. Sayan's laptop worked as the primary server. I hope they will put up code in few days with few code cleanups.
The reason we wanted to organize this hacknight was to show the first year students that they can do better project work than most of the final year students in the college and that is also in one night their code will do more work than final year projects (students generally do hotel reservation or flight/railway reservation system as final year project).
Day two started at 10 am. We used different problems in both the batches which made them to learn more about Fedora and Linux in general. We spent time in reading the amazing documents Python community wrote. The students were not used to the idea of reference material in college labs.
In both the workshops (in NIT Durgapur and in Dr. B. C. Roy Engineering College) this time I gave more time in reading existing documentation. Many students stay aways from programming in college as they never get access to the quality material like Python documentation.
All photos are from Chandan Kumar.
In the first week of February I did couple of workshops in two different colleges in West Bengal. This post is about the first workshop at Mukti 2013 in NIT Durgapur.
Day one of the event started around 10.30 am. The hall was almost full, more than 90 students, we spent first' few minutes distributing live-cds and setting up the environment for the rest of the day.
Most of the students were from 1st and 2nd year of engineering and there were a few 1st year M. Tech students also attending.
Next I had to explain few basic Linux commands and how to do basic file management in Fedora. I introduced vim as an editor to them. We broke the day in two half(s) and explained most of the basic syntax and we also wrote few very simple programs to give them an idea how it feels with Python. At the end of the day I asked the students do to read more from my book and from the python tutorials.
Sayan, Oini, Chandan, Sanjiban, Biraj, Souradeep helped as TA(s) during the workshop.
After going back to the guest house we found there was no network so we moved to the Hall-2 of the boys hostel and I had to continue explaining Python packaging and few other related stuffs to the interested students till early morning.
Day two started around 11:30 am and we quickly moved into writing small programs which can solve some real life problems. Few of them were about finding out various system details (eg. system memory status etc), downloading files from network. I made sure that all problems will force them to read the python doc strings in the interpreter and the students also had fun to read and finding out required functions themselves. We had more than 60 students attending the workshop in the day two.
Few students came back with more questions after the workshop and they even came to discuss more when I was back in Durgapur in one evening after few days.
The teachers of the college later said that they liked that few students who were not that much active before, became very active during and after the workshop and they were really excited in using Python as the primary tool for their work.
Few photos from the event (copyright Chandan Kumar) are below, I will upload my photos in few days.
I took it just after we exchanged garlands in the wedding ceremony. She was looking back before this and was in shock to see the big lens :)
Nicu took a back scene shot of the same.
I pushed python-pandas-0.10.0 in Fedora testing repo.
You can install it by the following command:
# yum install python-pandas --enablerepo=updates-testing
Feel free to test and provide comments in bodhi.
This post is for my friends who become really confused with
__len__() special method.
len(obj) is a builtin function which returns the length of an object. The obj
argument can be either a sequence (lists, tuple or string) or a mapping (dictionary).
object.__len__(self) is the special method which is called in the implementation
len() function. For a class you define
object.__len__(self) function and compute
the length, then calling
len(obj) on the instance gives you the length.
len() also does sanity checking on top of
>>> class Foo(object): ... def __len__(self): return '1' ... >>> obj = Foo() >>> obj.__len__() '1' >>> len(obj) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: an integer is required
Table of Contents
First step is to install the latest Nikola.
$ pip install https://github.com/ralsina/nikola/zipball/master
Next step is to export your existing blog into XML format. Login to your Wordpress,
Dashboard->Tools->Export option and download the exported xml file
to your computer, the name of the file will be like mysite.wordpress.2012-12-20.xml
Remember to update your Wordpress to the latest version before exporting.
You can import the posts using the following command
$ nikola import_wordpress mysite.wordpress.2012-12-20.xml
After the above command you will have a new_site directory and inside your blog is ready.
This import will have:
If you get errors while importing the xml file, please do mail the xml file to the upstream so that he can fix the importer.
You can build the posts using the following command inside the new_site directory.
$ nikola build
You can just rsync
output/* to your site and it will be available to others.
You can have deploy command for the same in
DEPLOY_COMMANDS = [ 'rsync -rav --delete output/* email@example.com:./public_html/', ]
You can use the same files to create your github pages. You just need to put output
directory under git as
username.github.com git repo.
The naming schema must have
username/username.github.com naming scheme.
username.github.com should be ready.
If you want to use BitBucket to host your static site, do the following.
username.bitbucket.org should be ready.