Sprint 

gcloud-python

Learn

  • Github 
  • Contribution Process
    • CLA
    • Set Github
    • Read Issues
    • Code
    • Test
  • Coding & corroboration 
  • Try to Submit your first pull request

David Chen

gcloud-python

Python idiomatic client for Google Cloud Platform services.

Python idiomatic client for Google Cloud Platform services.

Python idiomatic client for Google Cloud Platform services.

Google API

RESTful like API

based on

google api client

+ google discovery service

Support all kind language

datastore.set_options(dataset=sys.argv[1])
req = datastore.BeginTransactionRequest()
resp = datastore.begin_transaction(req)
tx = resp.transaction
req = datastore.LookupRequest()
key = datastore.Key()
path = key.path_element.add()
path.kind = 'Trivia'
path.name = 'hgtg'
req.key.extend([key])
req.read_options.transaction = tx
resp = datastore.lookup(req)
req = datastore.CommitRequest()
req.transaction = tx
if resp.found:
    entity = resp.found[0].entity
else:
    entity = req.mutation.insert.add()
    entity.key.CopyFrom(key)
    prop = entity.property.add()
    prop.name = 'question'
    prop.value.string_value = 'Meaning of life?'
    prop = entity.property.add()
    prop.name = 'answer'
    prop.value.integer_value = 42
datastore.commit(req)

Python idiomatic client for Google Cloud Platform services.

dataset = demo.get_dataset()

toy = dataset.entity('Thing', '1')
toy.update({'name': 'Toy', 'updated': '2014-10-01'})

toy.save()

https://developers.google.com/apis-explorer/#s/datastore/v1beta1/

Why gcloud-python

有三名 google 工程師 mentor , 可以學習到很多流程與文化.

 

  • 文化比程式碼重要 
  • 學如何協同工作
    • Git, PR, CI, unit test, document, forum manner, open source contribution

專案困難度適中,本身剛開始,有很多東西可以做的, 很容易有 contribution

 

  • 熟悉 Google Cloud Platform
  • 知道 RESTful API

專案參與的人不多但活躍度很高,很容易可以收到 feedback

  • 大神很兇 很忙 
  • 很快就會被 review & merge
  • 真的有收 PR

 

  • 有人可以帶
  • ​很合適學生 & 初學者

gcloud-python

mini sprint

11月中

PyCon APAC 2015

Sponsorship Team

looking for Korean, Japanese, ... talents

Envirnoment 

Repo

1. star gcloud-python

2. watch gcloud-python

3. fork gcloud-python

Guideline of contribution

  • Signed Contributor License Agreements (CLA)
  • unittest
  • pep8
  • cov 100%
  • doc for new feature
  • windows / linux / python2.6 ~2.7

 

Roles

view Contributions

view pull requests

view commits

 

 

Design

  • Labels
  • Milestore
  • Design Doc

Issue & Pull requests

  1. create/choose a issues: can be bug / features
  2. create a branch for each issue
  3. happy coding
  4. use test case to prove it works / edit doc for feature
  5. submit a pull request / rebase if necessary
  6. discuss with repo master 
  7. back to 3 until repo master satisfy all the following:
    1. Coding style
    2. Test Case
    3. Doc
    4. Implementation
  8. Repo Master merge branch and close issues

 

不要塞一堆酷炫的功能 / dependency 進去

尤其是沒有測試/文件的時候, 這是小白的行為

Clone

install requirements

Testing

setup.py + nose + unittest2

git clone https://github.com/[your account]/gcloud-python.git
cd gcloud-python
python setup.py develop
sudo pip install six -U
sudo pip install unittest2
sudo pip install httplib2
sudo pip install oauth2client
sudo pip install protobuf
sudo pip install pycrypto
sudo pip install pyopenssl
sudo pip install pytz
sudo pip install nose
nosetests

sudo apt-get install libssl-dev
sudo apt-get install libffi-dev

install pip http://pip.readthedocs.org/en/latest/installing.html

use koding https://koding.com/

Code

Test your

Pull Request 

at lucemia/gcloud-python

Step by step

  • fork lucemia/gcloud-python
  • clone xxx/gcloud-python.git
  • create a branch test-xxx based on master
  • edit the readme, add your name and few words introduce yourself
  • commit your change
  • create a pull request to lucemia/gcloud-python
  • delete your branch
git branch sprint
git checkout sprint
nano README.rst
...

git add README.rst
git commit -m "my first commit"
git push origin sprint
git checkout master
git remote add lucemia \
https://github.com/lucemia/gcloud-python.git
git remote add google \
https://github.com/GoogleCloudPlatform/gcloud-python.git
git pull google master

Q & A

參與 open source 

需要什麼技巧?

Optional 

  • 溝通技巧
  • 團隊合作
  • 程式技巧

為什麼要做 Open Source?

Self motivation

Reputation

Peloton

Introduce Issues

implementation guideline in issues

#1 Cloud ORM (model)

  • 50% done (function)
  • lack of doc, unit test

#9 Creating a new datastore.entity with a key name is a pain

 

#10 storage.Key.get_contents_to_filename: sync mtime with 'updated' time from metadata

#8 GQL Support

#11 'Connection.lookup' can return 'missing' and 'deferred' results

#12, #13 BigQuery related

on roadmap,

not implemented yet

#3 TaskQueue

Happy Coding

Read docs

Find friends to discuss

Ask questions on github

 

chat room:

https://gitter.im/lucemia/gcloud-python

GCloug-python

By Chien-Hsun Chen

GCloug-python

  • 2,917