All changes to the code base go through the [pull-request
workflow](https://docs.gitlab.com/ee/user/project/merge_requests/) Anyone may
review your code and you may expect a few comments and questions. Once all
discussions are resolved, core developers will approve the merge request and
then merge in into master. If you go a few days without a reply, please feel
free to ping the thread by adding a new comment.
All merge requests should be focused: they should aim to either add one
feature, solve one bug, or fix some stylistic issues. If multiple changes are
lumped together it can slow down the process and make it harder to review.
Before you begin: if your change will be a significant amount of work
to write, we highly recommend starting by opening an issue laying out
what you want to do. That lets a conversation happen early in case
other contributors disagree with what you'd like to do or have ideas
that will help you do it.
We are keen to maintain a high standard of the code. This makes it easier to
maintain, develop, and track down buggy behaviour.
All merge requests should also be recorded in the CHANGELOG.md.
This just requires a short sentence describing describing the change, e.g.,
"- Enable initial values for emcee to be specified."
ADD DISCUSSION ON CODE QUALITY
Reviewing Changes
-----------------
If you are reviewing a merge request (either as a core developer or just as an
interested party) please key these three things in mind
* If you open a discussion, be timely in responding to the submitter. Note, the
reverse does not need to apply.
* Keep your questions/comments focussed on the scope of the merge request. If
while reviewing the code you notice other things which could be improved, open
a new issue.
* Be supportive - merge requests represent a lot of hard work and effort and
should be encouraged.
Core developer guidelines
-------------------------
Core developers should follow these rules when processing pull requests:
* Always wait for tests to pass before merging PRs.
* Delete branches for merged PRs (by core devs pushing to the main repo).
* Make sure related issues are linked and (if appropriate) closed.
* Squash commits
Issue-tracker conventions
-------------------------
#### Bug reporting
If you notice any bugs in the code, please let us know!
Issues reporting bugs should include:
* A brief description of the issue.
* A full error trace (if applicable).
* A minimal example to reproduce the issue.
#### Feature requests
If there's any additional functionality you'd like to see in the code open an
issue describing the desired feature.
In order to maximise the likelihood that feature requests will be fulfilled
you should:
* Make the feature request as specific as possible, vague requests are
unlikely to be taken on by users.
* If possible break down the feature into small chunks which can be
marked off on a checklist.
## Code overview
In this section, we'll give an overview of how the code is structured. This is intended to help orient users and make it easier to contribute. The layout is intended to define the logic of the code and new merge requests should aim to fit within this logic (unless there is a good argument to change it). For example, code which adds a new sampler should not effect the gravitational-wave specific parts of the code. Note that this document is not programatically generated and so may get out of date with time. If you notice something wrong, please open an issue.
### Top level
At the top level, the code is split into three modules containing the core, gravitational-wave specific, and hyper-parameter specific functionality. New changes should always respect this
```mermaid
graph TD
tupak[tupak] --> core[.core]
tupak --> gw[.gw]
tupak --> hyper[.hyper]
```
### Core
The core module contains the core inference logic - methods to define a prior, likelihood, and run Bayesian inference.