Package: picnic
Picnic.py helps you write python packages:picnic.py new PackageNameThis creates a directory with all the files you need to get started:/PackageName_project
    /PackageName
        /setup.py
        /README.rst
        /packagename
            /__init__.py
            /packagename.pyNot enough ? Try this:picnic.py new MyPackage --author=Zulko --sphinx --gitinit --devNow 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 indevelopmode (meaning you can change the code directly from this folder, without needing to reinstall the project).These commandsalso work on already-written packages. For instance if I go in thesetup.pyfolder and typepicnic.py --remote=https://github.com/Zulko/MyPackage.git --ghpagesThis 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 methis repofor the code, andthis pagefor the online documentation (you can change the look afterwards).Installation and customizationPicnic.py requires the awesomedocoptpackage, that you can install with the classicpip python install docoptTo install Picnic.py, get a zip of the code, for instance onGithub, and unzip it in some folder. You can have a look at the file templatesREADME.rst,setup.pyetc in subfolderpicnic/files, and customize them as you like.Then, in the folder of thesetup.py, typesudo python setup.py installor even better, use this command instead, it will enable you to change the templates even after the installation:sudo python setup.py developAnd you are done ! Note that you can also installpicnic.pywithpipbut it is not recommended as it doesn’t allow you to change the templates.Contribute !Picnic.py is an open source software originally written byZulkoand 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 isanother onebeing actively developed.Picnic is being developped onGithub. That’s where you should go for troubleshooting and bug reports.CookbookIn this section, which is meant for beginners in Python, Sphinx, git, and Github, we explain how the files created by Picnic.py are meant to be used. You can also get help from the console withpicnic.py --helpCreating a Python packageTo start a new project, you typepicnic.py new PackageNameTo install the package (you will be able to modify the code afterwards) typepython setup.py developor equivalentlypicnic.py --devNow we can start to code: we go in directoryPackageName/packagenameand in the filepackagename.pywe writedef 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 documentationTo initialize theSphinxdocumentation you typepicnic.py [new PackageName] --author="Your Name" --sphinxThe documentation source will be in thedocsdirectory and the built (html) doc will be in the folderbuilt_docs/html/. To preview the docs after you have made some changes you can go into thedocsrepository and typemake html
firefox ../../built_docs/html/index.htmlFor convenience these two lines are already written in thedocs/make_html.shfile, therefore you only need to type./make_html.shCreating a git repositoryTo create a git repository the classic way, you generally add a.gitignorefile to your folder (to specify what kind of files not to include in the repo) and type these linesgit init
git add .
git commit -m "Initial commit"The--gitoption 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 yoursetup.pyis.Linking to a repository on GithubTo 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 likehttps://github.com/Zulko/MyPackage.git. Then in a console typegit add remote origin https://github.com/Zulko/MyPackage.gitor equivalentlypicnic.py --remote=https://github.com/Zulko/MyPackage.gitTo commit the changes to the git repo I generally dogit commit -a -m "my description of the commit"And after this, to push the changes on the online Github repo:git push origin masterCreating Github-pagesHere we suppose that you have already linked your project to Github withgit add remote origin https://link/to/your/repo.gitor equivalentlypicnic.py --remote=https://link/to/your/repo.gitNow all you have to do ispicnic.py --ghpagesThis creates a special git repository for the Github Pages in the directorybuilt_docs/html, which is the output directory of the documentation.When you are happy with the way your documentation looks you go into folderbuilt_docs/htmland typegit commit -a -m "my description of the commit"
git push origin gh-pagesThat’s all there is to know !