Debian Codegraph @

doc/sphinx/development.rst

raw
1 ===========
2 Development
3 ===========
4
5 Basic instructions
6 ==================
7
8 The default cclib files distributed with a release, as described in `How to install`_, do not include any unit tests and logfiles necessary to run those tests. This section covers how to download the full source along with all test data and scripts, and how to use these for development and testing.
9
10 .. _`How to install`: how_to_install.html
11
12 Cloning cclib from GitHub
13 ~~~~~~~~~~~~~~~~~~~~~~~~~
14
15 cclib is hosted by the fantastic people at `GitHub`_ (previously at `Sourceforge`_) in a `git`_ repository. You can download a `zipped archive`_ of the current development version (called `master`) for installation and testing or browse the available `releases`_. In order to contribute any changes, however, you will need to create a local copy of the repository:
16
17 .. code-block:: bash
18
19 git clone https://github.com/cclib/cclib.git
20
21 .. _`GitHub`: https://github.com
22 .. _`Sourceforge`: https://sourceforge.net
23 .. _`git`: https://git-scm.com
24 .. _`zipped archive`: https://github.com/cclib/cclib/archive/master.zip
25 .. _`releases`: https://github.com/cclib/cclib/releases
26
27 Guidelines
28 ~~~~~~~~~~~~~~~~
29
30 We follow a typical GitHub collaborative model, relying on `forks and pull requests`_. In short, the development process consists of:
31
32 * `Creating your own fork`_ of cclib in order to develop
33 * `Creating a pull request`_ to contribute your changes
34 * Reviewing and merging open pull requests (by someone else)
35 * Using `issues`_ to plan and prioritize future work
36
37 .. _`creating your own fork`: https://help.github.com/articles/fork-a-repo
38 .. _`creating a pull request`: https://help.github.com/articles/creating-a-pull-request
39 .. _`forks and pull requests`: https://help.github.com/articles/using-pull-requests
40 .. _`issues`: https://github.com/cclib/cclib/issues
41
42 Here are some general guidelines for developers who are contributing code:
43
44 * Run and review the unit tests (see below) before submitting a pull request.
45 * There should normally not be more failed tests than before your changes.
46 * For larger changes or features that take some time to implement, `using branches`_ is recommended.
47
48 .. _`using branches`: https://help.github.com/articles/branching-out
49
50 Releasing a new version
51 ~~~~~~~~~~~~~~~~~~~~~~~
52
53 The release cycle of cclib is irregular, with new versions being created as deemed necessary after significant changes or new features. We roughly follow semantic versioning with respect to the `parsed attributes`_.
54
55 When creating a new release on GitHub, the typical procedure might include the following steps:
56
57 * Update the `CHANGELOG`_, `ANNOUNCE`_ and any other files that might change content with the new version
58 * Make sure that `setup.py`_ has the right version number, as well as __version__ in `__init__.py`_ and any other relevant files
59 * Update the download and install instructions in the documentation, if appropriate
60 * Create a branch for the release, so that development can continue
61 * Run all tests for a final time and fix any remaining issues
62 * Tag the release (make sure to use an annotated tag using ``git -a``) and upload it (``git push --tags``)
63 * Run `manifest.py`_ to update the MANIFEST file
64 * Create the source distributions (``python setup.py sdist --formats=gztar,zip``) and Windows binary installers (``python setup.py bdist_wininst``)
65 * Create a release on GitHub using the created tag (see `Creating releases`_) and upload the source distributions and Windows binaries
66 * Email the users and developers mailing list with the message in `ANNOUNCE`_
67 * Update the Python package index (https://pypi.python.org/pypi/cclib), normally done by ``python setup.py register``
68 * For significant releases, if appropriate, send an email to the `CCL list`_ and any mailing lists for computational chemistry packages supported by cclib
69
70 .. _`parsed attributes`: data.html
71
72 .. _`ANNOUNCE`: https://github.com/cclib/cclib/blob/master/ANNOUNCE
73 .. _`CHANGELOG`: https://github.com/cclib/cclib/blob/master/CHANGELOG
74 .. _`setup.py`: https://github.com/cclib/cclib/blob/master/setup.py
75 .. _`__init__.py`: https://github.com/cclib/cclib/blob/master/src/cclib/__init__.py
76 .. _`manifest.py`: https://github.com/cclib/cclib/blob/master/manifest.py
77
78 .. _`Creating releases`: https://help.github.com/articles/creating-releases
79
80 .. _`CCL list`: http://www.ccl.net
81
82 Testing
83 =======
84
85 .. index::
86 single: testing; unit tests
87
88 The `test directory`_, which is not included in the default download, contains the test scripts that keep cclib reliable, and keep the developers sane. With any new commit or pull request to cclib on GitHub the tests are triggered and run with `Travis CI`_, for both the current production version |release| (|travis_prod|) as well as master (|travis_master|).
89
90 The input files for tests, which are logfiles from computational chemistry programs, are located in the `data directory`_. These are a central part of cclib, and any progress should always be supported by corresponding tests. When a user opens an issue or reports a bug, it is prudent to write a test that reproduces the bug as well as fixing it. This ensures it will remain fixed in the future. Likewise, extending the coverage of data attributes to more programs should proceed in parallel with the growth of unit tests.
91
92 .. _`Travis CI`: https://travis-ci.org/cclib/cclib
93
94 .. |travis_prod| image:: https://travis-ci.org/cclib/cclib.svg?branch=v1.6.2
95 .. |travis_master| image:: https://travis-ci.org/cclib/cclib.svg?branch=master
96
97 .. _`data directory`: https://github.com/cclib/cclib/tree/master/data
98 .. _`test directory`: https://github.com/cclib/cclib/tree/master/test
99
100 .. index::
101 single: testing; unit tests
102
103 Unit tests
104 ~~~~~~~~~~
105
106 Unit tests check that the parsers work correctly for typical calculation types on small molecules, usually water or 1,4-divinylbenzene (dvb) with :math:`C_{\mathrm{2h}}` symmetry. The corresponding logfiles stored in folders like ``data/NWChem/basicNWChem6.0`` are intended to test logfiles for an approximate major version of a program, and are standardized for all supported programs to the extent possible. They are located alongside the code in the repository, but are not normally distributed with the source. Attributes are considered supported only if they are checked by at least one test, and the `table of attribute coverage`_ is generated automatically using this criterion.
107
108 The job types currently included as unit tests:
109
110 * restricted and unrestricted single point energies for dvb (RHF/STO-3G **and** B3LYP/STO-3G)
111 * geometry optimization and scan for dvb (RHF/STO-3G and/or B3LYP/STO-3G)
112 * frequency calculation with IR and Raman intensities for dvb (RHF/STO-3G or B3LYP/STO-3G)
113 * single point energy for carbon atom using a large basis set such as aug-cc-pCVQZ
114 * Møller–Plesset and coupled cluster energies for water (STO-3G or 6-31G basis set)
115 * static polarizabilities for tryptophan (RHF/STO-3G)
116
117 .. _`table of attribute coverage`: data_dev.html#details-of-current-implementation
118
119 Adding a new program version
120 ----------------------------
121
122 There are a few conventions when adding a new supported program version to the unit tests:
123 * Two different recent versions are typically used in the unit tests. If there already are two, move the older version(s) the regression suite (see below).
124 * When adding files for the new version, first copy the corresponding files for the last version already in cclib. Afterwards, check in files from the new program version as changes to the copied files. This procedure makes it easy to look at the differences introduced with the new version in git clients.
125
126 .. index::
127 single: testing; regressions
128
129 Regression tests
130 ~~~~~~~~~~~~~~~~
131
132 Regression tests ensure that bugs, once fixed, stay fixed. These are real-life files that at some point broke a cclib parser, and are stored in folders like ``data/regression/Jaguar/Jaguar6.4``. The files associated with regression tests are not stored stored together with the source code as they are often quite large. A separate repository on GitHub, `cclib-data`_, is used to track these files, and we do not distribute them with any releases.
133
134 For every bug found in the parsers, there should be a corresponding regression test that tests this bug stays fixed. The process is automated by `regression.py`_, which runs through all of our test data, both the basic data and regression files, opens them, tries to parse, and runs any relevant regression tests defined for that file. New regression tests are added by creating a function ``testMyFileName_out`` according to the examples at the start of `regression.py`_.
135
136 Using both the unit and regression tests, the line-by-line `test coverage`_ shows which parts of cclib are touched by at least one test. When adding new features and tests, the Travis CI `testing script`_ can be run locally to generate the HTML coverage pages and ensure that the tests exercise the feature code.
137
138 .. _`cclib-data`: https://github.com/cclib/cclib-data
139 .. _`regression.py`: https://github.com/cclib/cclib/blob/master/test/regression.py
140
141 .. _`test coverage`: coverage/index.html
142 .. _`testing script`: https://github.com/cclib/cclib/blob/master/travis/run_pytest.sh
143
144 Websites related to cclib
145 =========================
146
147 * The official `cclib organization on github`_
148 * The `cclib project page on Sourceforge`_ (inactive now)
149 * The `cclib page for Travis CI`_
150 * The `cclib entry on PyPI`_
151 * The `cclib entry on Ohloh`_
152
153 .. _`cclib organization on github`: https://github.com/cclib
154 .. _`cclib project page on Sourceforge`: http://sourceforge.net/projects/cclib/
155 .. _`cclib entry on PyPI`: http://www.python.org/pypi/cclib
156 .. _`cclib page for Travis CI`: https://travis-ci.org/cclib/cclib
157 .. _`cclib entry on Ohloh`: https://www.ohloh.net/p/cclib
158
159 Developers
160 ==========
161
162 Besides input from a number of people `listed in the repository`_, the following developers have contributed code to cclib (in alphabetical order):
163
164 * `Eric Berquist`_
165 * `Karol M. Langner`_
166 * `Noel O'Boyle`_
167 * Christopher Rowley
168 * Adam Tenderholt
169
170 .. _`listed in the repository`: https://github.com/cclib/cclib/blob/master/THANKS
171
172 .. _`Eric Berquist`: https://github.com/berquist
173 .. _`Karol M. Langner`: https://github.com/langner
174 .. _`Noel O'Boyle`: https://www.redbrick.dcu.ie/~noel/