Planet dgplug

October 20, 2016

Farhaan Bukhsh

PyCon India 2016

Day 0

“This is awesome!”, this was my first reaction when I boarded my first flight to Delhi. I was having trouble in finding a proper accommodation Kushal, Sayan and Chandan helped me a lot in that part, I finally got honour of  bunking with Sayan , Subho and Rtnpro which I will never forget. So, I landed and directly went to JNU convention center. I met the whole  Red Hat intern gang . It was fun to meet them all. I had proposed Pagure for Dev Sprint and I pulled in Vivek to do the same.

The dev sprint started and there was no sign of Vivek or Saptak, Saptak is FOSSASIA contributor and Vivek  contributes to Pagure with me. Finally it was my turn to talk about Pagure on stage , it was beautiful  the experience and the energy.  We got a lot of young and new contributors and we tried to guide them and make them send at least one PR.  One of them was lucky enough to actually make a PR and it got readily merged.

I met a lot of other contributors and other mentors and each and every project was simply amazing. I wish I could help all of them some day. We also met Paul, who writes code for PyCharm, we had a nice discussion over Vim v/s PyCharm.

Finally the day ended with us Vivek, Sayan , Subho  , Saptak and me going out to grab some dinner. I bunked with Sayan and Subho and we hacked all night. I was configuring my Weechat and was trying all the plugins available and trust me there are a lot of them.

Day 1

I was a session chair in one of the lecture room and it was a crazy experience from learning to write a firmware for a drone, using generators to write multi-threaded program and also to work with salt stack. The food was really good but the line for food was equally “pythonic” as the code should be.

There were a lot of stalls put up and I went to all of them and had a chat with them. My favorite one was PyCharm because Paul promised me to teach me some neat tricks to use PyCharm.

The Redhat and Pyladies booth were also there which also were very informative and they were responsible making people aware about certain social issues and getting women in tech.

We had two keynotes on this day one by BG and the other by VanL and trust me both of the keynotes were so amazing the they make you look technology from a different view point altogether.

One of the amazing part of such conferences are Open Space and Lightning talks. There are few open spaces which I attended and I found them really enthralling. I was waiting for the famous Stair case meeting of Dgplug.  We met Kushal’s mentor, Sartaj and he gave a deep insight in what and why we should contribute to open source. He basically told us that even if one’s code is not used by anyone he will still be writing code for the love of doing it.

After this we went for Dgplug/Volunteers  dinner at BBQ nation, it was an eventful evening😉 to be modest.

Day 2 

The last day of conference I remember myself wondering how a programming language translates into philosophy and how that philosophy unites a diverse nation like India. The feeling was amazing but I could sense the sadness. The sadness of parting from friends who meet once in an year. I could actually now relate all IRC nicks with their faces. It just brings a lot more on the table.

At last we all went to the humdrum of our normal life with the promise to meet again. But I still wonder how a technology bring comradeship between people from all nook and corners of life. How it relates from a school teacher to a product engineer . T his makes  me feel that this is more than just a programming language , this is that unique medium that unites people and give them power to make things right.

With this thought fhackdroid signs out!

Happy Hacking!

by fardroid23 at October 20, 2016 03:31 PM

October 19, 2016

Kushal Das

Tommorow FOSSASIA meets PyLadies Pune

Tomorrow we have a special PyLadies meetup at the local Red Hat office. Hong Phuc Dang from FOSSASIA is coming down for a discussion with the PyLadies team here. She will be taking about various projects FOSSASIA is working on, including codeheat. In the second half I will be taking a workshop on creating command line shell using Python.

On Friday we will be moving to Belgaum, Karnataka, India. We will be participating in Science Hack Day India, the idea is to have fun along with school kids, and build something. Praveen Patil is leading the effort for this event.

by Kushal Das at October 19, 2016 01:45 PM

October 18, 2016

Shakthi Kannan

GNU Emacs - News Reader

In this next article in the GNU Emacs series, we shall learn how to use GNU Emacs as a news reader.


Elfeed is an Emacs web feed reader that is extensible and supports both Atom and RSS feeds. It has written by Christopher Wellons.


We shall use Milkypostman’s Experimental Lisp Package Archive (MELPA) to install Elfeed. Create an initial GNU Emacs start-up file that contains the following:

(require 'package) ;; You might already have this line
(add-to-list 'package-archives
             '("melpa" . ""))

(when (< emacs-major-version 24)
  ;; For important compatibility libraries like cl-lib
  (add-to-list 'package-archives '("gnu" . "")))
(package-initialize) ;; You might already have this line

The above code snippet has been taken from the MELPA project documentation website, and has been tested on GNU Emacs 24.5.2.

You can now start GNU Emacs using the following command:

$ emacs -Q -l ~/elfeed-start.el

You can obtain the list of available packages using M-x list-packages, which will search the and repositories. You can search for ‘elfeed’ in this buffer, and select the same for installation by pressing the ‘i’ key. To actually install the package, press the ‘x’ (execute) key, and Elfeed will be installed in ~/.emacs.d/elpa directory.


You can create a shortcut to start Elfeed using the following code snippet in your ~/elfeed-start.el file.

(global-set-key (kbd "C-x w") 'elfeed)

The list of feeds can be defined as shown below:

(setq elfeed-feeds
      '(("" people)
        ("" projects)
        ("" people planet)

Tags can be added at the end of the feed. The above feeds include ‘people’, ‘projects’ and ‘planet’ tags.


You can use the C-x w shortcut to start Elfeed. If you press ‘G’, it will fetch the latest news feeds from the servers, starting with the message ‘3 feeds pending, 0 in process …’. A screenshot of Elfeed in GNU Emacs is shown below:


The RSS entries are stored in ~/.elfeed directory on your system.

You can read a blog entry by pressing the ‘Enter’ key. If you would like to open an entry in a browser, you can use the ‘b’ key. In order to copy the selected URL entry, you can use the ‘y’ key. To mark an entry as read, you can use the ‘r’ key, and to unmark an entry, press the ‘u’ key. You can add and remove tags for an entry using the ‘+’ and ’-’ keys, respectively.

You can also filter the feeds based on search critera. Pressing ’s’ will allow you to update the filter that you want to use. There are many filter options available. You can use ‘+’ to indicate that a tag must be present, and ’-’ to indicate that the tag must be absent. For example, “+projects -people”.

The filter text starting with ‘@’ represents a relative time. It can contain plain English text combined with dashes – for example, ‘@1-month-ago +unread’. The ’!’ notation can be used to negate a filter. To limit the number of entries to be displayed, you can use the ‘#’ pattern. For example, ‘+unread #5’ will list five unread blog articles. A screenshot of Elfeed with a filter applied is shown in the following figure:

Elfeed filter

You can also use regular expressions as part of your filter text. The default search filter can be changed by modifying the value of elfeed-search-filter. For example:

(setq-default elfeed-search-filter "@1-month-ago +unread")

The search format date can be customized as shown below:

(defun elfeed-search-format-date (date)
  (format-time-string "%Y-%m-%d %H:%M" (seconds-to-time date)))

Elfeed also has an export option to view the feeds in a browser. If you install the elfeed-web package from the packages list, you can then start it using M-x elfeed-web-start. You can then start a browser, and open http://localhost:8080/elfeed/ to view the feeds. A screenshot is shown below:

Elfeed web

The entire contents of the elfeed-start.el configuration file are shown below:

(require 'package) ;; You might already have this line
(add-to-list 'package-archives
             '("melpa" . ""))

(when (< emacs-major-version 24)
  ;; For important compatibility libraries like cl-lib
  (add-to-list 'package-archives '("gnu" . "")))
(package-initialize) ;; You might already have this line

(global-set-key (kbd "C-x w") 'elfeed)

(defun elfeed-search-format-date (date)
  (format-time-string "%Y-%m-%d %H:%M" (seconds-to-time date)))

(setq elfeed-feeds
      '(("" people)
        ("" projects)
        ("" people planet)



Gnus is an Emacs package for reading e-mail and Usenet news. The nnrss backend supports reading RSS feeds. Gnus is available by default in GNU Emacs. After launching emacs using emacs -Q in the terminal, you can start Gnus using M-x gnus. To add a new RSS entry, you can use ‘G R’. It will prompt you with the message ‘URL to Search for RSS:’. You can then provide the feed, for example, It will try to connect to the server and will provide you the message ‘Contacting host:’. After a successful connect, it will prompt for the title, ‘Title: Shakthimaan’s blog.’ You can simply hit Enter. You will then be prompted for a description, ‘Description: RSS feed for Shakthimaan’s blog.’ You can hit Enter to proceed. Now, the blog entry has been added to Gnus. In this fashion, you can add the other blog entries too. A screenshot of the main Gnus group buffer is shown below:



You can press ‘g’ to refresh the buffer and ask Gnus to check for latest blog entries. Using the ‘Enter’ key will open the feed, and the list of blogs for a feed. A screenshot is shown in Figure 5.

Gnus articles

You can press ‘Enter’ on a blog entry, and it will open the contents in a new buffer. It will then be marked as read, indicated by ‘R’. A screenshot of a blog entry rendering text and image is shown in the following figure:

Gnus blog entry

You can press ‘q’ to quit from any level inside Gnus. You are encouraged to read the Gnus tutorial ( ) and manual ( ) to learn more, and to customize it for your needs.

October 18, 2016 03:45 PM

October 17, 2016

Kushal Das

Event report: PyCon India 2016

This time instead of per day report, I will try to write about things happened during PyCon India. This time we had the conference at JNU, in Delhi. It was nice to be back at JNU after such a long time. The other plus point was about the chance to meet ilug-delhi again.

Red Hat booth at PyCon

We had booth duty during the conference. Thanks to Rupali, we managed to share the booth space with PyLadies. After the keynote the booth space got flooded with people. Many of them were students, or freshers looking for internship option. We also had queries about services provided by Red Hat. Just outside the booth we had Ganesh, SurajN, Trishna, , they were talking to every person visit our booth. Answering the hundreds of queries people had. It was nice to see how they were talking about working upstream, and inspiring students to become upstream contributor. I also did a talk Python usage in Red Hat family.

PyLadies presence

This was the first time we had PyLadies presence in PyCon India. You can read their experience from their blogs, 1, 2, 3. This presence was very important as it helped the community to learn about PyLadies. We saw the expectation of starting new chapters in different parts of the country. Nisha, Anwesha, Pooja, Rupali, Janki and the rest of the team managed to get an impromptu open space session, which I think was the best session on community I ever saw. Jeff Rush, Van Lindberg, Paul Everitt, Dmitry Filippov joined to share their experience in community.

annual dgplug face to face meeting

From we all meet face to face during PyCon India, we generally call the meeting as stair case meeting as we used to seat in the stair case of the Bangalore venue. This time we chose the seat in the ramp in the venue. We had a list of people coming, but as you can see in the photo below, the list of dgplug, and friends is ever growing. Sirtaj also came in during the meeting, and shared some valuable ideas with the students. I should mention VanL’s keynote at day one here. As he spoke about “failure”, which is something people don’t prefer to talk. It is very much important for the students to understand that failure is something to learn from, not to run away. Most of the students we talked later, had being able to understand the points Van made in his talk.

Anwesha’s first talk at PyCon

She already wrote about the talk in her blog. But I want to mention it again as it gave a new perspective to the developers present in the conference. For the students present in the conference who wanted to become upstream contributors, got a chance to learn about the binding point, the license. She talked about best practises at the end of her talk. Few days back I read another blog post about her talk (and the PyLadies).

One can view all the photos in my flickr album.

by Kushal Das at October 17, 2016 05:16 AM

October 01, 2016

Suraj Deshmukh

PyCon India 2016

This was my second PyCon and first visit to Delhi. I was excited to meet all old friends from dgplug, PythonPune, PyCon 2015, folks from twitter and IRC. It was different this time, because I co-hosted a Docker workshop with my colleague Lalatendu Mohanty at a large conference like this and was travelling with friends from PythonPune.


Day 0

This was tutorials day (workshops + devsprints). We(I and Lala) started workshop early morning. Lala explained the concept of containers and how ecosystem of application deployment, delivery has changed with involvement of containers while I did the hands-on walkthrough of the workshop.


Lala along with Praveen Kumar helped the folks during the hands-on. The workshop went well and people were curious to learn things in this changing world.



After workshop I mainly sat in devsprint room and did some hacking(random things). Meanwhile Shubham Minglani, my team-mate helped folks understand ansible-container. He was mentoring in devsprint for ansible-container project. Given the limited internet speed, Shubham setup an excellent fall back plan for the folks to pull containers. He got his Raspberry Pi and wifi router where Raspberry Pi was running FTP server and wifi router was access point to that FTP server. That was an awesome setup and too much effort for potential contributors of the project.

At the end of the day, in volunteers meet, I was handed over the responsibility of Lecture Hall 2 a.k.a Audi 3, where I and a bunch of volunteers made sure things went smooth for the next two days.

Later we went for a short walk around JNU campus, where we could smell the political air in the campus.

Day 1

Day 1 started with BG‘s Keynote, but I had to rush in middle of it to take care of my hall, this started with making sure volunteers for the hall were present, speakers were present on time, schedule of the day and speaker’s info was handy.

Having handled the responsibility of hall I realised how hard it is to deal with so many behind the scene things for a conference to run smoothly. Due to this I could not attend any talk properly as I had to rush to take care of unforeseen things that would pop up. Things went well that day though.

Day 1 ended with Keynote by Van Lindberg, which I attended completely. In his awesome talk, he presented on how failures in software world are essential and how one can cope and learn from them.


Folks at Red Hat booth:


Day 2

Similar to Day 1, there was a keynote from Andreas Muller, from which I had to drop off in the middle to make sure all things in my hall were ready. First talk in my hall was by my colleague Ratnadeep Debnath on Real Time microservices with server side Flux, where he presented how he has implemented micro-service and async architecture in his very own project waarta and IRCB.


Post which we had our usual yearly dgplug stair-case meeting, but this time, not on a staircase but on a ramp, where Kushal asked for feedback and gave general guidelines.


This time dgplug was even bigger and there were more folks doing awesome stuff. Kushal also acquainted us with his mentor – Sirtaj Singh Kang, who introduced him to Python.


This was followed by a Red Hat sponsored talk in my hall presented by Kushal, where he mainly talked about how Python is at heart of Red Hat’s open source projects and eco-system with projects like anaconda, Ansible, RDO, etc. to name a few.


The last day of the PyCon ended with photo session with dgplug folks and various other groups.


Folks from PythonPune


On a closing note, shout out to the volunteers viz. Shashank Kumar, Pushplata Ranjan, Prashant Jamkhande, Girish Joshi and others for being there and helping me out for two days. Things went smooth because of you and your helping hand.

This year’s PyCon was a good and a memorable experience. I made new friends and saw new places ( worth mentioning my extended stay, to explore Delhi and nearby places).


Thanks to: Kushal, Sayan, Chandan and other folks for awesome clicks, that I used in this blog. Suraj Narwade for all the pre-conference management. And finally Hemani for help with this blog.

by surajssd009005 at October 01, 2016 03:33 PM

September 30, 2016

Farhaan Bukhsh


Recently I have been to pycon-india (will blog about that too!) there Sayan and Vivek introduced me to weechat which is a terminal based IRC client, from the time I saw Sayan’s weechat configuration I was hooked to it.

The same night I started configuring my weechat , it’s such a beautiful IRC client I was regretting why did I not use it before. It just transforms your terminal into IRC window.

For fedora you need to do:

sudo dnf install weechat

Some of the configuration and plugins you need are :

  1. buffer
  2. notify-send

That’s pretty much it but that doesn’t stop there you can make that client little more aesthetic.  You can set weechat by using their documentation.

The clean design kind of makes you feel happy, plus adding plugin is not at all a pain. In the weechat window you just say /script install and it just installs it in no time.  There are various external plugin in case you want to use them and writing plugin is actually fun , I have not tried that yet.


I also use to use bigger font but now I find this size more soothing to eyes. It is because of weechat I got to know or explore about this beautiful tool called tmux ,  because on normal terminal screen weechat lags , what I mean by lag is the keystroke somehow reach after like 5-6 seconds which makes the user experience go bad.  I pinged people on IRC in #weechat channel with the query the community is amazing they helped me to set it up and use it efficiently , they only told me to use tmux or screen . With tmux my session are persistent and without any lag.

To install tmux on fedora:

sudo install tmux

tmux is a terminal multiplexer which means it can extend one terminal screen into many screen . I got to learn a lot of concepts in tmux like session, pane and windows. Once you know these things in tmux its really a funride. Some of the blogs I went through for configuring and using tmux the best I found was hamvoke , the whole series is pretty amazing . So basically my workflow goes for every project I am working on I have a tmux session named after it, which is done by the command:

tmux new-session -s <name_session>

Switching between two session can be done by attach and detach. And I have one constant session running of weechat. I thought I have explored every thing in tmux but that can’t be it , I came to know that there is a powerline for tmux too. That makes it way more amazing so this is how a typical tmux session with powerline looks like.


I am kind of loving the new setup and enjoying it. I am also constantly using tmux cheatsheet :P because it’s good to look up what else you can do and also I saw various screencast on youtube where  tmux+vim makes things amazing.

Do let me know how you like my setup or how you use it .

Till then, Happy Hacking!🙂


by fardroid23 at September 30, 2016 06:16 PM

Anwesha Das

My talk about software licenses in PyCon India

The title for my talk was "The trends in choosing licenses in Python ecosystem". As a lawyer what interests me is the legal foundation of the open source world. It is the licenses, which defines the reach of the software. Most of the developers would frown their eyebrows to hear that. Most of the developers think about licenses as large, boring, legal, gibberish text. So the aim of my talk was to give them an overview of licenses, why it is important and what are the best practices for the developers regarding the licenses. I framed my talk (as a lawyer) around licenses, majorly focusing on them as:

  • what are the different kinds of licenses?
  • Definition and elaborate explanation of each of open source licenses.
  • What difference between free software and open source software?
  • Little bit of my work around PyPI.
  • Why the developers has chosen some particular licenses more than the others?
  • The answers to that.
  • The best practice for the developers while choosing a license in a gist.

Three days before my traveling I got a mail from the organizers that all the proceedings of the conference such as the slides, talk videos all these things will be in Public Domain. I was shocked and stunned too. It took me a lot of time, and mails to make them really understand that by speaking in front of public does not really make anything Public Domain. I was tweeting about the same to the speakers please add license in the slides for your talk. But even in then in Day 0 in the venue itself I got to know many of speakers had no clue about what were the licenses for their talks.

I realized my talk is too lawyerish. It would be a sure super flop talk. People would leave the hall within 5 minutes. So, I needed to reframe my talk from lawyerish way to developrish way. I had only few hours (approximately 10 hours) left. Kushal really wanted to stay for his friends but I dragged him (sudo wify power:)). We reached the Airbnb where we were staying. Started rearranging my talk slides. I was stressing on:

  • My project.
  • How did I do my work the progrmish way.
  • The basic concepts of licenses, without going into much details.
  • Explaining them with real life examples which will everyone understand.
  • A special stress on Public Domain (given the problems going on in PyCon India).
  • Then the most part of my talk was covering Best Practices for the Developers.

Slides got ready by 10PM. Had a quick dinner. While waiting for the dinner wrote the Blogpost. That day only I read a blog post by Zainab Bawa about practicing talk, such a perfect timing and a great post. I discerned the fact again that I need to begin practice my reframed talk. It was almost 12. I had no time left to practice my talk. I was tensed, scared. I began practicing and of course I was not been able to do it properly. That made me more frightened, nervous. Then started the whole episode of super attack of inferiority complex, IANAD (I am Not a Developer) syndrome, crying, yelling at Kushal and many other regular melodrama before me giving any talk. I wasted almost half an hour and then practiced my talk again. It was much better now. At least Kushal liked it much more. We slept at 2PM. Got up with a shrill alarm at 5:30AM. Practiced the talk again twice. We had to leave for the venue. Reached there and did the PyLadies related work.

My talk was scheduled at 4PM. After lunch I did my PyLadies table duties for half an hour. Thanks to all my PyLadies friends they released me from the duty. I went to the devsprint room and practiced my talk over there.

I reached at lecture hall 2 where my talk was scheduled before 5 minutes of time. It took some time to do the set ups ready. I started my talk with my memory of PyCon India 2012, which made the foundation for this talk. I defined software license, copyright and different open source licenses, FOSS with various real life examples which will help developers to easily understand the legal concepts in a lucid format. I told them about my project and showed them how did I got the licenses of each package in PyPI (and I did some silly goof up over there, no excuse but I was tensed). Then I focused to prime most important part of my talk The Best Practices for the Developers. Lets discuss them :

  1. Choose a license matching the aim of regarding use case the software, if its library/module choose a permissive one So people can easily use them in their code.

  2. Create a "license" file i.e license.txt and/or file. The file should have name of the license as well as the full license text of the license document.

  3. The developer must add a copyright header to each significant source code file. Significant includes both the volume and importance.

  4. In README or equivalent introductory file which contains all the basic information of the project, the license name must be stated over there. And also the reference of the same to direct the reader to the license file.

  5. In case in users freedom is the one you aim. Also you want to share the improvement made by you to the community and society. Therefore GNU GPL is the license for you. In case of GPL you need to distribute the original source code along with the modifications you have made.

  6. If you are concerned about patents and at the same time you want an open source license. Then Apache is suitable according to your need. But very importantly it only takes care of the patent part but not all other intellectual property rights (such as trademark).

  7. Please do not invent your own license. There are plenty of nicely drafted licenses meeting all your requirements. Trust the legal experts they know the law. To explain this I gave example of my little goof up which I did during typing a simple thing while explaining my project. So, I explained that as I am not the person who primarily a developer I did that mistake. If a person who is primarily a developer and not lawyer will do the same mistake in drafting a license. Covenant and conditions are several things of which you have to take care while drafting a license.

  8. If you ignore all the caution and try to draft your own license try not to have clauses like "Buy me a beer" or "Don't be evil"(please keep your funny bones to yourselves only), the legal implication of these are different.

  9. One can get several options of licenses you can have look at,, FSF also Fedora Project has a nicely maintained list of open source licenses (compatible in Fedora project). (by github) is another nicely maintained website for choosing licensing.

  10. By choosing a license one chooses the community. Therefore if you are confused about license or your software, choose one which is popular in your community.

Points to Remember while choosing a license by a developer

  1. Remember if you create new project, you have the copyright to that, and by default retain all rights

  2. A license says that they can use/copy/modify your creation, but only if they follow the rules of the license.

  3. If you choose to let other people use/copy your work, you should grant them a license having similar clauses.

  4. Remember by choosing a license you are making a boundary for your software.
  5. You should NEVER use something that doesn't explicitly state what the
    license is.
  6. Permissive let them use your work in a commercial or proprietary application.
  7. copyleft require them to make their changes available
    under the same license.
  8. There are huge points of distinction between copyleft and permissive licenses.

Thank you

There are few people to thank actually without whose help it would not have been possible for me to give this talk:

Van Lindberg: What ever little law related to open source I have learnt it is the Van-ish way. His book has helped me immensely. Thank you Van for checking my slides and giving me enough confidence that my understanding is right.

Nick Coghlan: Thank you for giving your valuable advice whenever I needed them. Moreover for your moral support when I was down.

Donald Stufft: Thank you for reply to my mail for reviewing my talk. Moreover thank you for doing the gigantic work of maintaining PyPI.

Jared Smith: About you where should I start from. Whenever there is a problem regarding this talk, my understanding, the framing of my talk, anything, you helped. Be it the early morning video sessions or the long (really huge) mail thread, thank you so much for helping me.

I will end with a note that the whole foundation of open source is its licenses. Therefore please be sure when you choose one.

by Anwesha Das at September 30, 2016 03:51 PM

Trishna Guha

What is if __name__ == ‘__main__’ ?


Module is simply Python file that has .py extension. Module can contain variables, functions, classes that can be reused.

In order to use module we need to import the module using import command. Check the full list of built-in modules in Python here

The first time a module is loaded in to running Python script, it is initialized by executing the code in the module once. To know various ways of importing modules visit here:

if __name__ == ‘__main__’:

We see if __name__ == ‘__main__’: quite often. Let’s see what this actually is.

__name__ is global variable in Python that exists in all namespaces. It is attribute of module. It is basically the name of the module as str (string) type.

Show Me Code:

Create a file named ‘’ and type the following code and save it. We have defined a simple mathematical square method here.


Now create another file named ‘’ in the same directory and type the following code and save it.


Now on terminal run the program with ‘python3’

Here we have defined a method in a module and using it in another file.

Now let’s look into if __name__ == ‘__main__’:

Open the ‘’ file and edit it as given in following:


Leave ‘’ unchanged.

Now on your terminal run ‘’. 


Here we have imported the module mymath. The variable __name__ is set to the name of the module that is imported.

Now on terminal run ‘’


We have run the file as program itself. And you can see here the variable __name__ is set to the string “__main__”.
And we have checked if __name__ == “__main__” is True execute the following instructions which means if the file is run as standalone program itself execute the following instructions.

If you do  print(type(__name__)) in the program, you will see it returns ‘str’ (string) type.

Happy Coding!

by Trishna Guha at September 30, 2016 08:59 AM

September 28, 2016

Anwesha Das

First time PyLadies presence in Pycon India

The title for the blog post is not something I wrote but copy pasted a tweet by @kushaldas. Kushal is being attending PyCon India since 2010, a year after it started. This one tweet of his says if not the whole but lot of it. So, lets explore our journey of PyLadies in PyCon India


In the first week of August I had mailed the PyCon India Organizers requesting a table for PyLadies during PyCon India. But mid August got a reply that they will be unable to give one since we were not the sponsors. Then Rupali got into the matter and she said that Red Hat (the Yoda for PyLadies Pune) would love to give us a space in their booth to promote PyLadies. With the that support we started our planning for PyCon. We had a lot of things to do. The prime of them was that to break to earlier notion about PyLadies in India. A Glibc developer, Siddhesh Poyarekar actually sponsored Python tee shirts for us. This is an example the true diversity and the beauty of the Open Source Community.

Day 0

Went to the venue to check things and the Red Hat booth. Was a little disappointed to see that it is on the last corner, and not in front of the main auditorium. Asked Janki and Dhriti to prepare their lightning talks about their work in Python.

Day 1

The day 1 started with a shrill alarm set at 5:30 in the morning. I had to practice my talk before reaching the venue. In the venue met Nisha (what a relief to see her). Me, Nisha, Pooja, Trishna, Rupali, Janki did all the booth set up ready. Rupali managed to give us a separate table inside the Red Hat booth so that we could keep our stuffs. Nisha had done a great job in designing the posters. Actually the new PyLadies Pune logo fetched attention of many people. Again Red Hat sponsored PyLadies posters too. As we never had the money to print stickers, so we have made print outs of the PyLadies Logo. Trishna made 50 print outs of them. We just cut that out and pined it up on our tee shirts and PyCon India badges. These badges made us noticed. Actually people came and asked but unfortunately we could not give it to everyone (we had only 50 of them and never thought it would be so popular :)). We had the photo prop, the PyLadies Umbrella, I had suggested Nisha to bring it over. Thank you Nisha for making it so nicely.

Then came the tough part going to people and telling them about PyLadies. As we are a group who are starting off, So, when initially I asked if they want to know and come to PyLadies here are some replies I got:

So I was going to people and asking them "Do you want to know about PyLadies?" or "Are you interested in PyLadies?" or "Do you want to join PyLadies?" Here are some answers which I got:

  1. "Do you have PyLadies in India! Never heard of that."
  2. " What is PyLadies?"
  3. " Coming in PyCon India since its inception. Never saw anything happening regarding PyLadies. Does PyLadies exist in India?"
  4. " Do you actually code in PyLadies?"
  5. " I am interested in Python but not in PyLadies."

That was disappointing (but I was not). We actually explained them about PyLadies. Most importantly that what binds PyLadies is the love to code in Python. Then I explained that what we do in our regular Pyladies Pune meet up. In the first half of the meetups we actually learn some Python syntax. In the second half we write code using them, so when we go back home we actually have something which we have created. We also have sessions on things important to contribute in Open Source. We listen to talks. We have a mailing list in which we keep posting problems regularly. After all these explanations the questions changed to:

  1. "How can I join PyLadies?"
  2. "I don't live in Pune, so how can I be apart of it?"
  3. "Can we open our PyLadies Chapter?"
  4. "Can you add me in your mailing list?"
  5. " Is it free?"

I directed them towards the Red Hat booth. Meanwhile Nisha, Puja, Trishna, Rupali answered them. After grabbing a quick lunch we all came back. But I should mention here that Rupali never had her lunch only so that she could be there at the booth. I had my talk on PyPI licensing trends. As soon as my talk ended a guy said "you PyLadies is such vibrant group with people doing such different work."

Day 2

We decided that we should have a PyLadies meet up at the Open Space. Since we are building the PyLadies community in India, we wanted some tips some directions regarding that. We approached Paul Everitt, Dmitry Filippov, Van Lindberg and Jeff Rush for that. The best persons we can have to talk about "how to build a community". We wanted an informal and personal discussion so that the audience could actually connect to it, put up questions and ideas. Rupali started the it with an appropriate note, actually stating what is the scenario of Pyladies in India. Then Paul, Dmitry, Van and Jeff took over the session. Then pointed the following tips about building community : a community

  1. must have a forum for discussion, i.e it should be open to any discussions,
  2. it must have new faces i.e people who can grow the community.
  3. visibility and consistency are the other two primary factors of building a community.
  4. There should be actual contribution and everyone should share their contribution with each other.
  5. The more you read code the more you will learn.
  6. Code reviews should be done in unison.
  7. Strong leadership is another point on which they stressed on.
  8. The leaders should prepare their replacements who will grow the community further.

Such thoughtful insights. They shared their personal experiences that how they started PyCon with very few people and never thought that will grow this big. I had always this question in mind that hat do people mean by technical work? Is legal stuff which I do primarily can be called technical? I asked Van about it and he answered it in affirmative. It was a true personal boost for me. It was really inspiring when they said that PyLadies in India is in safe hands and we are actually going to the correct directions ( I was actually jumping around after that :))

After lunch Trishna gave her Lightning Talk on " Fedora Atomic", which received nice response.

Outcome : What has changed after PyCon India for PyLadies?

In the feedback session I asked that this time we were denied a table, so how can we get it next year? The Organizers replied that as we were late this time they could not give us one. So I have requested for a PyLadies table next year in the conference, a year in advance (we are quite early this time right) So, hopefully we will have one in the next year as they said.

During lunch of day 1 a senior guy (one of the organizers) came to me and said that, "We never knew that you, PyLadies are doing so much actual work. We had some different ideas based on our previous not that good experiences. But we really want to help you guys. Please let us know how can we do that." After the lunch of day 1 we really did not need to go to people anymore, they were actually coming to us, PyLadies. People were thrilled to know that they can actually join and learn coding with us. Many people came to us to know how they can start their own PyLadies Chapter (at least 4). The biggest compliment came at the end of the conference when a group of girls came and said " You, PyLadies rocked PyCon India. Next time we will come for you guys only."

"Came for the language, stayed for the community"

This quote actually echos my feeling after PyCon. I met people like Paul Everitt, Dmitry Filippov, Van Lindberg and Jeff Rush who has made me realize that the more successful you are the more humble you be. For Jeff, I just requested him just before the panel discussion was starting, and he readily agreed, Thank you Jeff for that and also for the valuable advice you have given me. When I approached rest of the panelists for the discussion, they said just to remind them the time. In fact they came in the open space 5 minutes before the due time. So much to learn from you guys not only professionally, but personally too.

Now its a list of PyLadies whom I need to thank:

  • Nisha, I know how tough this was for you to leave your daughter and come here. (I know because I was going through the same thing). You did a great job in everything from making PyLadies Umbrella, designing Posters, Logo to managing the booth, guiding people with how to create their own chapter and every other thing which I am forgetting. I know you were also ready with you Lightning Talk but could not give one because of the unavailability of the slots. Kudos to you lady.

  • Rupali, for giving us a space in the Red Hat booth, sponsoring Posters without which we would not have any presence there in PyCon. Giving the awesome introduction in the PyLadies Open Space and managing the booth so well. You are my inspiration in my ways girl.

  • Trishna, for printing the badges, managing booth, talking to people, giving the Lightning Talk. You don't know girl how many people you inspire.

  • Pooja, this is one member of PyLadies Pune who does all her work silently. She was there everywhere be it the booth duty, talking to people, running around in the whole conference, setting up the booth or writing the mail ids (at 30 of them) for joining PyLadies mailing list and distributing it to everyone in the panel discussion, its a huge job lady. And of course not to forget fetching her husband at the correct time to help us :).

  • Janki, though she was very busy with her voluntary duties she manged to talk to people about PyLadies. Most importantly thank you for getting us the space in Open Space for panel discussion.

  • Devi for supporting us and for saying that she will send some chapters, problems in the mailing list for us to solve.

Also not forget about Dhriti, Nirupama(who came on the spot and helped us), Pusplata, Twinkle and many other. Thank you all for making PyCon India a success for PyLadies. With all our hard work we actually broke the earlier notion about PyLadies in India.

See you Ladies in the next PyCon India 2017.

by Anwesha Das at September 28, 2016 11:06 AM

September 25, 2016

Shakthi Kannan

GNU Emacs - Shells, spell-checkers, abbreviations and printing

In this next article in the GNU Emacs series, we shall learn how to execute shell commands, run shells, use spell-checkers and abbreviations, and print from GNU Emacs.

Shell mode commands

You can run a shell command from GNU Emacs using the M-! shortcut. For example, typing ‘M-!’ will prompt you with the message ‘Shell command:’ in the minibuffer. If you then type ‘date’, it will produce the output ‘Tue Dec 8 21:19:24 IST 2015’ in the minibuffer. But, if you want the output to be inserted in the current buffer you can use the C-u M-! command sequence.

Consider the following poem that I wrote:

"Water, water everywhere
Little power and aid to spare
Really tough for us to bear
We will face it with Chennaites' flair.

Lakes and rivers overflowing everywhere
No road, rail or plane to go anywhere
People really are in big despair
But we will ride it with Chennaites' flair.

More storms are forecast to be aware
Nothing like this in 100 years to compare
Stay indoors and please do take care
And we will take it with Chennaites' flair."

Suppose I want to know the number of words used, I can mark the poem as a region in the GNU Emacs buffer, and execute a shell command for the region using M-| shortcut. It then prompts with the string ‘Shell command on region’, and when I type in ‘wc -w’ it returns ‘90’.


There are three shells available in GNU Emacs - shell, ansi-term and eshell. Using M-x shell will invoke a shell for you. This starts a new buffer with the name ‘shell’ in it. You can use all the GNU Emacs buffer commands in this window. For example, C-p will move the cursor up, and C-n will move the cursor down. In order to interrupt a current job in the shell buffer, you can use C-c C-c. If you want to suspend the current job, you can use C-c C-z. You can also clear the output from the previous command using C-c C-o. For example, the output of ‘ifconfig’ command is shown below:

/tmp $ ifconfig docker0
docker0   Link encap:Ethernet  HWaddr 56:84:7a:fe:97:99
          inet addr:  Bcast:  Mask:
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
/tmp $

After executing ‘C-c C-o’, the previous command output gets cleared as shown below:

/tmp $ ifconfig docker0
 *** output flushed ***
/tmp $

You can move the cursor up to the previously executed commands using C-c C-p and move down using C-c C-n. You can also cycle backwards and forwards through the command history using the M-p and M-n shortcuts respectively. The C-c C-r shortcut moves to the first line of the output to the top of the window. You can move the cursor to the bottom of the window using C-c C-e. The C-r key binding allows you to search for a previously typed command from history.

The default shell is Bash, but, you can change it to use other shells like ksh, csh or zsh. You can open another shell buffer using C-u M-x shell. The new shell buffer will be called ’shell<2>". You can, of course, rename this buffer. You can thus open multiple shells to work inside GNU Emacs.

GNU Emacs also has a terminal emulator that you can invoke using M-x ansi-term. You can start a Bash session with this command to get the actual colours that you see in a terminal session. This is like a fallback shell if you do not want to use ‘M-x shell’. Eshell is the Emacs built-in shell written completely in Emacs Lisp (Elisp). You can start it using M-x eshell. The advantage of using this is that you can extend it, write your own customized Elisp functions and use it similar to shell scripting.

Screenshots of shell, ansi-term and eshells in GNU Emacs are shown in Figure 1, 2 and 3 respectively:

shell ansi-term eshell

Spell check commands

You can check the spelling of a word by placing the cursor on it and using M-$ shortcut. For example, for the word ‘hte’, GNU Emacs provides the following spelling options:

(0) hate (1) HT (2) ht (3) GTE (4) the (5) He (6) Te (7) he (8) Hts
(9) hie (:) hoe (;) hue (<) Rte (=) Ste (>) Ute (@) ate (B) rte

It also lists some options in the minibuffer:

C-h or ? for more options; SPC to leave unchangedo Character to
replace word

On pressing the number 4, the word is replaced with the correct spelling. If the spelling is already correct, then GNU Emacs will tell you that the word is correct. You can also spell check a region using M-x ispell-region and a buffer using M-x ispell-buffer. If you would like to stop the spell checker while it is running, you can use M-x ispell-kill-ispell. There is a flyspell mode that can check your spelling as you type. You can enable it using M-x flyspell-mode. If you want this mode only in a buffer, you can use M-x flyspell-buffer.

Word abbreviation

GNU Emacs can complete words for you. If you type ‘ba’ and then hit M-/, then GNU Emacs will try to complete the word for you. If you continue to use ‘M-/’, it will cycle through the various options such as ‘backwards’, ‘ball’, ‘bash’, ‘bar’, ‘back’, ‘based’ etc. To enter into the abbreviation mode, you need to use M-x abbrev-mode followed by the Enter key.

The abbreviations can either be local or global. Suppose, you want to define a local abbreviation for ‘international’, you can type in ‘intl’ and use C-x a i l to define the expansion. It will prompt you with the message ‘Mode expansion for “intl”:’. You can then type the word ‘international’. The next time you enter ‘intl’ followed by the space key, GNU Emacs will automatically expand the same for you. In order to define a global expansion, you need to use C-x a i g command sequence. If you would like to remove all abbreviations for the current session, you can use M-x kill-all-abbrevs followed by the Enter key.

You can save the abbreviations to a file, say ~/.emacs.d/.abbrev_defs, using M-x write-abbrev-file for future use. You can also edit the stored abbreviations using M-x edit-abbrevs shortcut. If you would like to view all the defined abbreviations, you can use M-x list-abbrevs. The relevant contents of ~/.emacs.d/.abbrev_defs are shown below:

;;-*-coding: utf-8;-*-
(define-abbrev-table 'Buffer-menu-mode-abbrev-table '())

(define-abbrev-table 'completion-list-mode-abbrev-table '())

(define-abbrev-table 'edit-abbrevs-mode-abbrev-table '())

(define-abbrev-table 'emacs-lisp-mode-abbrev-table
    ("intl" "international" nil 2)

(define-abbrev-table 'fundamental-mode-abbrev-table '())

(define-abbrev-table 'global-abbrev-table '())

(define-abbrev-table 'lisp-mode-abbrev-table '())

(define-abbrev-table 'sh-mode-abbrev-table '())

(define-abbrev-table 'shell-mode-abbrev-table '())


You can print the buffer contents from GNU Emacs using M-x print-buffer command. If you would like to print a selected region, you can use M-x print-region command. These will be printed with page numbers and headers. You can also print a buffer without page numbers using M-x lpr-buffer. Similarly, to print a region without page numbers, use M-x lpr-region. If you are already using the Dired mode, you can select the files that you want to print using the P shortcut, and then execute in Dired mode to print them.

September 25, 2016 05:00 PM

September 08, 2016

Trishna Guha

Run commands on Fedora Atomic host from Remote host using Ansible

This post will show how to run commands on your atomic host from remote.

I am using Fedora Atomic host. Boot up your atomic instance. Make your you have Ansible installed on your control host.

The user of fedora instance is “fedora” by default and there is no password authentication. So first we will need to create password on the atomic for user “fedora”.

For that type the following command. It will ask for new password.

$ passwd

Now we will need to change PasswordAuthentication to YES . Open /etc/ssh/sshd_config on atomic host and change PasswordAuthentication to YES. Now The atomic host is all set🙂.

Go to your Remote host/Control host. I am using Fedora Workstation.

Now we need to generate ssh key on our control host.

Type the following command. This will create ssh key(private and public) on your host. The default location is of public key is ~/.ssh/

$ ssh-keygen

It is time to add the ssh key to the Atomic host.
Type the following command. This will add your ssh public key to .ssh/authorized_keys on atomic host.

$ ssh-copy-id username@IPofAtomicHost

Now we will create inventory and config file for Ansible.

$ mkdir test && cd test
$ touch inventory
$ touch ansible.cfg

Inside the inventory file add the following:


Inside the ansible.cfg file add the following:


Now let’s ping the atomic host🙂.

$ ansible atomic -i inventory -m ping

If the above returns Success we will try to run command on atomic host from our remote host🙂.
Type the following to run command on your atomic host.

$ ansible atomic -i inventory -m command -a "sudo atomic host upgrade"


NOTE: If you have you atomic instance running on Openstack make sure to add icmp to the security groups of the instance.



by Trishna Guha at September 08, 2016 10:57 AM

August 24, 2016

Sayan Chowdhury

Autocloud: What's new?

Autocloud was released during the Fedora 23 cycle as a part of the Two Week Atomic Process.

Previously, it used to listen to fedmsg for successful Koji builds. Whenever, there is a new message the AutocloudConsumer queues these message for processing. The Autocloud job service then listens to the queue, downloads the images and runs the tests using Tunir. A more detailed post about it’s release can be read here.

During the Fedora 24 cycle things changed. There was a change on how the Fedora composes are built. Thanks to adamw for writing a detailed blogpost on what, why and how things changed.

With this change now autocloud listens to the compose builds over the fedmsg. The topic being “”. It checks for the messages with the status FINISHED and FINISHED_INCOMPLETE.

After the filtration, it gets the Cloud Images built during that particular compose using a tool called fedfind. The job here is parse the metadata of the compose and getting the Cloud Images. These images are then queued into both libvirt and vbox boxes. The Autocloud job service then downloads the images and run the tests using Tunir.

Changes in the Autocloud fedmsg messages.

Earlier the messages with the following topics were sent

Now along with the fedmsg message for the status of the image test. Autocloud also sends messages for the status of a particular compose.

The compose_id field was added to the autocloud.image.* messages

Changes in the UI

  • A page was added to list all the composes. It gives an overview of the composes like if it’s still running, number of tests passed, etc
  • The jobs page lists all the tests data as earlier. We added filtering to the page so filter the jobs based on various params
  • You need to agree that the jobs output page looks better than before. Now, rather the showing a big dump of text the output now is properly formatted. You can now reference each line separately.

Right now, we are planning to work on testing the images uploaded via fedimg in Autocloud. If the project looks interesting and you are planning to contribute? Ping us on #fedora-apps on Freenode.

August 24, 2016 11:58 AM

August 20, 2016

Sayan Chowdhury

Fedora Meetup Pune August 2016

Fedora Pune Meetup for the month of August 2016 happened today at our usual location. We had in total 12 people turning out for the meetup.

The event started with introductions and we had two new comers joining us this time, Trishna and Prathamesh.

This time the event was mostly foccused around re-writing the GNU C Library Manual using reStructuredText and Sphinx. This task was decided during the release event that we had last month. We did create a Etherpad link to maintain the status of the task1.

The aim is to build a modern version, good looking version of the GNU C Library Manual.

In today’s meetup, we sat down and tried completing the chapters we picked. A couple of us sent a PRs to the docs repo that we are maintaing in Github. The generated read the docs can be seen here

If you are planning to contribute, ping /me (sayan) or kushal in #dgplug channel on Freenode.

August 20, 2016 04:22 PM

July 30, 2016

Suraj Deshmukh

Kubernetes: HorizontalPodAutoScaler and Job

To try out following demos setup your environment as mentioned in here.

Git clone the demos repo:

git clone
cd k8s_demos/

Horizontal Pod Autoscaler

Once you have all the setup done follow the video for demo instructions


Once you have all the setup done follow the video for demo instructions

by surajssd009005 at July 30, 2016 11:53 AM

July 07, 2016

Praveen Kumar

Vagrant DNS with Landrush and Virtualbox and dnsmasq

Landrush is pretty neat vagrant plugin if you need a DNS server which is visible to host and guest. For Mac OS it work out of the box but to make it work in Linux we have to make some configuration changes to dnsmasq.

I assume that you are using latest vagrant and Virtualbox for this experiment. If you are using libvirt than please refer to Josef blogpost.

Landrush DNS server runs on port 10053 (localhost) instead of 53 so we have to make entry to redirect requested domain name to our Landrush. Follow below steps and lets configure it.

Install dnsmasq if not present
$ sudo dnf install dnsmasq

Add following to /etc/dnsmasq.conf

Will create below file which redirect our .vm traffic to Landrush
$ cat /etc/dnsmasq.d/vagrant-landrush

Will start/restart dnsmasq service and check status (should be active)
$ sudo systemctl start dnsmasq.service
$ sudo systemctl status dnsmasq.service
● dnsmasq.service - DNS caching server.
Loaded: loaded (/usr/lib/systemd/system/dnsmasq.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2015-12-24 11:57:47 IST; 2s ago
Main PID: 19969 (dnsmasq)
CGroup: /system.slice/dnsmasq.service
└─19969 /usr/sbin/dnsmasq -k
Dec 24 11:57:47 systemd[1]: Started DNS caching server..
Dec 24 11:57:47 systemd[1]: Starting DNS caching server....
Dec 24 11:57:47 dnsmasq[19969]: started, version 2.75 cachesize 150
Dec 24 11:57:47 dnsmasq[19969]: compile time options: IPv6 GNU-getopt DBus no-i18n IDN DHCP DHCPv6 no-Lua TFTP no-conntrack ipset auth DNSSEC ...ct inotify
Dec 24 11:57:47 dnsmasq[19969]: using nameserver for domain vm
Dec 24 11:57:47 dnsmasq[19969]: reading /etc/resolv.conf
Dec 24 11:57:47 dnsmasq[19969]: using nameserver for domain vm
Dec 24 11:57:47 dnsmasq[19969]: using nameserver
Dec 24 11:57:47 dnsmasq[19969]: using nameserver
Dec 24 11:57:47 dnsmasq[19969]: read /etc/hosts - 2 addresses
Hint: Some lines were ellipsized, use -l to show in full.

Make sure you put '' as nameserver to /etc/resolve.conf at first place.
$ cat /etc/resolv.conf

Make following change to your vagrant file
$cat Vagrantfile
PUBLIC_HOST= "your_host.vm" "private_network", ip: "#{PUBLIC_ADDRESS}"
config.vm.hostname = "#{PUBLIC_HOST}"
config.landrush.enabled = true
config.landrush.host_ip_address = "#{PUBLIC_ADDRESS}"
config.landrush.tld = ".vm"
confg.landrush.guest_redirect_dns = false

$ vagrant landrush ls
your_host.vm your_host.vm

$ sudo netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0* LISTEN 2946/dropbox
tcp 0 0* LISTEN 14810/weechat-curse
tcp 0 0* LISTEN 2946/dropbox
tcp 0 0* LISTEN 433/GoogleTalkPlugi
tcp 0 0* LISTEN 433/GoogleTalkPlugi
tcp 0 0* LISTEN 2946/dropbox
tcp 0 0* LISTEN 14966/ruby-mri
tcp 0 0* LISTEN 15200/VBoxHeadless
tcp 0 0* LISTEN 16871/dnsmasq
tcp 0 0* LISTEN 16817/dnsmasq
tcp 0 0* LISTEN 16810/dnsmasq
tcp 0 0* LISTEN 2647/cupsd
tcp6 0 0 ::1:631 :::* LISTEN 2647/cupsd

$ ping your_host.vm
PING your_host.vm ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=64 time=0.332 ms
64 bytes from icmp_seq=2 ttl=64 time=0.238 ms

by Praveen Kumar ( at July 07, 2016 12:10 PM