There are many ways to contribute to Pelican. You can improve the documentation, add missing features, and fix bugs (or just report them). You can also help out by reviewing and commenting on existing issues.
Don’t hesitate to fork Pelican and submit a pull request on GitHub. When doing so, please adhere to the following guidelines.
Check out our Git Tips page or ask on the #pelican IRC channel if you need assistance or have any questions about these guidelines.
While there are many ways to set up one’s development environment, following is a method that uses virtualenv. If you don’t have virtualenv installed, you can install it via:
$ pip install virtualenv
Virtual environments allow you to work on Python projects which are isolated from one another so you can use different packages (and package versions) with different projects.
To create and activate a virtual environment, use the following syntax:
$ virtualenv ~/virtualenvs/pelican
$ cd ~/virtualenvs/pelican
$ . bin/activate
To clone the Pelican source:
$ git clone https://github.com/getpelican/pelican.git src/pelican
To install the development dependencies:
$ cd src/pelican
$ pip install -r dev_requirements.txt
To install Pelican and its dependencies:
$ python setup.py develop
Try to respect what is described in the PEP8 specification when making contributions. This can be eased via the pep8 or flake8 tools, the latter of which in particular will give you some useful hints about ways in which the code/formatting can be improved.
If you make changes to the documentation, you should preview your changes before committing them:
$ pip install sphinx
$ cd src/pelican/docs
$ make html
Open _build/html/index.html in your browser to preview the documentation.
Each time you add a feature, there are two things to do regarding tests: check that the existing tests pass, and add tests for the new feature or bugfix.
The tests live in pelican/tests and you can run them using the “discover” feature of unittest:
$ python -m unittest discover
After making your changes and running the tests, you may see a test failure mentioning that “some generated files differ from the expected functional tests output.” If you have made changes that affect the HTML output generated by Pelican, and the changes to that output are expected and deemed correct given the nature of your changes, then you should update the output used by the functional tests. To do so, you can use the following two commands:
$ pelican -o pelican/tests/output/custom/ -s samples/pelican.conf.py \
samples/content/
$ pelican -o pelican/tests/output/basic/ samples/content/
Testing on Python 3.x currently requires some extra steps: installing Python 3.x-compatible versions of dependent packages and plugins.
However, you must tell tox to use those Python 3.x-compatible libraries. If you forget this, tox will pull the regular packages from PyPI, and the tests will fail.
Tell tox about the local packages thusly: enter the source directory of smartypants and run tox there. Do this again for the typogrify and webassets packages. SmartyPants and Typogrify do not have real tests, and webassets will fail noisily, but as a result we get these libraries neatly packaged in tox’s distshare directory, which we need in order to run tox for Pelican.
Here are some tips that may be useful when doing some code for both Python 2.7 and Python 3.x at the same time: