8000 Updated set up instructions (#266) · james1ewis/firebase-admin-python@32c34c6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 32c34c6

Browse files
authored
Updated set up instructions (firebase#266)
1 parent f4b9c8e commit 32c34c6

File tree

1 file changed

+28
-10
lines changed

1 file changed

+28
-10
lines changed

CONTRIBUTING.md

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ information on using pull requests.
8585

8686
### Initial Setup
8787

88+
You need Python 2.7 or Python 3.4+ to build and test the code in this repo.
89+
8890
We recommend using [pip](https://pypi.python.org/pypi/pip) for installing the necessary tools and
8991
project dependencies. Most recent versions of Python ship with pip. If your development environment
9092
does not already have pip, use the software package manager of your platform (e.g. apt-get, brew)
@@ -120,7 +122,7 @@ pass `all` as an argument.
120122

121123
```
122124
./lint.sh # Lint locally modified source files
123-
./lint.sh all # Lint all source files
125+
./lint.sh all # Lint all source files
124126
```
125127

126128
Ideally you should not see any pylint errors or warnings when you run the
@@ -167,36 +169,52 @@ do not already have one suitable for running the tests aginst. Then obtain the
167169
following credentials from the project:
168170

169171
1. *Service account certificate*: This can be downloaded as a JSON file from
170-
the "Settings > Service Accounts" tab of the Firebase console.
172+
the "Settings > Service Accounts" tab of the Firebase console. Copy the
173+
file into the repo so it's available at `scripts/cert.json`.
171174
2. *Web API key*: This is displayed in the "Settings > General" tab of the
172-
console. Copy it and save to a new text file.
175+
console. Copy it and save to a new text file at `scripts/apikey.txt`.
176+
177+
Then set up your Firebase/GCP project as follows:
178+
179+
1. Enable Firestore: Go to the Firebase Console, and select "Database" from
180+
the "Develop" menu. Click on the "Create database" button. You may choose
181+
to set up Firestore either in the locked mode or in the test mode.
182+
2. Enable password auth: Select "Authentication" from the "Develop" menu in
183+
Firebase Console. Select the "Sign-in method" tab, and enable the
184+
"Email/Password" sign-in method.
185+
3. Enable the IAM API: Go to the
186+
[Google Cloud Platform Console](https://console.cloud.google.com) and make
187+
sure your Firebase/GCP project is selected. Select "APIs & Services >
188+
Dashboard" from the main menu, and click the "ENABLE APIS AND SERVICES"
189+
button. Search for and enable the "Identity and Access Management (IAM)
190+
API".
173191

174192
Now you can invoke the integration test suite as follows:
175193

176194
```
177-
pytest integration/ --cert path/to/service_acct.json --apikey path/to/apikey.txt
195+
pytest integration/ --cert scripts/cert.json --apikey scripts/apikey.txt
178196
```
179197

180198
### Test Coverage
181199

182-
To review the test coverage, run `pytest` with the `--cov` flag. To view a detailed line by line
183-
coverage, use
200+
To review the test coverage, run `pytest` with the `--cov` flag. To view a detailed line by line
201+
coverage, use
184202
```bash
185203
pytest --cov --cov-report html
186204
```
187-
and point your browser to
205+
and point your browser to
188206
`file:///<dir>/htmlcov/index.html` (where `dir` is the location from which the report was created).
189207

190208

191209
### Testing in Different Environments
192210

193211
Sometimes we want to run unit tests in multiple environments (e.g. different Python versions), and
194-
ensure that the SDK works as expected in each of them. We use
195-
[tox](https://tox.readthedocs.io/en/latest/) for this purpose.
212+
ensure that the SDK works as expected in each of them. We use
213+
[tox](https://tox.readthedocs.io/en/latest/) for this purpose.
196214

197215
But before you can invoke tox, you must set up all the necessary target environments on your
198216
workstation. The easiest and cleanest way to achieve this is by using a tool like
199-
[pyenv](https://github.com/pyenv/pyenv). Refer to the
217+
[pyenv](https://github.com/pyenv/pyenv). Refer to the
200218
[pyenv documentation](https://github.com/pyenv/pyenv#installation) for instructions on how to
201219
install it. This generally involves installing some binaries as well as modifying a system level
202220
configuration file such as `.bash_profile`. Once pyenv is installed, you can install multiple

0 commit comments

Comments
 (0)
0