• Stars
    star
    256
  • Rank 159,219 (Top 4 %)
  • Language
    Python
  • License
    Other
  • Created almost 11 years ago
  • Updated almost 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Easy Python packages creation.

Picnic.py

Note: This is getting rather old and unmaintained. Prefer cookiecutter.

Picnic.py helps you write python packages:

picnic.py new PackageName

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

/PackageName_project
    /PackageName
        /setup.py
        /README.rst
        /packagename
            /__init__.py
            /packagename.py

Not enough ? Try this:

picnic.py 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 setup.py folder and type

picnic.py --remote=https://github.com/Zulko/MyPackage.git --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

Picnic.py requires the awesome docopt package, that you can install with the classic

pip install docopt

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

Then, in the folder of the setup.py, type

sudo python setup.py develop

And you are done ! You can modigy the templates in the picnic/files directory anytime after the installation.

For the moment installations with python setup.py install or pip install picnic are buggy (I am not very good at file managing with python, help welcome).

Contribute !

Picnic.py 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 developed on Github. That's where you should go for troubleshooting and bug reports.

Cookbook

In 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 with

picnic.py --help

Creating a Python package

To start a new project, you type

picnic.py new PackageName

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

python setup.py develop

or equivalently

picnic.py --dev

Now we can start to code: we go in directory PackageName/packagename and in the file packagename.py 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

picnic.py [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/make_html.sh file, therefore you only need to type

./make_html.sh

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 setup.py 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 https://github.com/Zulko/MyPackage.git. Then in a console type

git add remote origin https://github.com/Zulko/MyPackage.git

or equivalently

picnic.py --remote=https://github.com/Zulko/MyPackage.git

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

picnic.py --remote=https://link/to/your/repo.git

Now all you have to do is

picnic.py --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 !

Uploading your package on Pypi

Uploading your package on pypi offers it some visibility and enables users to install it easily with the command pip install.

To upload the package, go in the directory of the setup.py and type

(sudo) python setup.py register
(sudo) python setup.py sdist upload

Each time you want to update the code on Pypi, you must first increment the version number in your setup.py, for instance 0.1.0->0.1.1 . Then you just write

(sudo) python setup.py sdist upload

More Repositories

1

moviepy

Video editing with Python
Python
12,493
star
2

eagle.js

A hackable slideshow framework built with Vue.js
JavaScript
4,075
star
3

gizeh

Simple Vector Graphics for Python
Python
691
star
4

easyAI

Python artificial intelligence framework for games
Python
635
star
5

vapory

Photo-realistic 3D rendering with Python and POV-Ray
Python
472
star
6

pianoputer

Use your computer keyboard as a "piano".
Python
325
star
7

twittcher

Python module to watch Twitter user pages or search-results.
Python
63
star
8

unroll

Python package for Piano roll transcription to sheet music
Python
57
star
9

eaglejs-demo

Demo slideshows for Eagle.js
Vue
44
star
10

Minimix

A minimalist sound mixer / instrument emulator written in python
Python
43
star
11

pompei

Mosaics generation from movie frames
Python
42
star
12

-sheet-music--Gerhswin-Limehouse-Nights

Sheet music transcription of a G. Gershwin Public Domain piano roll performance
LilyPond
27
star
13

ddeint

Scipy-based Delay Differential Equation (DDE) solver
Python
26
star
14

pianoputer.js

Javascript implementation of the Pianoputer. Right now, it's bad. Very bad.
JavaScript
24
star
15

gix

Create, share and remix GIFs online
Vue
21
star
16

vmfactory

The Viennese Maze Factory
Python
15
star
17

zulko.github.com

My personal blog on Github
HTML
12
star
18

gif-captioning-with-css

Let's add CSS animations to a GIF!
Vue
5
star
19

moviepy_matplotlib

For issue on matplotlib
Python
5
star
20

bricks_and_scissors

Blog on the computational side of synthetic biology and DNA manufacturing
HTML
4
star
21

--video-editing---Cup-Song-Covers-Mix

Source code for a video featuring 60 covers of the Cup Song
4
star
22

funsliders

Graphical sliders to manually explore any function's input
Python
4
star
23

pianola

A web MIDI piano player, built for roll transcription
Vue
3
star
24

dna_weaver_paper

Manuscript for DNA Weaver
TeX
3
star
25

kbmix

script-based / keyboard-controlled sound mixer
2
star
26

sheet-music--Gershwin-sweet-and-lowdown

Transcription of the Sweet and Lowdown piano roll by George Gershwin
LilyPond
2
star
27

sheet-music--hindustan

Piano transcription of "Hindustan" from a piano roll
LilyPond
2
star
28

-sheet-music--Romance-for-guitar

Piano arrangement of the Romance for guitar made famous by the movie Jeux Interdits
2
star
29

unroll-online

Web app for piano roll transcription
JavaScript
1
star
30

Web_tools

Python
1
star
31

FLOT-Demo

A FLOT.js demo
JavaScript
1
star
32

sheet-music--duet-for-the-right-hand

A little piano piece for the right hand alone (lilypond file)
LilyPond
1
star