python small tools for CI and team cooperation
-
Upload
chien-hsun-chen -
Category
Software
-
view
398 -
download
3
Transcript of python small tools for CI and team cooperation
協同開發的補助工具4 H R 開發小工具
WHO AM I
• GliaCloud founder• 社群好朋友• Google Cloud Developer Expert
• 最近利用有空時寫了一些小工具– 但又要沒時間了 T__T
AUTO REQUIREMENT
• https://github.com/lucemia/autoreq• DEMO
autoreq --in-place -r ./
No versionNo despHard to maintain
Auto add version if not specifyAuto add description
A tool that automatically formats requirements
https://pypi.python.org/pypi/DjangoPackage list
Package Detailhttps://pypi.python.org/pypi/autoreq
RequestsPandasBeautifulSoup
AUTOREQ -Husage: autoreq [-h] [--version] [-v] [-d] [-i] [-r] [-j n] [--exclude globs] [files [files ...]]
positional arguments: files files to format or '-' for standard in
optional arguments: -h, --help show this help message and exit --version show program's version number and exit -v, --verbose print verbose messages; multiple -v result in more verbose
messages -d, --diff print the diff for the fixed source -i, --in-place make changes to files in place -r, --recursive run recursively over directories; must be used with –in-place or --
diff -j n, --jobs n number of parallel jobs; match CPU count if value is less than 1 --exclude globs exclude file/directory names that match these comma-separated
globs
AUTOCOV • Generate Coverage report• Integrate with CI• Hook with github Status Check• Store report to github page
A tool that automatically generate coverage report and save to github page
Autocov –percent=30
AUTOCOV• https://github.com/lucemia/autocov• DEMO
– https://github.com/livingbio/op/pull/151– https://github.com/livingbio/op/blob/master/.travis.yml
AUTOCOV -H
usage: autocov [-h] [--user USER] [--token TOKEN] [--percent PERCENT]
optional arguments: -h, --help show this help message and exit --user USER the github user --token TOKEN the github token --percent PERCENT the coverage percent requirement (optional)
FLAKE8 / AUTOPEP8
Flake8 ./flake8 --ignore=E501 ./Flake8 –ignore=E501,F401
the modular source code checker: pep8, pyflakes and co
Flake8 is a wrapper around these tools:PyFlakes / pep8 / Ned Batchelder’s McCabe script
FLAKE8 -H
Tox.ini[flake8]ignore = E501,F401,F841,F403
SAMPLE COOP
• https://github.com/pycontw/pycontw2016
https://github.com/pycontw/pycontw2016
LIFE CYCLE
Coding
Testing
Deployment
Execution
Coding
Testing
Deployment
Execution
Automation
ISSUES, BRANCH, PULL REQUEST, AND CODE REVIEW• Sample:
– https://github.com/pycontw/pycontw2016/pull/139
• Git Squash or not?– https://github.com/GoogleCloudPlatform/gcloud-python/commits/master– https://github.com/GoogleCloudPlatform/gcloud-python/pulse
TRAVIS
• A contineous Integration (CI) service– Define different enviornment and run the test– https://github.com/pycontw/pycontw2016/blob/master/.travis.yml
• Coverage Report, Notification, Deployment– https://codecov.io/github/pycontw/pycontw2016?
ref=a14411637a2047c6ef248945aeb3bb5f5b2a44b4