Skip to main content

Python packages creation made easy

Project description helps you write python packages: new PackageName

This creates a directory with all the files you need to get started:


Not enough ? Try this: new MyPackage --author=Zulko --sphinx --gitinit --dev

Now you have a new package with a Sphinx documentation and a git repository for your project. And your package has been installed on your computer in develop mode (meaning you can change the code directly from this folder, without needing to reinstall the project).

These commands also work on already-written packages. For instance if I go in the folder and type --remote= --ghpages

This will link my project to an existing Github repository and initialize the Github Pages for this project. Now I just need to push these on Github (see Cookbook below), which will give me this repo for the code, and this page for the online documentation (you can change the look afterwards).

Installation and customization requires the awesome docopt package, that you can install with the classic

pip python install docopt

To install, get a zip of the code, for instance on Github, and unzip it in some folder. You can have a look at the file templates README.rst, etc in subfolder picnic/files, and customize them as you like.

Then, in the folder of the, type

sudo python install

or even better, use this command instead, it will enable you to change the templates even after the installation:

sudo python develop

And you are done ! Note that you can also install with pip but it is not recommended as it doesn’t allow you to change the templates.

Contribute ! is an open source software originally written by Zulko and released under the MIT licence. Please help make picnic better, for instance by expanding the capabilities, providing advice for sounder standards if you are an experienced module-maker, reporting bugs, etc. We love forks and pull resquests !

And speaking about branches, there is another one being actively developed.

Picnic is being developped on Github. That’s where you should go for troubleshooting and bug reports.


In this section, which is meant for beginners in Python, Sphinx, git, and Github, we explain how the files created by are meant to be used. You can also get help from the console with --help

Creating a Python package

To start a new project, you type new PackageName

To install the package (you will be able to modify the code afterwards) type

python develop

or equivalently --dev

Now we can start to code: we go in directory PackageName/packagename and in the file we write

def say_hello():
    print "Hello world !"

To check that this worked, open a python console (in any folder) and type

>>> import packagename
>>> packagename.say_hello()
 Hello World !

Creating a Sphinx documentation

To initialize the Sphinx documentation you type [new PackageName] --author="Your Name" --sphinx

The documentation source will be in the docs directory and the built (html) doc will be in the folder built_docs/html/. To preview the docs after you have made some changes you can go into the docs repository and type

make html
firefox ../../built_docs/html/index.html

For convenience these two lines are already written in the docs/ file, therefore you only need to type


Creating a git repository

To create a git repository the classic way, you generally add a .gitignore file to your folder (to specify what kind of files not to include in the repo) and type these lines

git init
git add .
git commit -m "Initial commit"

The --git option does exactly all this: it adds a .gitignore file to the folder and runs all these commands. Be sure to run it in the directory where your is.

Linking to a repository on Github

To put this git repository on a Github, first create a repo on Github (say no when they ask you whether to include a README file). Github should give you the url of the repo, something like Then in a console type

git add remote origin

or equivalently --remote=

To commit the changes to the git repo I generally do

git commit -a -m "my description of the commit"

And after this, to push the changes on the online Github repo:

git push origin master

Creating Github-pages

Here we suppose that you have already linked your project to Github with

git add remote origin https://link/to/your/repo.git

or equivalently --remote=https://link/to/your/repo.git

Now all you have to do is --ghpages

This creates a special git repository for the Github Pages in the directory built_docs/html, which is the output directory of the documentation.

When you are happy with the way your documentation looks you go into folder built_docs/html and type

git commit -a -m "my description of the commit"
git push origin gh-pages

That’s all there is to know !

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

picnic- (6.9 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page