Skip to content

Commit

Permalink
Initial content.
Browse files Browse the repository at this point in the history
Initial content generated by pelican-quickstart and a few pages, to
get started with.
  • Loading branch information
bravegnu committed Sep 22, 2014
1 parent 4169fbd commit 6fdf01a
Show file tree
Hide file tree
Showing 7 changed files with 496 additions and 0 deletions.
110 changes: 110 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
PY?=python
PELICAN?=pelican
PELICANOPTS=

BASEDIR=$(CURDIR)
INPUTDIR=$(BASEDIR)/content
OUTPUTDIR=$(BASEDIR)/output
CONFFILE=$(BASEDIR)/pelicanconf.py
PUBLISHCONF=$(BASEDIR)/publishconf.py

FTP_HOST=localhost
FTP_USER=anonymous
FTP_TARGET_DIR=/

SSH_HOST=chennaipy.org
SSH_PORT=2222
SSH_USER=bravegnu
SSH_TARGET_DIR=~/public_html/chennaipy.org

S3_BUCKET=my_s3_bucket

CLOUDFILES_USERNAME=my_rackspace_username
CLOUDFILES_API_KEY=my_rackspace_api_key
CLOUDFILES_CONTAINER=my_cloudfiles_container

DROPBOX_DIR=~/Dropbox/Public/

GITHUB_PAGES_BRANCH=gh-pages

DEBUG ?= 0
ifeq ($(DEBUG), 1)
PELICANOPTS += -D
endif

help:
@echo 'Makefile for a pelican Web site '
@echo ' '
@echo 'Usage: '
@echo ' make html (re)generate the web site '
@echo ' make clean remove the generated files '
@echo ' make regenerate regenerate files upon modification '
@echo ' make publish generate using production settings '
@echo ' make serve [PORT=8000] serve site at http://localhost:8000'
@echo ' make devserver [PORT=8000] start/restart develop_server.sh '
@echo ' make stopserver stop local server '
@echo ' make ssh_upload upload the web site via SSH '
@echo ' make rsync_upload upload the web site via rsync+ssh '
@echo ' make dropbox_upload upload the web site via Dropbox '
@echo ' make ftp_upload upload the web site via FTP '
@echo ' make s3_upload upload the web site via S3 '
@echo ' make cf_upload upload the web site via Cloud Files'
@echo ' make github upload the web site via gh-pages '
@echo ' '
@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html'
@echo ' '

html:
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)

clean:
[ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)

regenerate:
$(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)

serve:
ifdef PORT
cd $(OUTPUTDIR) && $(PY) -m pelican.server $(PORT)
else
cd $(OUTPUTDIR) && $(PY) -m pelican.server
endif

devserver:
ifdef PORT
$(BASEDIR)/develop_server.sh restart $(PORT)
else
$(BASEDIR)/develop_server.sh restart
endif

stopserver:
kill -9 `cat pelican.pid`
kill -9 `cat srv.pid`
@echo 'Stopped Pelican and SimpleHTTPServer processes running in background.'

publish:
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)

ssh_upload: publish
scp -P $(SSH_PORT) -r $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)

rsync_upload: publish
rsync -e "ssh -p $(SSH_PORT)" -P -rvzc --delete $(OUTPUTDIR)/ $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) --cvs-exclude

dropbox_upload: publish
cp -r $(OUTPUTDIR)/* $(DROPBOX_DIR)

ftp_upload: publish
lftp ftp://$(FTP_USER)@$(FTP_HOST) -e "mirror -R $(OUTPUTDIR) $(FTP_TARGET_DIR) ; quit"

s3_upload: publish
s3cmd sync $(OUTPUTDIR)/ s3://$(S3_BUCKET) --acl-public --delete-removed --guess-mime-type

cf_upload: publish
cd $(OUTPUTDIR) && swift -v -A https://auth.api.rackspacecloud.com/v1.0 -U $(CLOUDFILES_USERNAME) -K $(CLOUDFILES_API_KEY) upload -c $(CLOUDFILES_CONTAINER) .

github: publish
ghp-import -b $(GITHUB_PAGES_BRANCH) $(OUTPUTDIR)
git push origin $(GITHUB_PAGES_BRANCH)

.PHONY: html help clean regenerate serve devserver publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload cf_upload github
125 changes: 125 additions & 0 deletions content/august-2014-meet-minutes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
Title: August Meet Minutes
Date: 2014-08-27 02:05
Category: Meeting Minutes

This time around we had about 14 members attending the meet. The meet
started with the first talk -- "Unit Tests with Nose".

Unit Tests with Nose
====================

Vengatesh presented the various features of nose framework, comparing
them with the 'unittest' module present in the standard library. He
showed how the nose framework did not require us to create a separate
class for writing simple test functions, but still allowed for
providing test fixtures through decorators. He also should how more
complex test cases can be defined through test classes and test
packages. He then listed the plugins available with the nose
framework, and demonstrated the usage of the coverage plugin.

That brought us almost to the end of the talk, the next talk was "API
Documenation with Sphinx and Napoleon".

API Documentation with Sphinx and Napoleon
==========================================

Aadhithyan explained the usage of Sphinx and Napoleon. He showed:

1. How Sphinx can be invoked using the 'sphinx-quickstart' command.
2. The purpose of various files and folders created by the command.
3. How the Napoleon plugin can be enabled, in the 'config.py' file.
4. How the 'sphinx-apidoc' is to be invoked to create the
reStructuredText files from the python modules.
5. How the 'make' is to be invoked to create the html files from the
reStructuredText

He demonstrated the above instructions with a simple Python module,
and more complex example, exercising all the features of the Google
docstring convention.

The discussion then moved on to, how the Google docstring convention
was better than the default one in Sphinx. With the Google docstring
convention, the docstring was both human readable and machine
readable.

That brought us to the end of the talk. The next talk was on "Brython".

Brython
=======

Vijay started off by explaining that Brython was a Python to Javascript
compiler written in Javascript. This allowed Python programs to be
executed within a browser. He then demonstrated an example Hello
World program shown below. When the HTML file was opened in a browser,
the "Hello World" message appeared in the Javascript console.

<html>
<head>
<title>Brython Example</title>
<script src="brython/brython.js"></script>
</head>
<body onload="brython()">
<script type="text/python">
print("Hello World")
</script>
<h1>Brython Example</h1>
</body>
</html>

He then modified the program step by step adding more and more
features, till it became an arthimetic quiz.

Step 1. Display the "Hello World" message within the HTML page,
instead of the Javascript console.

Step 2. Use a separate file for the Python script, using 'src'
attribute of the 'script' tag.

Step 3. Display an arithmetic quiz question, with an input box.

Step 4. Verify the answer entered, and display the next question.

Step 5. Cleanup previous questions, before displaying the next
question.

He then showed an example of paddle ball game, again building it step
by step from scratch. This time he used the canvas HTML element, to do
the graphics.

He concluded his talk with some real world use-cases for Brython. One
of the use-cases he showed was the Reeborg's World
http://reeborg.ca/index_en.html

Asciinema
=========

Rengaraj did a quick lightning talk on Asciinema, an open source
solution for recording terminal sessions. Rengaraj recorded a terminal
session uploaded it to Asciinema, played it back on Asciinema's
website. The recording, it seems, captures the VT100 escape sequences
instead of the on-screen pixels, which is what a conventional screen
capture program does. The advantage:

1. Uploads a terribly fast.
2. Download and playback is fast.
3. No blurring in the playback.

Merger with Pych
================

Vijay then provided an update on the merger with Pych. It seems that
Pych, was conceived to develop open source software using Python. And
Sam from Pych believes that their goals are much different from a
Python User Group, and it would be better for them to be a separate
entity.

But, since Pych is also organizing monthly meets, Vijay suggested that
we go with bi-monthly meets to avoid duplicating efforts. And the
members gathered agreed that this should be OK. He also suggested that
we spend the spare time that we get out of reducing the meetings, be
used to develop content for workshops and to organize workshops.

A few other suggestions that members came up with, were to create
meetup.com group for Chennaipy. Vijay agreed that, a meetup group
would be useful, and said he will be creating one for Chennaipy
shortly.
31 changes: 31 additions & 0 deletions content/pages/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Title: Welcome!
Date: 2014-09-16 07:00
url: index.html
save_as: index.html

Chennaipy is Python user-group, where Pythonistas in and around
Chennai come together to share their knowledge and to contribute to
the promotion of Python.

Mailing List
============

We have a mailing list
[[email protected]](https://mail.python.org/mailman/listinfo/chennaipy).
You can post your questions about Python to the mailing list, discuss
about conducting local events, get notifications about upcoming meets,
...

* [Join the Mailing List](https://mail.python.org/mailman/listinfo/chennaipy)
* [View the Archives](https://mail.python.org/pipermail/chennaipy/)


Meetup
======

We have a [Meetup group](http://www.meetup.com/chennaipy). Join the
Chennaipy meetup group, to get meeting notifications, and RSVP to
meeting invites.

* [Join the Meetup Group](http://www.meetup.com/Chennaipy/join/)
* [View Members](http://www.meetup.com/Chennaipy/members/)
103 changes: 103 additions & 0 deletions develop_server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!/usr/bin/env bash
##
# This section should match your Makefile
##
PY=${PY:-python}
PELICAN=${PELICAN:-pelican}
PELICANOPTS=

BASEDIR=$(pwd)
INPUTDIR=$BASEDIR/content
OUTPUTDIR=$BASEDIR/output
CONFFILE=$BASEDIR/pelicanconf.py

###
# Don't change stuff below here unless you are sure
###

SRV_PID=$BASEDIR/srv.pid
PELICAN_PID=$BASEDIR/pelican.pid

function usage(){
echo "usage: $0 (stop) (start) (restart) [port]"
echo "This starts Pelican in debug and reload mode and then launches"
echo "an HTTP server to help site development. It doesn't read"
echo "your Pelican settings, so if you edit any paths in your Makefile"
echo "you will need to edit your settings as well."
exit 3
}

function alive() {
kill -0 $1 >/dev/null 2>&1
}

function shut_down(){
PID=$(cat $SRV_PID)
if [[ $? -eq 0 ]]; then
if alive $PID; then
echo "Stopping HTTP server"
kill $PID
else
echo "Stale PID, deleting"
fi
rm $SRV_PID
else
echo "HTTP server PIDFile not found"
fi

PID=$(cat $PELICAN_PID)
if [[ $? -eq 0 ]]; then
if alive $PID; then
echo "Killing Pelican"
kill $PID
else
echo "Stale PID, deleting"
fi
rm $PELICAN_PID
else
echo "Pelican PIDFile not found"
fi
}

function start_up(){
local port=$1
echo "Starting up Pelican and HTTP server"
shift
$PELICAN --debug --autoreload -r $INPUTDIR -o $OUTPUTDIR -s $CONFFILE $PELICANOPTS &
pelican_pid=$!
echo $pelican_pid > $PELICAN_PID
cd $OUTPUTDIR
$PY -m pelican.server $port &
srv_pid=$!
echo $srv_pid > $SRV_PID
cd $BASEDIR
sleep 1
if ! alive $pelican_pid ; then
echo "Pelican didn't start. Is the Pelican package installed?"
return 1
elif ! alive $srv_pid ; then
echo "The HTTP server didn't start. Is there another service using port 8000?"
return 1
fi
echo 'Pelican and HTTP server processes now running in background.'
}

###
# MAIN
###
[[ ($# -eq 0) || ($# -gt 2) ]] && usage
port=''
[[ $# -eq 2 ]] && port=$2

if [[ $1 == "stop" ]]; then
shut_down
elif [[ $1 == "restart" ]]; then
shut_down
start_up $port
elif [[ $1 == "start" ]]; then
if ! start_up $port; then
shut_down
fi
else
usage
fi
Loading

0 comments on commit 6fdf01a

Please sign in to comment.