Planet dgplug

March 27, 2017

Kushal Das

Building IoT enabled power-strip with MicroPython and NodeMCU

This was on my TODO list for a long time. But, never managed to time to start working on it, I was also kind of scared of doing the AC wiring without adult supervision :).

Items used

  • Power-strip
  • USB power plug (any standard mobile phone charger)
  • wires
  • NodeMCU Amica
  • Relay board
  • MicroPython
  • Mosquitto server on my home network

I ordered double relay boards (this one was marked for Arduino) from Amazon, and they were laying in the boxes in the Pune Hackerspace for a long time.

Yesterday, we had a Raspberry Pi workshop in the hackerspace as part of the Python Pune monthly meetup. Nikhil was present in the meetup, and I asked for help from him as he is a real hardware expert.

We took one of the existing power-strip from the hackerspace, and also a mobile phone charger. After taking out 2 of the power sockets we had enough space to plug-in the rest of the system inside of it. Of course, Nikhil did all the hard work of soldering the wires in the proper manner.

The relay board is connected to a NodeMCU Amica running MicroPython. It has a code like the following example:

import time
from machine import Pin
from umqtt.simple import MQTTClient

# Received messages from subscriptions will be delivered to this callback
def sub_cb(topic, msg):
    led1 = Pin(14,Pin.OUT)
    if msg == b"on_msg":
        led1.low()
    elif msg == b"off_msg":
        led1.high()

def main(server="SERVER_IP"):
    c = MQTTClient("umqtt_client", server)
    c.set_callback(sub_cb)
    c.connect()
    c.subscribe(b"your_topic")
    while True:
        c.wait_msg()
    c.disconnect()

if __name__ == "__main__":
    try:
        time.sleep(10)
        main()
    except:
        pass

I will have to cover up the holes with something, and also push the code to a proper repository. Meanwhile this was the first usable thing I made with help from friends in the Hackerspace Pune. Come and join us to have more fun and build new things.

Btw, remember to have a password protected mosquitto server :)

by Kushal Das at March 27, 2017 03:20 PM

Trishna Guha

Customize Packages for Atomic Host : Ansible Automation

My earlier post automate-building-your-own-atomic-host describes how to Automate building Atomic Host with Ansible. But it is not capable of customizing packages for OSTree and build Atomic host based on it.

This post includes Ansible Automation for customizing packages of OSTree and build Atomic Host. Below are the improvements on this updated post :

  • Add packages to OSTree (It is suggested not to delete any pre-existing packages from the OSTree, that might break your Atomic host).
  • No need to create VM from the QCOW2 image will shell script anymore, It will be now all-in-one playbook.

If you do not know about Atomic host, please refer to http://www.projectatomic.io.

Requirements:

The requirements remain the same just like the earlier post. I will use Fedora distribution for the demo, but the same will be applicable for CentOS as well.

  • Make sure Ansible is installed on your system. If you are using Fedora workstation/any other platform, do not forget to install python2-dnf as well.
  • Download Atomic QCOW2 image: Fedora-Atomic.

Procedure:

Clone:

$ git clone https://github.com/trishnaguha/build-atomic-host.git
$ cd build-atomic-host/

Environment Setup:

The following will install requirements on your system, initializes OSTree and starts HTTP server as daemon service. The OSTree is made available via web server at TCP port 35000. After running the playbook you may use ip addr to check the IP Address of your HTTP server.

$ ansible-playbook setup.yml --ask-sudo-pass

Variables:

I am going to use variables applicable for Fedora. If you are using CentOS please modify the variables based on it.

  • Primary Variables.
    vars/atomic.yml
---
# Variables for Atomic host
atomicname: my-atomic                          # OSTree name
basehost: fedora-atomic/25/x86_64/docker-host  # Basehost
httpserver: 192.168.122.1                      # IP Address of HTTP Server
  • Additional packages you would like to have in your OSTree.
    vars/buildrepo.yml
# Variables for OSTree packages
repo: https://pagure.io/fedora-atomic.git
branch: f25
repodir: fedora-atomic
abs_path: /workspace                                # The absolute path to the git repo.
custommanifest: customized-atomic-docker-host.json  # The manifest that goes into the custom host(ostree) content that we are going to build.
sourcemanifest: fedora-atomic-docker-host.json      # The manifest that goes into the actual Base Fedora host(ostree) content.
packages: '"vim-enhanced", "git"'                   # Packages you want to have in your Atomic host.

Add packages like above separate by comma.

  • Variables for the VM
    vars/guests.yml
# Variables for Creating VM
domain: atomic-node                        # Domain name
image: Fedora-Atomic-25-20170228.0.x86_64  # Image name
cpu: 1
mem: 1536
os:
  variant: fedora23
path: /tmp                                 # Path to QCOW2 Image

Main Playbook:

Run the main Playbook which will create VM from QCOW2 image, compose OSTree and perform SSH-Setup and Rebase on OSTree:

$ ansible-playbook main.yml --ask-sudo-pass

Note: user-name: atomic-user, password: atomic are the credentials for the instance.
If you wish to change it, modify the cloud-init user-data.
We will have the credentials as variables/vault later.

To Check the IP Address of the VM running:

$ sudo virsh domifaddr atomic-node

Now SSH to the Atomic host and perform Reboot so that it will reboot in to custom OSTree.

$ ssh atomic-user@IP-ADDRESS-OF-VM
$ sudo systemctl reboot

SSH again and You will have your own OSTRee.

[atomic-user@atomic-node ~]$ sudo rpm-ostree status
State: idle
Deployments:
● my-atomic:fedora-atomic/25/x86_64/docker-host
       Version: 25.1 (2017-02-07 05:34:46)
        Commit: 15b70198b8ec7fd54271f9672578544ff03d1f61df8d7f0fa262ff7519438eb6
        OSName: fedora-atomic

  fedora-atomic:fedora-atomic/25/x86_64/docker-host
       Version: 25.51 (2017-01-30 20:09:59)
        Commit: f294635a1dc62d9ae52151a5fa897085cac8eaa601c52e9a4bc376e9ecee11dd
        OSName: fedora-atomic
[atomic-user@atomic-node ~]$ rpm -q git vim-enhanced
git-2.9.3-2.fc25.x86_64
vim-enhanced-8.0.386-1.fc25.x86_64

If you find any bug/idea please open up issues here. Thanks.

Atomic-Host


by Trishna Guha at March 27, 2017 10:50 AM

March 24, 2017

Farhaan Bukhsh

The A/V guy’s take on PyCon Pune

“This is crazy!”, that was my reaction at some point in PyCon Pune. This is one of my first conference where I participated in a lot of things starting from the website to audio/video and of course being the speaker. I saw a lot of aspects of how a conference works and where what can go wrong. I met some amazing people, people who impacted my life , people who I will never forget. I received so much of love and affection that I can never express in words.  So before writing anything else I want to thank each and everyone of you , “Thank you!”.

My experience or association started the time when the PyCon Pune was being conceived Sayan asked me if I could volunteer for Droidcon so that I can learn how to handle A/V for PP,  and our friends at HasGeek were generous enough to let me do that. The experience at Droidcon was crazy, I met a lot of people and made crazy lot of friends. Basically me and Haseeb were volunteering to learn the A/V stuff and Karthik was patient enough to walk us through the whole complex set up, to be very honest I didn’t get the whole picture till now but I some how able to manage. I learned a thing or two about  manning the camera and how much work actually goes to record a conference.

Since I was anyhow going to the conference I thought why not to apply for a talk but somehow I knew I wasn’t going to make it reason being the talks got rejected in a lot of other conferences 😛 . But anyhow being my stubborn self I don’t give up on rejection I gathered all the courage and got Vivek involved and we decided to apply for the talk and to my surprise it got in. This was our first conference talk and it was on one of the projects that we really really love, Pagure.

Since these things happened over a large span of time, by the time conference dates came I have nearly got out of touch with the A/V setup I only have vague idea about what is happening. So Sayan who is a one man army stepped in and he assured me that he will help me with getting the setup ready and we turned again to our friends at HasGeek and they were really humble to help us out this time and also help us with the instruments. We literally had a suitcase full of wires in case things go wrong. We spend around 3 days to up skill ourselves to handle the setup but this time the setup was very simple.

After all this happened and Sayan and Chandan took all the instruments to Pune. I arrived at Pune somewhere around two days before the conference the bus that I took from Bangalore to Pune dropped me somewhere near Telegaun which is near to Mumbai than Pune and I somehow managed to get back to Pune and reached Sayan and Chandan’s house. We were bunking together and there were more people about to come. I took some rest and then we were out , first stop was Reserved Bit , oh I can’t forget this place.

It is a perfect place for geeks and I loved every aspect of it. There I met Siddhesh for the first time we have had conversations over IRC though and met Nisha too. Amazing people the whole experience to travel to Reserved Bit and way back was amazing. We went to the venue to checkout where the camera will be and verify various aspects of the venue. After we came back I started working on the setup and man it was very tough and tricky to gather live feed from the camera.

First of all I was little hesitant to use any proprietary software but then I had no option so we somehow found a windows laptop and tried configuring it but almost everytime either we got a “BLUE SCREEN” or “UPDATES” which annoyed me , the sole reason of using windows was because we had a piece of hardware called capture cards, and the driver for which were not available. After long struggle and a lot of digging done by Siddhesh we got driver for Epiphan capture card for Linux and this was around 12 in the night and we all were still there at Reserved Bit. This gave all of us new hope and then it started we kind of got our minimalistic set up and Siddhesh did a “Compiler talk by Angle Fish” , it was a lot of fun by the time we got it working it was somewhere around 4 in the morning. After all this Sayan and Me actually took a walk back home and picked up Subho on the way. The next day CuriousLearner arrived and then Haseeb , Amit and Gaurav.

We were around 10 people squeezed in a single room but without any discomfort we kind of enjoyed our stay with occasional leg pulling to deep intense tech discussion the whole experience was just terrific. Then comes the actual venue setup that was one crazy thing so the video setup was working with Linux , we had Epiphan capture card working on Kernel version below 4.9 and OBS studio as a recording software. I actually spent a good number of hours to install OBS and downgrading kernel to 4.6 so that Epiphan driver works on at least 6 laptops. When we tried the setup on site and it broke because we didn’t take into account the audio from the mic. All of us were stuck in a state of panic then we realized that we have a mixer with us, but its power cord was left at Reserved Bit . By this time this setup kind of became our conference hack and we wanted it to work so badly. We actually ran back to Reserved Bit spent sometime there since we had some work and then quickly came back to the venue, connected the mixer and after few trial and run it worked.

“YES IT WORKED ” our efforts paid off, we recorded the whole conference using this setup, some of the recordings were a little glitchy and one other hack that we added was we weren’t recording the slides from speaker’s laptop we were doing it manually on our laptops. That means one copy of slide was being played on our laptops and we were recording it accordingly.

Apart from this experience I actually got the opportunity to meet all the keynote speaker the first so I met Nick, Honza, Terri,  John, Steven and Praveen. This was another experience in itself to know them and talk to the Rockstars of the FOSS WORLD.

As a speaker Kushal introduced me as the Speaker who is also the Cameraman for the event and that was may be the first time in a tech conference. Vivek and I have been collaborating over the talk for a long time and we figured out the order in which we need to speak and we spoke accordingly we kind of covered all the things that we wanted to and got a great response from the audience. I attended most of the talks since I was The A/V GUY but I had a huge help from rtnpro he was always there humble and ready to help.

The conference came to an end where Nisha told all the people about the effort that was put in from every person and specially Sayan. After this we had two days of devsprint where we had amazing projects, Vivek and I were mentoring for Pagure and we got a lot of new contributors and quite a number of PRs ( 13 to be precise ), the devsprint was a run away success.

I also got chance to interact with mbuf and man I saw him smile and crack jokes for the first time and it was crazy fun ,  I think it was the dinner after the last day of the conference. One of the most amazing experience was to talk to Haris and yes his name is Haris not Harish. The whole experience was so lovely that I don’t think that it can be better than this.

PS: We fixed my Macbook too

PPS: Video of our talk at PyCon Pune


by fardroid23 at March 24, 2017 04:35 PM

March 23, 2017

Kushal Das

Running MicroPython on 96Boards Carbon

I received my Carbon from Seedstudio a few months back. But, I never found time to sit down and work on it. During FOSSASIA, in my MicroPython workshop, Siddhesh was working to put MicroPython using Zephyr on his Carbon. That gave me the motivation to have a look at the same after coming back home.

What is Carbon?

Carbon is a 96Boards IoT edition compatible board, with a Cortex-M4 chip, and 512KB flash. It currently runs Zephyr, which is a Linux Foundation hosted project to build a scalable real-time operating system (RTOS).

Setup MicroPython on Carbon

To install the dependencies in Fedora:

$ sudo dnf group install "Development Tools"
$ sudo dnf install git make gcc glibc-static \
      libstdc++-static python3-ply ncurses-devel \
      python-yaml python2 dfu-util

The next step is to setup the Zephyr SDK. You can download the latest binary from here. Then you can install it under your home directory (you don’t have to install it system-wide). I installed it under ~/opt/zephyr-sdk-0.9 location.

Next, I had to check out the zephyr source, I cloned from https://git.linaro.org/lite/zephyr.git repo. I also cloned MicroPython from the official GitHub repo. I will just copy paste the next steps below.

$ source zephyr-env.sh
$ cd ~/code/git/
$ git clone https://github.com/micropython/micropython.git
$ cd micropython/zephyr

Then I created a project file for the carbon board specially, this file is named as prj_96b_carbon.conf, and I am pasting the content below. I have submitted the same as a patch to the upstream Micropython project. It disables networking (otherwise you will get stuck while trying to get the REPL).

# No networking for carbon
CONFIG_NETWORKING=n
CONFIG_NET_IPV4=n
CONFIG_NET_IPV6=

Next, we have to build MicroPython as a Zephyr application.

$ make BOARD=96b_carbon
$ ls outdir/96b_carbon/
arch     ext          isr_tables.c  lib          Makefile         scripts  tests       zephyr.hex  zephyr.map           zephyr.strip
boards   include      isr_tables.o  libzephyr.a  Makefile.export  src      zephyr.bin  zephyr.lnk  zephyr_prebuilt.elf
drivers  isrList.bin  kernel        linker.cmd   misc             subsys   zephyr.elf  zephyr.lst  zephyr.stat

After the build is finished, you will be able to see a zephyr.bin file in the output directory.

Uploading the fresh build to the carbon

Before anything else, I connected my Carbon board to the laptop using an USB cable to the OTG port (remember to check the port name). Then, I had to press the *BOOT0 button and while pressing that one, I also pressed the Reset button. Then, left the reset button first, and then the boot0 button. If you run the dfu-util command after this, you should be able to see some output like below.

$ sudo dfu-util -l
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Found DFU: [0483:df11] ver=2200, devnum=14, cfg=1, intf=0, path="2-2", alt=3, name="@Device Feature/0xFFFF0000/01*004 e", serial="385B38683234"
Found DFU: [0483:df11] ver=2200, devnum=14, cfg=1, intf=0, path="2-2", alt=2, name="@OTP Memory /0x1FFF7800/01*512 e,01*016 e", serial="385B38683234"
Found DFU: [0483:df11] ver=2200, devnum=14, cfg=1, intf=0, path="2-2", alt=1, name="@Option Bytes /0x1FFFC000/01*016 e", serial="385B38683234"
Found DFU: [0483:df11] ver=2200, devnum=14, cfg=1, intf=0, path="2-2", alt=0, name="@Internal Flash /0x08000000/04*016Kg,01*064Kg,03*128Kg", serial="385B38683234"

This means the board is in DFU mode. Next we flash the new application to the board.

$ sudo dfu-util -d [0483:df11] -a 0 -D outdir/96b_carbon/zephyr.bin -s 0x08000000
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash "
Downloading to address = 0x08000000, size = 125712
Download [=========================] 100% 125712 bytes
Download done.
File downloaded successfully

Hello World on Carbon

The hello world of the hardware land is the LED blinking code. I used the on-board LED(s) for the same, the sample code is given below. I have now connected the board to the UART (instead of OTG).

$ screen /dev/ttyUSB0 115200
>>>
>>> import time
>>> from machine import Pin
>>> led1 = Pin(("GPIOD",2), Pin.OUT)
>>> led2 = Pin(("GPIOB",5), Pin.OUT)
>>> while True:
... led2.low()
... led1.high()
... time.sleep(0.5)
... led2.high()
... led1.low()
... time.sleep(0.5)

by Kushal Das at March 23, 2017 06:42 AM

March 17, 2017

Suraj Deshmukh

New place to this blog

The new version of this blog is at http://suraj.io/ . All my new posts will be put in there now. Bye bye wordpress.


by surajssd009005 at March 17, 2017 10:03 AM

Trishna Guha

Contribute to Atomic Host Documentation

The post describes how you can contribute to Atomic Host Documentation. If you do not know what Atomic Host is, please refer to: http://www.projectatomic.io.

Atomic Host Documentation focuses on covering Docs required for Atomic Host Introduction, Installation, Cluster set up with Kuberenetes/Openshift etc to how to compose, manage and deploy Atomic Host and its various application.

Atomic Host Documentation will also support Fedora Atomic Documentation and CentOS Atomic Documentation within the same repository in near future as AsciiBinder has ability to build Docs with multiple distros and versions.

Requirements:

  • AsciiDoc markup language to write Docs.
  • Asciidoctor that acts as text processor to convert AsciiDoc content to HTML5, DocBook and others.
  • AsciiBinder that helps to build, maintain documentation in easier way.

Set up Development Environment:

The following creates development environment and installs required libraries/packages on your local system which are required in order to write/build Doc for Atomic Host.

$ sudo dnf install ansible
$ git clone https://github.com/projectatomic/atomic-host-docs.git
$ cd atomic-host-docs/
$ git checkout -b branchname
$ ansible-playbook setup.yml --ask-sudo-pass

How to Write Doc:

Atomic Host Documentation uses AsciiDoc markup language. You can have a look at the Reference for AsciiDoc Syntax.

The following procedure demonstrates how you can write and build Doc.

$ mkdir container
$ touch container/overview.adoc

 

container/overview.adoc

[[container-overview]]
= Container Overview
{product-author}
{product-version}
:data-uri:
:icons:

Container contains applications in a way to keep itself isolated from the host system that it runs on and
container allows developer to package an application with all of it parts, such as libraries and other packages
it needs to run and ship it all as one package.
I love Containers!!!

 

After the Doc is ready, we need to make entry in topic_map.yml file. This file tells AsciiBinder which topic groups and topics to generate.

_topic_map.yml

---
Name: Tools
Dir: container
Topics:
  - Name: Overview
    File: overview

 

Now go to the root directory of the repo. The following command will build the Documentation.

$ asciibinder

Verify:

A new directory will be created named _preview. You will be able to browse Documentation from there that you just build.

This is how it will look like after the Doc is build:

contribution-guide-demo

Join and Help:

If you are looking forward to contribute to Atomic Host Docs, this URL contains the issues based on the topics that is required to be documented: https://github.com/projectatomic/atomic-host-docs/issues.

Mailing list:

IRC: #atomic on Freenode server.


by Trishna Guha at March 17, 2017 09:53 AM

March 14, 2017

Jaysinh Shukla

Pycon Pune 2017: A wonderful Python conference

pycon_pune_group_photo

tl;dr

The conference is worth attending if you are a student, programmer or a hobbyist. If you are a swag-hungry then don’t expect much as a swag from this conference. If you are a Devsprint lover, then this conference has the coolest Devsprint. A great number of keynote speakers are invited for this conference.

Detailed Experience

Because I was volunteering for this conference I reached Pune one day earlier than the conference days. The volunteer meeting was happening at Reserved-bit.

Volunteer

Reserved-bit

Reserved-bit is the best hackerspace I have ever come across. It has a large collection of programmable boards. You will find boards like Raspberry Pi, Bana Pi, Dragonboard, Bigalbon, BBC-microbit and the 3D printer. Furthermore, this space has a great collection of books on Compilers and Embedded programming. I managed to found few on open-source too. The owners are great hackers. You will love to interact with hacker Siddhesh Poyarekar. Hacker Nisha Poyarekar is volunteering the PyLadies community at Pune.

Pune to Mumbai

I spent my half day in this space. I got the responsibility of receiving one of the keynote speakers who was landing at Mumbai airport midnight. To be frank, estimation of Google Maps between Pune to Mumbai is wrong. It showed nearly 2 hours but it took almost 4.5 hours to reach Mumbai. It took few more minutes to reach the airport. The road is impressively smooth. You will encounter the beautiful mountains of Lonavla. The task of moving from Pune to Mumbai airport, receive Katie and come back to Pune was completed in almost 13 hours. I left from Pune around 4.30 PM and came back at nearly 5 AM next day early morning.

Illness during conference

Because I did a huge amount of traveling at that night, I was unable to get enough sleep. Such tiredness resulted in an eye infection. I managed to attend the first day of the conference, but I was not in a condition to attend the second day. Treatment from local doctor healed me in two days and then I was able to take part into Devsprint.

Conference

The conference was a total of 4 days where the initial two days were for the talks and the end was assigned for a Devsprint. It didn’t overwhelmed me with many tracks but gave the quality talks presented in a single track. The talks were set from 9 AM to 5 PM which was taken little lightly by the attendees.

I was pretty impressed with the keynote speakers of this conference.

Katie Cunningham

Katie is the O’Reilly author. Her book on Accessibility depicts her area of expertise. She is fun to talk to. She likes to listen about developer communities, writing and most importantly computer games. Her broad vision on product development is amazing. She is an avid reader. I enjoyed listening to her experience of being in India for the very first time.

Honza Kral

Honza is the dude who loves contributing to Django. He is a core contributor of Django too. He hacks on Python drivers at Elastic. I was impressed with his suggestions on a code design problem I was trying to solve from the past few months. His suggestions on code design are worth noticing. He is a vimmer and maintains little vim plugins as a part of his interest.

Stephen J. Turnbull

Stephen professes the Dismal Science of Economics. His knowledge is deep-rooted just like his beard. You will enjoy discussing computer science, books and his experience of programming. He is authoring few books written in the Japanese language. Stephen is Emacsite.

stephen_turnbull

Terri Oda

Terri is a security nerd. She spent most of her time exploring tools at Intel. Terri knows how to hide from the spying of the U.S. Government. She is leading Google Summer of Code section from Python Software Foundation. Terri is PSF community service award winner. If you are a student and want to take part in GSoC choosing PSF as your organization then she is the right person to talk to.

Florian Fuchs

His knowledge on ReST API construction is the best. He is a Falcon nerd too. I enjoyed discussing various authentication mechanisms for ReST API with him. He is a Red Hatter.

gnu_mailman_team

Nick Coghlan

Nick listens more than he speaks. I will advise you to not disturb him if he is coding. He enjoys concentrating while coding. Getting his mentorship was a great experience. He has been contributing to Core Python for a decade now. You will enjoy discussing on interesting code compositions with him. He is a Red Hatter.

Praveen Patil

Unfortunately, I didn’t get much time to talk with Praveen during this conference. He is a math teacher who teaches concepts of mathematics using Python programming language. You should feel confident to speak with him on Python in education and mathematics with him.

John Hawley

John is the wittiest person that I know. His lines always end with humor. He hacks mostly on hardware and GNU/Linux. Micro Python and GNU/Linux should be considered as part of his interests.

I am sad to declare that I was unable to attend any keynote speeches because of the illness. Mostly I rested at the hotel or talked with people during the conference days.

pycon_pune_2017_keynote_speakers

Volunteer Party

If you are volunteering for this conference, then you will be invited to a volunteer dinner party. We enjoyed party colored disco lights dancing on the bits of the DJ. Punjabi food was served, and if you were above 25 than you were allowed to take a sip of a beer.

Devsprint

Devsprint happen at the Red Hat Headquarters, Pune. I found the building has tight security. You will find an individual pantry section dedicated to each department. We were instructed to hack at a huge cafeteria section. I myself contributed to Core Python. Nick Coghlan was mentoring for Core Python. I reviewed one PR, found one broken test case and wrote a fix of an existing issue with his help. Honza was leading the development of Django web framework. A team of Anand Chitipothu mentored for Web2py. Farhaan Bukhsh mentored for Pagure. John Hawley encouraged contributing to MicroPython. Terr Oda, Stephen Turnbull and Florian Fuchs mentored for GNU/Mailman.

cpython_devsprint

Why attend this conference?

  • This conference has the coolest Devsprint. The organizers understand the value of the Devsprint in a conference. I have never observed such an importance of Devsprint at any other Python conference happening in India.

  • If you are a student, then this is a beginner friendly conference. Don’t be afraid to attend if you are a Python noob. You will receive a student concession for the tickets too.

  • If you are a developer, coming to this conference will inspire you to grow from your present level. You will meet core contributors, lead programmers, owners of startups and project managers. You will find a huge scope of opportunities to network with people.

  • The conference is single track event. This decision helped me to not miss the interesting talks. In my previous experience, parallel tracks forced me to choose between talks when I was interested in both, which killed me.

  • I have never seen such a huge amount of keynote speakers at any conference happening in India. Keynote speakers were the main attraction of this conference.

What was missing?

  • If you are a swag-hungry fellow than attending this conference won’t be worth it. The conference attendees have to be satisfied with the conference T-shirt.

  • I observed there were fewer corporate stalls than at other Python conferences. A stole from Reserved-bit, Red Hat and PSF community stall was there.

  • A workshop section was completely missing. In my opinion, the workshop helps the beginners to start. There were a few topics which can be better represented as workshop rather than a talk.

  • I was unable to observe any dedicated section for an open space discussion. This section is helpful for communities and contributors to discuss interesting problems and think together.

Proofreader: Benaiah Mischenko, Chameleon

March 14, 2017 12:48 PM

March 10, 2017

Shakthi Kannan

PyCon Pune 2017

I attended PyCon Pune 2017 conference between February 16-17 (Thursday-Friday), 2017 at Amanora - The Ferns Hotels and Club, Pune.

Ferns Hotel

Day I

I reached the venue early in the morning, to be of any help to the volunteers. The projector had to be checked, and I used my laptop to test the same. After changing couple of cables and adapters, the clarity on the screen was good.

This event had a single track where everyone sat in one big hall. I welcome this change!

Honza Král started the conference with his keynote, titled “(My) OSS Life”. He shared his experiences and learning in the Free and Open Source Software (F/OSS) world. At present, he maintains the Python drivers for Elasticsearch.

Honza Král

The keynote was followed by Anand Chitipotu’s talk on “Writing Beautiful Code”. He illustrated code examples on how to write simple, elegant, readable Python code. The use of meaningful variable names, comments were emphasized a lot. It was a short list of collated points on basic mistakes that newbie programmers make, and how to effectively write beautiful code.

Florian Fuchs then spoke on “Hacking Mailing Lists - The Mailman 3 API Ecosystem”. He explained the new architecture and API with code examples. He has been hacking on the new Mailman 3 web UI and the Python API bindings.

After attending these talks, I made a visit to the three booths at the conference - Red Hat, Python Software Foundation and reserved-bit. I also signed copies of my book that people had brought.

After lunch, I attended the “i18n-ise Django Apps” talk by Sundeep Anand, where he showed the internationalization processes for a Django application. All the relevant file modifications and commands involved were demonstrated.

John ‘warthog9’ Hawley is a Perl guy and gave an interesting keynote on building your own hardware, and why you should do that. He explained the various challenges he had faced, the process involved in the same. He had exclusively designed and produced a “Bug Bunny” embedded micro-Python kit for the conference and development sprints.

The “Building Trust in Releases” talk by Nigel Babu was very informative. He explained four important aspects in release management - cadence, documentation, testing, and empathy. This was also an experience report on DevOps practices, and was quite detailed and useful.

The last keynote of the day was by a Physics teacher, Praveen Patil. He shared his exploration on using Python to teach Physics to high school students. He is actively involved in ExpEYES Project, teacher training programs and also contributes content to National Repository of Open Educational Resources (NROER).

Praveen Patil system setup

Day II

The morning keynote was by Katie Cunningham. She was initially testing the microphone and laptop by singing nursery rhymes. While the organizers decided to wait for people to arrive and settle down, there was time for lightning talks. So, I volunteered to start the day with the resounding “Nursery Rhymes”. After a couple of other lightning talks, Katie started her keynote on accessibility guidelines. It was quite an informative session.

“You can help develop Python - and you should!” talk by Stephen Turnbull was on the history of Python, PEP guidelines and the functioning of the community. I also had a chance to talk with him personally on the story of XEmacs.

Farhaan Bukhsh and Vivek Anand presented their Google Summer of Code (GSoC) work on the project Pagure, which is an alternative to GitHub and GitLab. They shared the past, present and future roadmap for the project. In the “Testing native binaries using CFFI” talk, Noufal Ibrahim demonstrated how to write Python bindings using CFFI.

After lunch, there was time for lightning talks. Different Python user group communities (PyDelhi, HydPy, PythonPune, PyLadies Pune) pitched about their work . I had prepared the sequel to “The Yet Another Lightning Talk” and requested the audience to sing on my behalf. The feedback was positive, as usual. The latest addition to the nursery rhyme is as follows:

Twinkle, Twinkle, unit tests,
How I wonder, where you exist!
I will write unit tests,
Until the project is laid to rest.

The afternoon keynote was by Nick Coghlan. He also shared his know-how on Free and Open Source Software and community best practices. “Django on Steroids - Lessons from Scale” by Sanket Saurav was a good technical, intermediate-level talk on Django customization, nginx settings, scaling and deployment.

The last keynote of the day and the conference was by Terri Oda on “Is OSS more secure?”. She presented the various dimensions on which one needs to answer the question. She concluded by saying that there is definitely more scope in F/OSS to be more secure given the number of people involved, and the transparency in the process.

Conclusion

The number of participants at the conference was more than five hundred, and they all came on a week day to attend! For a first-time event, that is quite impressive. This clearly shows that there is a demand for such events across India.

PyCon Pune 2017 group photo
PC: Kushal Das

Initially, there was a lot of resistance (follow the thread) to this event, including the name of the event. Communities are meant for innovation, and stifling is futile. You can learn a lot in a community, and there are guidelines and best practices that are followed.

It was a four day event with development sprints, and hence it had to be a PyCon. Legally, the Python Software Foundation allows using the name “PyCon” for regional events too. Given the context and the necessity, I am happy that the Python Software Foundation (PSF) got the message right, and understood the need for the conference and supported it in a big way!

The development sprints had a limited seating capacity, and the registration got over early. I was informed that there were hundred more requests for the development sprints, which again emphasizes the need for such events! I also had a chance to meet some of the #dgplug (irc.freenode.net) folks with whom I have been interacting online on IRC.

It does take a lot of effort to organize a conference, and I congratulate the PyCon Pune team on their first event.

March 10, 2017 07:30 AM

March 06, 2017

Anwesha Das

My bunnyuncle

PyCon Pune devs sprint hardware room

time 10 AM

The room was full with engineering students, professional engineers, hardware guys. And among them there was me, a lawyer and I do not understand a single bit of hardware.
I was cursing myself why am I here. In fact I have considered all the black cables, most of the hardware as UFO (Unknown Foul Object) creating mess in my house, courtesy: husband dear. And now I have to work on those.

I Want to ran away.
Wish I had a Tardis.
"Doctor..."

Unknown Foul Object == Known Cute Object

The first few good thing that made me comfortable were:

The object which we were suppose to work on was a bunny. Its cute. Its cool. I love it. Let me introduce you to bunny. It is a small bunny shaped board designed by Dr. Terri Oda and John Hawley. It has a ESP82866 on board. It is an open source project and the whole thing available in github

We had John as our mentor. A friend who gave me the freedom that I can interrupt him at any point which I do not understand. From scheduler to ARM, from scheduler to hardware licensing he explained to me all and most importantly the way a novice like me will understand. Thank you John, for making me fall into love with hardware.

The hesitant me started working. Initially what we were trying to code on micropython to lit LEDs up. We have actually made the circuit on breadboard. Initially one there, after multiple LEDs to it.

Working with bunny

After lunch I started working actually on bunny. John explained me different parts of it. Initially I tried to control the "magic button". Then I lit up the bunny's ears. Then playing with the LEDs. Lighting it in different random order and intensity.
Though the dev sprint is over but the fun is not I gave back home and took another step forward with the bunny. I named my project bunnyuncle.

The bunnyuncle

My idea was that the LEDs, specifically in the right ear of the bunny will lit up every time someone mentions me in the twitter. The schematic of py project looks like this:

With an object to give the project a shape I have divide the project into three parts:

I have written a server.py by and through which I am fetching data, i.e the notifications (which mentions me as @anweshasrkr) from twitter to my server. I am using the Python tweepy module for getting notifications from twitter. I am keeping the authentication data in conf.toml.

For every notification I am publishing a message to Mosquitto. Mosquitto is message broker which uses MQTT Protocol. MQTT is a lightweight protocol for small sensors and mobile devices. Mosquitto can be installed in Fedora by using the dnf command.

The bunny is subscribed to the same topic in the Mosquitto. Therefore every time a message published to the Mosquitto in the specified topic, the bunny is receiving the message, and lighting up the right ear. The project is available in the github. main.py contains the code that runs in ESP8266.

This is my second attempt to code in Micropython, first time it was with Microbit. Coding in hardware using micropython is fun. Try it yourself.

Wish I could go back to that time, in that hardware room.
Wish I had a Tardis.
"Doctor..."

by Anwesha Das at March 06, 2017 08:20 PM

February 28, 2017

Jaysinh Shukla

Book review ‘Introduction to the Command Line’

introduction_to_command_line

tl;dr

Every chapter will introduce a bunch of comands and will point to its respective documentation for further learning. You should expect chapters describing from the grep command to GNU Octave which is a scientific programming language. The chapters are independent of each other. The book is must read if you are new to the GNU/Linux command line. If you are at the intermediate level, then too investing time in reading this book will unveil a few surprises for you.

Detailed review

The book is community driven and published under FLOSS Manual. It is a collaborative effort of the FSF community. The fun part is you can contribute to this book by adding new chapters or by improving an existing one. I fixed one typo in this book after reading. The best introduction is crafted comparing GUI based image editing tools with the most unknown command convert. It conveys the importance of command line well to the reader. Initial chapters will present the overview of various GNU/bash commands. From my personal experience, you have to use mentioned commands in this chapter daily. The chapter of Command history shortcuts depicts geeky shell patterns. I will advise not to skip that chapter and read through once. The advanced section was not much advance for me. It demonstrates ssh and related commands like scp and more. I appreciated the preference of using GNU Screen though I use tmux over it. If you are possessed by moving around on multiple directories simultaneously, then directory stacks under Moving Again section is worth scanning. This functionality is saving dozens of my keystrokes now. There is one entire division dedicated to various editors. That section is not limited to GNU Emacs or vim, but also briefs GNU NANO, Kedit and Gedit. This section does not compare the pros and cons of several editors, but describes basics of each which should be counted as a good part. I skipped this part because I am comfortable with vim editor at present and don’t want to invest much in others.

The scripting section turned out to be the most interesting division for me. Though I was aware about the tools like sed and language awk I was not using them often. Reading their chapters and implementing mentioned examples built little confidence in me. Now I am much comfortable in utilizing them. The irregular Regular expressions are everywhere. You should not pass over this section and pay careful attention to various examples. It is worth to invest your time in this segment.

This is not the ending. This book presents a glimpse of various scripting level programming languages like Perl, Python and Ruby. Because I am a python developer for a few years and I was not much interested in other languages, I skipped this section. A shallow introduction to GNU Octave is nice to study if you are interested in knowing a little about this scientific programming language.

How to read this book?

Do not read to read. This book contains nice shell examples. By merely reading, you will end up without bringing about anything meaningful. I will advise you to interpret the description first, observe the examples and then implement them on your own. If you have any confusions, read the example and description again or obtain help from man or info are the best options. To remember, I revised the important chapters more than once in a week. It helped me to refresh what I learned before. I will attempt to re-read the important sections once again after a few days to refresh my memory.

What is missing?

Considerably, the book is nicely written, equally distributed and largely acceptable, but I would prefer to have a small set exercises section at the end of each topic. Exercise might help the reader to identify their weak points early and refer on them again if they desire to.

Typo / Mistakes

I didn’t encounter any sever mistakes except one typo. The section of Userful customizations on page number 80 of my printed version, contains following example:

function manyargs {
  $arg=$1
  shift
  ...
}

Here, $arg is a misprint. A shell variable is never assigned with $. It should be args=$1. I myself has corrected the typographical error in the book. This change will be published maybe in the next release of this book.

If you are encountering any mistakes while reading, I request you to fix the change here. The interface for editing the book is beginner friendly. It took less than 5 minutes to drive the change.

Where to buy/download?

Proofreader: Dhavan Vaidya

February 28, 2017 12:00 AM

February 11, 2017

Farhaan Bukhsh

Hacking on Pagure CI

“Ahaa!” I got a lot of ahaa moments when I was hacking on Pagure CI ,  Pagure CI’s initial draft was laid by lsedlar and I have blogged about it followed by me and Pingou. Pingou has done really amazing work with the flow and refactoring of code to making beautiful api calls.

I had great time hacking around it and got a bunch of learning. Few of the learning are :

  1. Try to do the minimal work in setting up the development environment mock everything that is available for testing.
  2. Think deeply about something when your mentor points it to you.

So the issue I was working on is a long pending one the issue was to attach build ID to all the Jenkins build Pagure was getting . Reason why attaching build id’s are necessary is to distinguish between different builds and to make the link to Jenkins a bit more specific for example if a build fail which was that build.

The first mistake I did was setting up Jenkins on my machine I had it previously but since my machine went under a kernel panic I lost all data related to Jenkins , now Fedora 25 has some packaging issue when installing  Jenkins directly. But anyhow from Jenkins site I got a way to set it up and it worked for me. In the mean while Pingou was pointing it out that I actually don’t need Jenkins instance but I was not able to get him on that and I really feel bad about it.

After setting up Jenkins the other task for me was to configure it , which was really easy because I have done it before and also because it was well documented. For setting up the documentation is fine but for hacking on the CI you need a little less work.

Step 1

Set up REDIS on your machine , you can do that with installing redis using sudo dnf install redis and enable the service using sudo systemctl enable redis and then start the service using sudo systemctl start redis. Along with this you need to add config for redis in default_config.py or which ever config file you are giving to the server using --config. The configuration are well documented in pagure.cfg.sample.

Step 2

Now, copy the pagure-ci-server from pagure-ci directory into the parent directory. Now once you have done that , this step is necessary because this is the service that run for pagure-ci. Now you just have to run pagure-ci-server by python pagure-ci-server.py. Once this started your service will be up and running.

Step 3

Now you just fire up your instance and make a project , have two branches and open a PR form once branch to other, if you get some authentication error that is most probably because you not done the right permission for users to use Jenkins, this is not recommended but you can entirely turn off the security of Jenkins just because you are testing something.

If you have done everything correct you will see the Jenkins flag being attached to the Pull Request.

VERY IMPORTANT NOTE:

All this could be saved if I have just used python-jenkins to fetch a job from Fedora Jenkins instance and send it as a flag to my PR. Thank you Pingou for telling me this hack.

Happy Hacking!


by fardroid23 at February 11, 2017 04:35 AM

February 08, 2017

Anwesha Das

A date with Microbit @ February meetup of PyLadies Pune

Pyladies Pune is 8 meetups old now, (after the rebooting). I missed last month's meetup, as Py was unwell. This month's meet up was special. It was the first time the PyLadies meetup took place in reserved-bit, the coolest place in Pune. Thank you reserved-bit for hosting us. The next thing was the fact that it was a session about microbit. A super huge thanks to ntoll for sending us the hardwares.
Microbits are one of our dearest possessions (me and Kushal. I am learning coding in this and I really wanted to share the experience, the fun with my fellow PyLadies.
I left home early leaving the instructor for the session alone with his daughter (and I was so happy about it). We are just two weeks away from PyCon Pune, and hence, decided our first agenda for the meetup would be to discuss our plan for PyCon. The girls came up with really nice ideas about the booth. We have also decided about what us PyLadeis wish to do during the devsprint.

Mummy v/s Daddy

The daddy-daughter duo arrived. Both of them were looking like they had just returned from the war front. Mommy to the rescue! Py was really excited to see her “bestest friend” Ira over there. With each passing meetup, our Pybabies are becoming increasingly comfortable about their mummies working. Barring a few exceptions, Py was at her best behaviour this time.

The Fun begins

Kushal started the session after his quick coffee break. He introduced the group to microbit, the tiny computer (a wave of "wow" blew over the room :). He asked us to download Mu editor from his local cache. We had decided each participant would get a chance to work with a microbit. And then came the twist in the tale. Kushal forgot to bring the microbits. (This happens when wife leaves home early.) After throwing him an angry glance, we requested Sayan to get it. Sayan readily agreed. Peace prevailed! Meanwhile, Kushal gave us a problem - to find out the groups of the current user in the Linux systems. Windows users were to share a group file.

The arrival of microbits

photo courtesy: Sayan Chowdhury

Finally the microbits arrived. Each participant got a microbit. We opened up the documentation for microbit. We got started with scrolling images with the typical "hello PyLadies" on the display board. Post lunch, we tried playing music, speech and other features. We plugged our earphones to the microbits with the alligator-chip cables. The last and the best part of the workshop was working with the radio module. We were sending various messages. It was such fun to see those on each other's device. Nisha and Siddhesh went out to actually check the range. It covers a large area.

photo courtesy: Kushal Das

Well after the session was formally over, people actually stayed back and continued working, trying things on their own (may be the little magic of being inside a hackerspace). We have decided to work on it during PyCon Pune devsprints. As Nisha said "It is the best PyLadies meetup we have ever had".

by Anwesha Das at February 08, 2017 08:39 AM

February 07, 2017

Shakthi Kannan

GNU Emacs - HTML mode, indentation and Magit

[Published in Open Source For You (OSFY) magazine, April 2016 edition.]

This article in the GNU Emacs series takes readers on how to use HTML mode, do indentation, and use the Magit interface.

HTML mode

You can use HTML mode to effectively edit HTML and CSS files using GNU Emacs. To start the mode, use M-x html-mode. You will see the string ‘HTML’ in the mode line.

Default template

A default HTML template can be started by opening a test.html file, and using C-c C-t html. It will produce the following content:

<html>
  <head>
<title>

You will then be prompted with the string ‘Title:’ to input the title of the HTML page. After you type ‘Hello World’, the default template is written to the buffer, as follows:

<html>
  <head>
<title>Hello World</title>
</head>
<body>
<h1>Hello World</h1>

<address>
<a href="mailto:user@hostname">shakthi</a>
</address>
</body>
</html>

Tags

You can enter HTML tags using C-c C-t. GNU Emacs will prompt you with the available list of tags. A screenshot of the available tags is shown in Figure 1:

HTML tags

The anchor tag can be inserted using ‘a’. You will then receive a message prompt: ‘Attribute:’. You can provide the value as ‘href’. It will then prompt you for a value, and you can enter a URL, say, ‘http://www.shakthimaan.com’. The anchor tag will be constructed in the buffer as you input values in the mini-buffer. You will be prompted for more attributes. If you want to finish, simply hit the Enter key, and the anchor tag will be completed. The final output is shown below:

<a href="http://www.shakthimaan.com"></a>

You can insert a h2 tag by specifying the same after C-c C-t. You can also add any attributes, as required. Otherwise, simply hitting the Enter key will complete the tag. The rendered text is as follows:

<h2></h2>

You can insert images using the alt tag. You can specify the src attribute and a value for the same. It is also a good practice to specify the alt attribute for the image tag. An example is shown below:

<img alt="image" src="http://shakthimaan.com/images/ShakthiK-workshop-A4-poster.png">

Unordered lists can be created using C-c C-t followed by ‘ul’. It will then prompt you for any attributes that you want included in the tag. You can hit the Enter key, which will prompt you with the string ‘List item:’ to key in list values. An example of the output is shown below:

<ul>
  <li>One
    <li>Two
      <li>Three
</ul>

You can neatly align the code by highlighting the above text and indenting the region using C-M-\. The resultant output is shown below:

<ul>
  <li>One
  <li>Two
  <li>Three
</ul>

If you wish to comment out text, you can select the region and type M-q. The text is enclosed using “<!--” and “-->”. For example, the commented address tags in the above example look like what follows:

<!-- <address> -->
<!-- <a href="mailto:shakthi@achilles">shakthi</a> -->
<!-- </address> -->

A number of major modes exist for different programming environments. You are encouraged to try them out and customize them to your needs.

Accents

In HTML mode, you can insert special characters, accents, symbols and punctuation marks. These characters are mapped to Emacs shortcuts. Some of them are listed in the following table:

Shortcut Character
C-x 8 ’ a á
C-x 8 " e ë
C-x 8 / E Æ
C-x 8 3/4 ¾
C-x 8 C ©
C-x 8 L £
C-x 8 P
C-x 8 u µ
C-x 8 R ®
C-x / / ÷

Indentation

Consider the following paragraph:

“When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.”

You can neatly fit the above text into 80 columns and 25 rows inside GNU Emacs using M-q. The result is shown below:

When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.

You can also neatly indent regions using the C-M-\ shortcut. For example, look at the following HTML snippet:

<table>
<tr>
<td>Tamil Nadu</td>
<td>Chennai</td> 
</tr>
<tr>
<td>Karnataka</td>
<td>Bengaluru</td> 
</tr>
<tr>
<td>Punjab</td>
<td>Chandigarh</td> 
</tr>
</table>

After indenting the region with C-M-\, the resultant output is shown below:

<table>
  <tr>
    <td>Tamil Nadu</td>
    <td>Chennai</td> 
  </tr>
  <tr>
    <td>Karnataka</td>
    <td>Bengaluru</td> 
  </tr>
  <tr>
    <td>Punjab</td>
    <td>Chandigarh</td> 
  </tr>
</table>

If you have a long line which you would like to split, you can use the C-M-o shortcut. Consider the quote:

“When you’re running a startup, your competitors decide how hard you work.” ~ Paul Graham

If you keep the cursor after the comma, and use C-M-o, the result is shown below:

"When you're running a startup, 
                                your competitors decide how hard you work." ~ Paul Graham

Magit

Magit is a fantastic interface to Git inside GNU Emacs. There are many ways in which you can install Magit. To install from the Melpa repository, add the following to your ~/.emacs:

(require 'package)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.org/packages/") t)

When you do M-x list-packages, you will see ‘magit’ in the list. You can press ‘i’ to mark Magit for installation, followed by ‘x’ to actually install it. This will install Magit in ~/.emacs.d/elpa. The version installed on my system is magit-20160303.502.

When you open any file inside GNU Emacs that is version controlled using Git, you can start the Magit interface using M-x magit-status. I have bound this key to C-x g shortcut in ~/.emacs using the following:

(global-set-key (kbd "C-x g") 'magit-status)

The default magit screenshot for the GNU Emacs project README file is shown in Figure 2.

Magit

Pressing ‘l’ followed by ‘l’ will produce the history log in the magit buffer. A screenshot is provided in Figure 3.

History

You can make changes to the project sources and stage them to the index using the ’s’ shortcut. You can unstage the changes using the ‘u’ shortcut. After making changes to a file, you need to use M-x magit-status to update the Magit buffer status.

A sample screenshot of the modified files and staged changes is shown in Figure 4.

Staged

You can hit TAB and Shift-TAB to cycle through the different sections in the Magit buffer. To commit a message, press ‘c’ followed by ‘c’. It will pop up a buffer where you can enter the commit message.

You can create and checkout branches using the ‘b’ shortcut. A screenshot of the magit branch pop-up menu is shown in Figure 5.

Branch

All the basic Git commands are supported in Magit - diffing, tagging, resetting, stashing, push-pull, merging and rebasing. You are encourged to read the Magit manual ( https://magit.vc/ ) to learn more.

February 07, 2017 07:30 PM

February 06, 2017

Sayan Chowdhury

PyLadies Pune Meetup - February 2016

The PyLadies Pune February Meetup was held on 6th Feb at reserved-bit. Kushal took a session on MicroPython on the MicroBit boards. Thanks to @ntoll for sending over the MicroBits for workshops.

I reached down to the venue a bit late. On reaching the venue, Kushal told me that he forgot the boards at home and I went to his place to pick the MicroBits.

Most of the participants were regular participants for the meetup so Kushal took a quick course on Python. After lunch, they started referring the documentation for the MicroBit - MicroPython and played around with the device by displaying their name, using the button to simulate actions.

During the end of the workshop, Kushal demoed the radio module and that turned out to be the most interesting part of the workshop. Kushal sent the first radio message “Hello PyLadies” and all the other peeps were able to see the message in their MicroBit. After that everyone started sending out messages to each other. Nisha ran out of the hackerspace to check the range of the radio.

The meetup ended after a small discussion about PyCon Pune.

February 06, 2017 03:00 PM

February 04, 2017

Sayan Chowdhury

Redesigning fedimg (Part 2): Communication with AWS

In the previous post, I discussed what is fedimg and how it works currently. In this post, I plan to explain the issue in the current uploading process of the AMIs and how we plan to fix it.

What’s the problem?

fedimg boots an utility instance using the RHEL AMI configured for that region.

The problem with this design is that while adding a new region we need to look for the appropriate RHEL AMI in the newer region first. Afterward, we need to test if fedimg works with the newer regions RHEL AMIs. Finally, if everything turns out to be okay we can go ahead with adding the AMI to the fedimg configuration.

This becomes a tedious task over time and delays adding a new region.

How does redesign fixes this?

The new design completely removes the dependency of the utility instances. fedimg would then utilize euca-import-volume to upload the raw cloud image to create a volume via S3.

fedimg will keep retrying to check if the volume is read using euca-describe-conversion-tasks. Once the volume is created, fedimg goes ahead with creating the snapshot of the volume and then finally the AMI.

This change results in removing a lot of redundant code and a simpler fedimg configuration file [1][2]. I have been working on this for sometime now.

Adding a new region now becomes effortless as we just need to append the region to the configuration file.

Fedimg also right now boots up test instances to test the AMIs and does a basic /bin/true test. This test just ensures that the machine boots and nothing more than that.

In the next post, I will be writing on how I will be going ahead to build a testing infrastructure for the AMIs using Autocloud and ResultsDB.

February 04, 2017 06:30 AM