| 1 |
.. _contributing: |
| 2 |
|
| 3 |
******************** |
| 4 |
Contributing Changes |
| 5 |
******************** |
| 6 |
|
| 7 |
The best way to contribute to the periodic table package is to work |
| 8 |
from a copy of the source tree in the revision control system. |
| 9 |
|
| 10 |
The source is available via git at `<https://github.com/python-periodictable/periodictable>`_. |
| 11 |
To make changes, create a fork of the project on github, then do following, |
| 12 |
with your github user name substituted for *GITNAME*:: |
| 13 |
|
| 14 |
git clone https://github.com/GITNAME/periodictable.git |
| 15 |
cd periodictable |
| 16 |
python setup.py develop |
| 17 |
|
| 18 |
By using the *develop* keyword on setup.py, changes to the files in the |
| 19 |
package are immediately available without the need to run setup.py |
| 20 |
install each time. |
| 21 |
|
| 22 |
Track updates to the original package using:: |
| 23 |
|
| 24 |
git remote add upstream https://github.com/python-periodictable/periodictable.git |
| 25 |
git remote -v # check that it is set |
| 26 |
git fetch upstream |
| 27 |
git merge upstream/master |
| 28 |
|
| 29 |
Please update the documentation and add tests for your changes. We use |
| 30 |
doctests on all of our examples that we know our documentation is correct. |
| 31 |
More thorough tests are found in test directory. Using the the nose test |
| 32 |
package, you can run both sets of tests:: |
| 33 |
|
| 34 |
pip install pytest pytest-cov |
| 35 |
pytest |
| 36 |
|
| 37 |
When all the tests run, create a pull request (PR) on the github page. |
| 38 |
|
| 39 |
Windows user can use `TortoiseGit <http://code.google.com/p/tortoisegit/>`_ |
| 40 |
package which provides similar operations. |
| 41 |
|
| 42 |
You can build the documentation as follows (linux, mac):: |
| 43 |
|
| 44 |
pip install sphinx |
| 45 |
(cd doc/sphinx && PYTHONPATH=../.. make clean html pdf) |
| 46 |
|
| 47 |
You can see the result by pointing your browser to:: |
| 48 |
|
| 49 |
periodictable/doc/sphinx/_build/html/index.html |
| 50 |
periodictable/doc/sphinx/_build/latex/PeriodicTable.pdf |
| 51 |
|
| 52 |
ReStructured text format does not have a nice syntax for superscripts and |
| 53 |
subscripts. Units such as |g/cm^3| are entered using macros such as |
| 54 |
\|g/cm^3| to hide the details. The complete list of macros is available in |
| 55 |
|
| 56 |
doc/sphinx/rst_prolog |
| 57 |
|
| 58 |
In addition to macros for units, we also define cdot, angstrom and degrees |
| 59 |
unicode characters here. The corresponding latex symbols are defined in |
| 60 |
doc/sphinx/conf.py. |