You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+21-13Lines changed: 21 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
-
#Contributing to Qiita
1
+
#Contributing to Qiita
2
2
3
3
Qiita is an open source software package, and we welcome community contributions. You can find the source code and test code for Qiita under public revision control in the Qiita git repository on [GitHub](http://github.com/biocore/qiita). We very much welcome contributions.
4
4
5
5
This document covers what you should do to get started with contributing to Qiita. You should read this whole document before considering submitting code to Qiita. This will save time for both you and the Qiita developers.
6
6
7
-
#General Notes on Development
7
+
#General Notes on Development
8
8
9
9
Adding source code to Qiita, can take place in three different modules:
10
10
@@ -17,7 +17,15 @@ always take into consideration how these new features affect users and whether
17
17
or not adding a new section or document to the documentation (found under the
18
18
`doc` folder) would be useful.
19
19
20
-
###The Qiita development rules
20
+
### Repository branch structure
21
+
22
+
The Qiita repository contains three branches:
23
+
24
+
*`master`: This branch reflects the code deployed in our [main Qiita server](http://qiita.microbio.me).
25
+
*`dev`: This branch is the active development branch. All new Pull Requests should be performed against this branch.
26
+
*`release-candidate`: This branch is used to freeze the code from the `dev` branch, so we can deploy in our test servers and exercise the code extensively before deploying in our main system. Code freezes typically occur one week before the scheduled deployment. Check our [milestones page](https://github.com/biocore/qiita/milestones) to see the scheduled deployments.
27
+
28
+
### The Qiita development rules
21
29
22
30
Since Qiita is a package that is continuously growing, we found ourselves in a position where development rules needed to be established so we can reduce both development and reviewer time. These rules are:
23
31
@@ -46,7 +54,7 @@ Since Qiita is a package that is continuously growing, we found ourselves in a p
46
54
9. Last but not least, you are working as part of a team and you should try to help others when possible.
47
55
48
56
49
-
###Configuration file
57
+
###Configuration file
50
58
51
59
The Qiita configuration file determines how the package interacts with your system’s resources (redis, postgres and the IPython cluster). Thus you should review the documentation detailed [here](https://docs.google.com/document/d/1u7kwLP31NM513-8xwpwvLbSQxYu0ehI6Jau1APR13e0/edit#), but especially bear in mind the following points:
52
60
@@ -55,21 +63,21 @@ The Qiita configuration file determines how the package interacts with your syst
55
63
56
64
**A note on data accumulation**: Qiita keeps data in the `BASE_DATA_DIR` as the system gets used. When you drop a Qiita environment and create a fresh testing environment, the “old” data that was generated from the previous environment should be **manually** deleted (or, at least, removed from the data directories in the `BASE_DATA_DIR`).
57
65
58
-
###Unit tests
66
+
###Unit tests
59
67
60
68
Unit tests in Qiita are located inside the tests/test folder of every sub-module, for example `qiita_db/test/test_metadata_template.py`. These can be executed on a per-file basis or using `nosetests` from the base directory.
61
69
62
70
During test creation make sure the test class is decorated with `@qiita_test_checker()` if database modifications are done during tests. This will automatically drop and rebuild the qiita schema after the entire test class has been executed. This requires to all the tests in a single class be independent of each other, so stochastic failures do not occur due to different test order execution.
63
71
64
72
Coverage testing is in effect, so run tests using `nosetests --with-coverage [test_file.py]` to check what lines of new code in your pull request are not tested.
65
73
66
-
###Documentation
74
+
###Documentation
67
75
68
76
The documentation for Qiita is maintained as part of this repository, under the
69
77
`qiita_pet/support_files/doc` folder, for more information, see the README.md
70
78
file in `qiita_pet/support_files/doc/README.md`.
71
79
72
-
###Scripts
80
+
###Scripts
73
81
74
82
Scripts in Qiita are located inside the scripts directory, their actions will rely on the settings described in the Qiita config file, for example if you are dropping a database, the database that will be dropped is the one described by the `DATABASE` setting. The following is a list of the most commonly used commands during development:
75
83
@@ -79,16 +87,16 @@ Scripts in Qiita are located inside the scripts directory, their actions will re
79
87
*`qiita-env stop_cluster qiita-general`, terminates a cluster named ‘qiita-general’.
80
88
*`qiita pet webserver start`, will start the Qiita web-application running on port 21174, you can change this using the `--port` flag, for example `--port=7532`.
81
89
82
-
##Making Database Changes
90
+
##Making Database Changes
83
91
After the initial production release of Qiita, changes to the database schema will require patches; the database can no longer be dropped and recreated using the most recent schema because all the data would be lost! Therefore, patches must be applied instead.
84
92
85
-
###Approach
93
+
###Approach
86
94
87
95
1. We keep "unpatched" versions of the SQL and DBS files in the repository
88
96
2. We keep fully patched versions of the DBS and HTML files in the repository
89
97
3. We keep a patch file for each patch as required in the `qiita_db/support_files/patches` directory. Note that **the patches will be applied in order based on the natural sort order of their filename** (e.g., `2.sql` will be applied before `10.sql`, and `10.sql` will be applied before `a.sql`)
90
98
91
-
###Developer Workflow
99
+
###Developer Workflow
92
100
93
101
1. Load the fully patched DBS file (e.g., `qiita-db.dbs`) in [DBSchema](http://www.dbschema.com/)
94
102
2. Make desired changes
@@ -101,17 +109,17 @@ After the initial production release of Qiita, changes to the database schema wi
101
109
102
110
One drawback is that developers will need to have [DBSchema](http://www.dbschema.com/) to develop for this project.
103
111
104
-
###Data Patches
112
+
###Data Patches
105
113
106
114
If you need to submit a patch that changes only data but does not alter the schema, you should still create a patch file with the next name (e.g., `2.sql`) with your changes. Note that a patch should *not* be created if the modifications do not apply to Qiita databases in general; data patches are only necessary in some cases, e.g., if the terms in an ontology change.
107
115
108
-
###Python Patches
116
+
###Python Patches
109
117
110
118
Occasionally, SQL alone cannot effect the desired changes, and a corresponding python script must be run after the SQL patch is applied. If this is the case, a python file should be created in the `patches/python_patches` directory, and it should have the same basename as the SQL file. For example, if there is a patch `4.sql` in the `patches` directory, and this patch requires a python script be run after the SQL is applied, then the python file should be placed at `patches/python_patches/4.py`. Note that not every SQL patch will have a corresponding python patch, but every python patch will have a corresponding SQL patch.
111
119
112
120
If in the future we discover a use-case where a python patch must be applied for which there *is no corresponding SQL patch*, then a blank SQL patch file will still need to be created.
113
121
114
-
##SQL coding guidelines
122
+
##SQL coding guidelines
115
123
Since the `qiita_db` code contains a mixture of python code and SQL code, here are some coding guidelines to add SQL code to Qiita:
0 commit comments