|
1 |
| -Contributing |
2 |
| -============================ |
| 1 | +# Contributing |
3 | 2 |
|
4 | 3 | - **Please sign one of the contributor license agreements below.**
|
5 | 4 | - Fork the repo, develop and test your code changes, add docs.
|
6 | 5 | - Make sure that your commit messages clearly describe the changes.
|
7 | 6 | - Send a pull request.
|
8 | 7 |
|
9 |
| -Here are some guidelines for hacking on `ndb`. |
| 8 | +## Getting Started |
10 | 9 |
|
11 |
| -Using a Development Checkout |
12 |
| ----------------------------- |
| 10 | +You need to separately download and install the App Engine SDK. |
13 | 11 |
|
14 |
| -You'll have to create a development environment to hack on `ndb`, |
15 |
| -using a Git checkout: |
| 12 | +Note: There is no guarantee older versions of the App Engine SDK will |
| 13 | +work with the current version of ndb. |
16 | 14 |
|
17 |
| -- While logged into your GitHub account, navigate to the `ndb` repo on |
18 |
| -GitHub. |
| 15 | +You can setup your environment by running: |
19 | 16 |
|
20 |
| -``` |
21 |
| -https://github.com/pcostell/appengine-ndb-experiment |
22 |
| -``` |
| 17 | + gcloud components update app-engine-python |
| 18 | + export GAE=$GCLOUD_PATH/platform/google_appengine |
23 | 19 |
|
24 |
| -- Fork and clone the `ndb` repository to your GitHub account by |
25 |
| -clicking the "Fork" button. |
| 20 | +If you haven't downloaded `gcloud` yet, you can find it and instructions |
| 21 | +about using it on the [Cloud SDK page][1]. |
26 | 22 |
|
27 |
| -- Clone your fork of `ndb` from your GitHub account to your local |
28 |
| -computer, substituting your account username and specifying the destination |
29 |
| -as `hack-on-ndb`. For example: |
| 23 | +## Code Structure |
30 | 24 |
|
31 |
| -``` |
32 |
| -$ cd ~ |
33 |
| -$ git clone [email protected]:USERNAME/appengine-ndb-experiment.git hack-on-ndb |
34 |
| -$ cd hack-on-ndb |
35 |
| -# Configure remotes such that you can pull changes from the ndb-git |
36 |
| -# repository into your local repository. |
37 |
| -$ git remote add upstream https://github.com:pcostell/appengine-ndb-experiment |
38 |
| -# fetch and merge changes from upstream into master |
39 |
| -$ git fetch upstream |
40 |
| -$ git merge upstream/master |
41 |
| -``` |
| 25 | +The code is structured into four subdirectories: |
42 | 26 |
|
43 |
| -Now your local repo is set up such that you will push changes to your GitHub |
44 |
| -repo, from which you can submit a pull request. |
| 27 | +- ndb: This is the main code base. Notable submodules are |
| 28 | + key.py, model.py, query.py, eventloop.py, tasklets.py, and context.py. |
| 29 | + For each module foo.py there's a corresponding foo_test.py which |
| 30 | + contains unit tests for that module. |
| 31 | +- demo: This is where demo programs live. Check out guestbook.py and |
| 32 | + main.py. |
| 33 | +- samples: This is where sample code lives. |
| 34 | +- tests: This is where additional ndb tests live. |
45 | 35 |
|
46 |
| -- Create a virtualenv in which to install `ndb`: |
| 36 | +The main directory contains some scripts and auxiliary files. |
47 | 37 |
|
48 |
| -``` |
49 |
| -$ cd ~/hack-on-ndb |
50 |
| -$ virtualenv -ppython2.7 env |
51 |
| -``` |
| 38 | +## Working on ndb |
52 | 39 |
|
53 |
| -Note that very old versions of `virtualenv` (versions below, say, |
54 |
| - 1.10 or thereabouts) require you to pass a `--no-site-packages` flag to |
55 |
| - get a completely isolated environment. |
| 40 | +We accept contributions, so if you see something wrong file an issue or |
| 41 | +send us a pull request! |
56 | 42 |
|
57 |
| - You can choose which Python version you want to use by passing a `-p` |
58 |
| - flag to `virtualenv`. For example, `virtualenv -ppython2.7` |
59 |
| - chooses the Python 2.7 interpreter to be installed. |
| 43 | +Note: Because this library is included in the App Engine python runtime, |
| 44 | +we currently cannot accept any changes that break our existing API |
| 45 | +(for now). Additionally, there are restrictions on adding any extra |
| 46 | +third party dependencies. |
60 | 47 |
|
61 |
| - From here on in within these instructions, the `~/hack-on-ndb/env` |
62 |
| - virtual environment you created above will be referred to as `${VENV}`. |
63 |
| - To use the instructions in the steps that follow literally, use the |
| 48 | +### Running Tests |
64 | 49 |
|
65 |
| - ``` |
66 |
| - $ export VENV=~/hack-on-ndb/env |
67 |
| - ``` |
| 50 | +Tests can be run using tox. |
68 | 51 |
|
69 |
| - command. |
| 52 | + tox -e py27 |
70 | 53 |
|
71 |
| - - Install `ndb` from the checkout into the virtualenv using |
72 |
| - `setup.py develop`. Running `setup.py develop` **must** be done while |
73 |
| - the current working directory is the `ndb-git` checkout directory: |
| 54 | +Lint can also be run using tox. This will fire off two pylint commands, one |
| 55 | +for the main ndb library and one for the tests which have slightly relaxed |
| 56 | +requirements. |
74 | 57 |
|
75 |
| - ``` |
76 |
| - $ cd ~/hack-on-ndb |
77 |
| - $ ${VENV}/bin/python setup.py develop |
78 |
| - ``` |
| 58 | + tox -e lint |
79 | 59 |
|
80 |
| - Running Tests |
81 |
| - -------------- |
| 60 | +to run coverage tests, run |
82 | 61 |
|
83 |
| - - To run all tests for `ndb`, run |
84 |
| - |
85 |
| - ``` |
86 |
| - $ make runtests |
87 |
| - ``` |
88 |
| - |
89 |
| - - In order to install the App Engine SDK for Python, you can either |
90 |
| - [download][1] the source as a zip file. |
91 |
| - |
92 |
| - If you already have the [Google Cloud SDK][2] (`gcloud` CLI tool) |
93 |
| - installed, then you can install via: |
94 |
| - |
95 |
| - ``` |
96 |
| - $ gcloud components update gae-python |
97 |
| - ``` |
98 |
| - |
99 |
| - If the Google Cloud SDK installed in `${GOOGLE_CLOUD_SDK}`, |
100 |
| - then the App Engine SDK can be found in |
101 |
| - `${GOOGLE_CLOUD_SDK}/platform/google_appengine` (as of January 2014). |
102 |
| - |
103 |
| - Contributor License Agreements |
104 |
| - ------------------------------ |
| 62 | + tox -e cover |
105 | 63 |
|
| 64 | +## Contributor License Agreements |
| 65 | + |
106 | 66 | Before we can accept your pull requests you'll need to sign a Contributor
|
107 | 67 | License Agreement (CLA):
|
108 | 68 |
|
109 | 69 | - **If you are an individual writing original source code** and **you own the
|
110 |
| - intellectual property**, then you'll need to sign an [individual CLA][3]. |
| 70 | + intellectual property**, then you'll need to sign an [individual CLA][2]. |
111 | 71 | - **If you work for a company that wants to allow you to contribute your work**,
|
112 |
| - then you'll need to sign a [corporate CLA][4]. |
| 72 | + then you'll need to sign a [corporate CLA][3]. |
113 | 73 |
|
114 | 74 | You can sign these electronically (just scroll to the bottom). After that,
|
115 | 75 | we'll be able to accept your pull requests.
|
116 | 76 |
|
117 |
| - [1]: https://cloud.google.com/appengine/downloads |
118 |
| - [2]: https://cloud.google.com/sdk/ |
119 |
| - [3]: https://developers.google.com/open-source/cla/individual |
120 |
| - [4]: https://developers.google.com/open-source/cla/corporate |
| 77 | + [1]: https://cloud.google.com/sdk/ |
| 78 | + [2]: https://developers.google.com/open-source/cla/individual |
| 79 | + [3]: https://developers.google.com/open-source/cla/corporate |
0 commit comments