-
Notifications
You must be signed in to change notification settings - Fork 28
Update readme #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Update readme #84
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ef37cb4
Update readme.
taeold 0f696c9
Add contributing guide, set preview status.
taeold 97fb1a8
Fix code sample.
taeold 586436e
Update links.
taeold 70a336d
Add dev setup guide.
taeold 0e55d1b
Fix heading.
taeold e2a7691
Fix typo.
taeold File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# How to contribute | ||
|
||
We'd love to accept your patches and contributions to this project. There are | ||
just a few small guidelines you need to follow. | ||
|
||
## Contributor License Agreement | ||
|
||
Contributions to this project must be accompanied by a Contributor License | ||
Agreement. You (or your employer) retain the copyright to your contribution, | ||
this simply gives us permission to use and redistribute your contributions as | ||
part of the project. Head over to <https://cla.developers.google.com/> to see | ||
your current agreements on file or to sign a new one. | ||
|
||
You generally only need to submit a CLA once, so if you've already submitted one | ||
(even if it was for a different project), you probably don't need to do it | ||
again. | ||
|
||
## Code reviews | ||
|
||
All submissions, including submissions by project members, require review. We | ||
use GitHub pull requests for this purpose. Consult [GitHub Help] for more | ||
information on using pull requests. | ||
|
||
## Setup local environment | ||
|
||
Clone the project and run the following commands to setup your environment | ||
|
||
```sh | ||
python3.11 -m venv venv | ||
source venv/bin/activate | ||
pip3 install --upgrade pip | ||
python3.11 -m pip install -e ".[dev]" | ||
``` | ||
|
||
(this also applies to setting up samples environment for each sample) | ||
|
||
### Running tests | ||
|
||
Without coverage: | ||
```bash | ||
python3.11 -m pytest | ||
``` | ||
|
||
With coverage: | ||
```bash | ||
python3.11 -m pytest --cov=src --cov-report term --cov-report html --cov-report xml -vv | ||
``` | ||
|
||
### Formatting code | ||
|
||
```bash | ||
yapf -i -r -p . | ||
``` | ||
|
||
### Running lints & type checking | ||
|
||
```bash | ||
# Type checking | ||
python3.11 -m mypy . | ||
# Linting | ||
python3.11 -m pylint $(git ls-files '*.py') | ||
``` | ||
|
||
### Generating Docs | ||
|
||
Prerequisites: | ||
- On OSX, install getopt: | ||
- `brew install gnu-getopt` | ||
|
||
```sh | ||
./docs/generate.sh --out=./docs/build/ --pypath=src/ | ||
``` | ||
|
||
### Deploying a sample for testing | ||
|
||
Example: | ||
|
||
```sh | ||
cd samples/basic_https | ||
firebase deploy --only=functions | ||
``` | ||
|
||
Note to test your local changes of `firebase-functions` when deploying you should push your changes to a branch on GitHub and then locally in the `sample/*/requirements.txt` change `firebase-functions` dependency line to instead come from git, e.g. : | ||
|
||
``` | ||
git+https://github.com/YOUR_USERNAME/firebase-functions-python.git@YOURBRANCH#egg=firebase-functions | ||
``` | ||
|
||
[github help]: https://help.github.com/articles/about-pull-requests/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,39 @@ | ||
# Firebase Functions Python SDK | ||
# Cloud Functions for Firebase Python SDK (Public Preview) | ||
|
||
Welcome GitHub lurker! This repository is a work in progress. It will eventually let users create Cloud Functions for Firebase in Python. This feature is under very early development and not ready for testing. When it is ready, you can get first access by signing up for the [Firebase Alpha Program](https://services.google.cn/fb/forms/firebasealphaprogram/). | ||
The [`firebase-functions`](https://pypi.org/project/firebase-functions/) package provides an SDK for defining Cloud Functions for Firebase in Python. | ||
|
||
While you wait for us to get this feature ready for the public, we'd really appreciate you not blowing this up. Let's keep things on the down low for now. 🤫 | ||
Cloud Functions provides hosted, private, and scalable environment where you can run server code. The Firebase SDK for Cloud Functions integrates the Firebase platform by letting you write code that responds to events and invokes functionality exposed by other Firebase features. | ||
|
||
## Learn more | ||
|
||
Learn more about the Firebase SDK for Cloud Functions in the [Firebase documentation](https://firebase.google.com/docs/functions/) or [check out our samples](https://github.com/firebase/functions-samples). | ||
|
||
Here are some resources to get help: | ||
|
||
- Start with the quickstart: https://firebase.google.com/docs/functions/get-started | ||
- Go through the guide: https://firebase.google.com/docs/functions/ | ||
- Read the full API reference: https://firebase.google.com/docs/reference/functions/2nd-gen/python | ||
- Browse some examples: https://github.com/firebase/functions-samples | ||
|
||
If the official documentation doesn't help, try asking through our official support channels: https://firebase.google.com/support/ | ||
|
||
## Usage | ||
|
||
```python | ||
# functions/main.py | ||
from firebase_functions import db_fn | ||
from notify_users import api | ||
|
||
@db_fn.on_value_created(reference="/posts/{post_id}") | ||
def new_post(event): | ||
print(f"Received new post with ID: {event.params.get('post_id')}") | ||
taeold marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return notifyUsers(event.data) | ||
``` | ||
|
||
## Contributing | ||
|
||
To contribute a change, [check out the contributing guide](.github/CONTRIBUTING.md). | ||
|
||
## License | ||
|
||
© Google, 2023. Licensed under [Apache License](LICENSE). |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.