From ee483839acc8a30c7a93dd0e5d6c5b12952d6591 Mon Sep 17 00:00:00 2001 From: Sanath Kumar Ramesh Date: Wed, 7 Nov 2018 14:53:12 -0800 Subject: [PATCH] Creating a Python project structure --- .coveragerc | 6 + .flake8 | 3 + .github/ISSUE_TEMPLATE.md | 14 + .gitignore | 382 ++++++++++++++++++ .pylintrc | 363 +++++++++++++++++ CONTRIBUTING.md | 6 +- Makefile | 26 ++ NOTICE | 4 +- lambda_builders/__init__.py | 1 + .../builders}/dotnet-cli/README.md | 0 .../builders}/golang-cli/README.md | 0 .../builders}/nodejs-npm/README.md | 0 .../builders}/nodejs-npm/build.js | 0 .../builders}/python-pip/README.md | 0 .../builders}/python-pip/build.py | 0 lambda_builders/builders/python-pip/cli.py | 0 lambda_builders/cli/main.py | 6 + lambda_builders/lib/__init__.py | 0 requirements/base.txt | 0 requirements/dev.txt | 15 + setup.cfg | 2 + setup.py | 75 ++++ tests/integration/.gitkeep | 0 tests/unit/.gitkeep | 0 24 files changed, 898 insertions(+), 5 deletions(-) create mode 100644 .coveragerc create mode 100644 .flake8 create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .gitignore create mode 100644 .pylintrc create mode 100644 Makefile create mode 100644 lambda_builders/__init__.py rename {src => lambda_builders/builders}/dotnet-cli/README.md (100%) rename {src => lambda_builders/builders}/golang-cli/README.md (100%) rename {src => lambda_builders/builders}/nodejs-npm/README.md (100%) rename {src => lambda_builders/builders}/nodejs-npm/build.js (100%) rename {src => lambda_builders/builders}/python-pip/README.md (100%) rename {src => lambda_builders/builders}/python-pip/build.py (100%) create mode 100644 lambda_builders/builders/python-pip/cli.py create mode 100644 lambda_builders/cli/main.py create mode 100644 lambda_builders/lib/__init__.py create mode 100644 requirements/base.txt create mode 100644 requirements/dev.txt create mode 100644 setup.cfg create mode 100644 setup.py create mode 100644 tests/integration/.gitkeep create mode 100644 tests/unit/.gitkeep diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 000000000..e7df5c447 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,6 @@ +[run] +branch = True +[report] +exclude_lines = + pragma: no cover + raise NotImplementedError.* diff --git a/.flake8 b/.flake8 new file mode 100644 index 000000000..4f80f891a --- /dev/null +++ b/.flake8 @@ -0,0 +1,3 @@ +[flake8] +max-line-length = 120 +ignore = E126 diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..ecc9a3e27 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,14 @@ +**Description:** + + + +**Steps to reproduce the issue:** +1. +2. +3. + +**Observed result:** + +**Expected result:** + +**Additional environment details (Ex: Windows, Mac, Amazon Linux etc)** diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..566b969ba --- /dev/null +++ b/.gitignore @@ -0,0 +1,382 @@ + +# Created by https://www.gitignore.io/api/osx,node,macos,linux,python,windows,pycharm,intellij,sublimetext,visualstudiocode + +### Intellij ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/dictionaries +.idea + +# Sensitive or high-churn files: +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml + +# Gradle: +.idea/**/gradle.xml +.idea/**/libraries + +# CMake +cmake-build-debug/ + +# Mongo Explorer plugin: +.idea/**/mongoSettings.xml + +## File-based project format: +*.iws + +## Plugin-specific files: + +# IntelliJ +/out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Ruby plugin and RubyMine +/.rakeTasks + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +### Intellij Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +*.iml +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin +.idea/sonarlint + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### macOS ### +*.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Node ### +# Logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Typescript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + + +### OSX ### + +# Icon must end with two \r + +# Thumbnails + +# Files that might appear in the root of a volume + +# Directories potentially created on remote AFP share + +### PyCharm ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: + +# Sensitive or high-churn files: + +# Gradle: + +# CMake + +# Mongo Explorer plugin: + +## File-based project format: + +## Plugin-specific files: + +# IntelliJ + +# mpeltonen/sbt-idea plugin + +# JIRA plugin + +# Cursive Clojure plugin + +# Ruby plugin and RubyMine + +# Crashlytics plugin (for Android Studio and IntelliJ) + +### PyCharm Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +# *.iml +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +.pytest_cache/ +nosetests.xml +coverage.xml +*.cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +/target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule.* + +# SageMath parsed files +*.sage.py + +# Environments +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ + +### SublimeText ### +# cache files for sublime text +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache + +# workspace files are user-specific +*.sublime-workspace + +# project files should be checked into the repository, unless a significant +# proportion of contributors will probably not be using SublimeText +# *.sublime-project + +# sftp configuration file +sftp-config.json + +# Package control specific files +Package Control.last-run +Package Control.ca-list +Package Control.ca-bundle +Package Control.system-ca-bundle +Package Control.cache/ +Package Control.ca-certs/ +Package Control.merged-ca-bundle +Package Control.user-ca-bundle +oscrypto-ca-bundle.crt +bh_unicode_properties.cache + +# Sublime-github package stores a github token in this file +# https://packagecontrol.io/packages/sublime-github +GitHub.sublime-settings + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +.history + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + + +# End of https://www.gitignore.io/api/osx,node,macos,linux,python,windows,pycharm,intellij,sublimetext,visualstudiocode \ No newline at end of file diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 000000000..7103ae3f5 --- /dev/null +++ b/.pylintrc @@ -0,0 +1,363 @@ +[MASTER] + +# Specify a configuration file. +#rcfile= + +# Python code to execute, usually for sys.path manipulation such as +# pygtk.require(). +#init-hook= + +# Add files or directories to the blacklist. They should be base names, not +# paths. +ignore=compat.py + +# Pickle collected data for later comparisons. +persistent=yes + +# List of plugins (as comma separated values of python modules names) to load, +# usually to register additional checkers. +load-plugins= + +# Use multiple processes to speed up Pylint. +jobs=1 + +# Allow loading of arbitrary C extensions. Extensions are imported into the +# active Python interpreter and may run arbitrary code. +unsafe-load-any-extension=no + +# A comma-separated list of package or module names from where C extensions may +# be loaded. Extensions are loading into the active Python interpreter and may +# run arbitrary code +extension-pkg-whitelist= + +# Allow optimization of some AST trees. This will activate a peephole AST +# optimizer, which will apply various small optimizations. For instance, it can +# be used to obtain the result of joining multiple strings with the addition +# operator. Joining a lot of strings can lead to a maximum recursion error in +# Pylint and this flag can prevent that. It has one side effect, the resulting +# AST will be different than the one from reality. +optimize-ast=no + + +[MESSAGES CONTROL] + +# Only show warnings with the listed confidence levels. Leave empty to show +# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED +confidence= + +# Enable the message, report, category or checker with the given id(s). You can +# either give multiple identifier separated by comma (,) or put this option +# multiple time. See also the "--disable" option for examples. +#enable= + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifiers separated by comma (,) or put this +# option multiple times (only on the command line, not in the configuration +# file where it should appear only once).You can also use "--disable=all" to +# disable everything first and then reenable specific checks. For example, if +# you want to run only the similarities checker, you can use "--disable=all +# --enable=similarities". If you want to run only the classes checker, but have +# no Warning level messages displayed, use"--disable=all --enable=classes +# --disable=W" +disable=R0201,W0613,I0021,I0020,W1618,W1619,R0902,R0903,W0231,W0611,R0913,W0703,C0330,R0204,I0011,R0904,C0301 + + +[REPORTS] + +# Set the output format. Available formats are text, parseable, colorized, msvs +# (visual studio) and html. You can also give a reporter class, eg +# mypackage.mymodule.MyReporterClass. +output-format=text + +# Put messages in a separate file for each module / package specified on the +# command line instead of printing them on stdout. Reports (if any) will be +# written in a file name "pylint_global.[txt|html]". +files-output=no + +# Tells whether to display a full report or only the messages +reports=no + +# Python expression which should return a note less than 10 (10 is the highest +# note). You have access to the variables errors warning, statement which +# respectively contain the number of errors / warnings messages and the total +# number of statements analyzed. This is used by the global evaluation report +# (RP0004). +evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) + +# Template used to display messages. This is a python new-style format string +# used to format the message information. See doc for all details +#msg-template= + + +[BASIC] + +# List of builtins function names that should not be used, separated by a comma +bad-functions=apply,reduce + +# Good variable names which should always be accepted, separated by a comma +good-names=e,i,j,k,n,ex,Run,_ + +# Bad variable names which should always be refused, separated by a comma +bad-names=foo,bar,baz,toto,tutu,tata + +# Colon-delimited sets of names that determine each other's naming style when +# the name regexes allow several styles. +name-group= + +# Include a hint for the correct naming format with invalid-name +include-naming-hint=yes + +# Regular expression matching correct function names +function-rgx=[a-z_][a-z0-9_]{2,50}$ + +# Naming hint for function names +function-name-hint=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression matching correct variable names +variable-rgx=[a-z_][a-z0-9_]{0,50}$ + +# Naming hint for variable names +variable-name-hint=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression matching correct constant names +const-rgx=(([a-zA-Z_][a-zA-Z0-9_]*)|(__.*__))$ + +# Naming hint for constant names +const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$ + +# Regular expression matching correct attribute names +attr-rgx=[a-z_][a-z0-9_]{1,50}$ + +# Naming hint for attribute names +attr-name-hint=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression matching correct argument names +argument-rgx=[a-z_][a-z0-9_]{0,50}$ + +# Naming hint for argument names +argument-name-hint=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression matching correct class attribute names +class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ + +# Naming hint for class attribute names +class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ + +# Regular expression matching correct inline iteration names +inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ + +# Naming hint for inline iteration names +inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$ + +# Regular expression matching correct class names +class-rgx=[A-Z_][a-zA-Z0-9]+$ + +# Naming hint for class names +class-name-hint=[A-Z_][a-zA-Z0-9]+$ + +# Regular expression matching correct module names +module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ + +# Naming hint for module names +module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ + +# Regular expression matching correct method names +method-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Naming hint for method names +method-name-hint=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match function or class names that do +# not require a docstring. +no-docstring-rgx=.* + +# Minimum line length for functions/classes that require docstrings, shorter +# ones are exempt. +docstring-min-length=-1 + + +[FORMAT] + +# Maximum number of characters on a single line. +max-line-length=120 + +# Regexp for a line that is allowed to be longer than the limit. +ignore-long-lines=^\s*(# )??$ + +# Allow the body of an if to be on the same line as the test if there is no +# else. +single-line-if-stmt=no + +# List of optional constructs for which whitespace checking is disabled +no-space-check=trailing-comma,dict-separator + +# Maximum number of lines in a module +max-module-lines=1000 + +# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 +# tab). +indent-string=' ' + +# Number of spaces of indent required inside a hanging or continued line. +indent-after-paren=4 + +# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. +expected-line-ending-format= + + +[LOGGING] + +# Logging modules to check that the string format arguments are in logging +# function parameter format +logging-modules=logging + + +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +notes=FIXME,XXX + + +[SIMILARITIES] + +# Minimum lines number of a similarity. +min-similarity-lines=6 + +# Ignore comments when computing similarities. +ignore-comments=yes + +# Ignore docstrings when computing similarities. +ignore-docstrings=yes + +# Ignore imports when computing similarities. +ignore-imports=yes + + +[SPELLING] + +# Spelling dictionary name. Available dictionaries: none. To make it working +# install python-enchant package. +spelling-dict= + +# List of comma separated words that should not be checked. +spelling-ignore-words= + +# A path to a file that contains private dictionary; one word per line. +spelling-private-dict-file= + +# Tells whether to store unknown words to indicated private dictionary in +# --spelling-private-dict-file option instead of raising a message. +spelling-store-unknown-words=no + + +[TYPECHECK] + +# Tells whether missing members accessed in mixin class should be ignored. A +# mixin class is detected if its name ends with "mixin" (case insensitive). +ignore-mixin-members=yes + +# List of module names for which member attributes should not be checked +# (useful for modules/projects where namespaces are manipulated during runtime +# and thus existing member attributes cannot be deduced by static analysis +ignored-modules=six.moves + +# List of classes names for which member attributes should not be checked +# (useful for classes with attributes dynamically set). +ignored-classes=SQLObject + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E0201 when accessed. Python regular +# expressions are accepted. +generated-members=REQUEST,acl_users,aq_parent,objects,DoesNotExist,md5,sha1,sha224,sha256,sha384,sha512 + + +[VARIABLES] + +# Tells whether we should check for unused import in __init__ files. +init-import=no + +# A regular expression matching the name of dummy variables (i.e. expectedly +# not used). +dummy-variables-rgx=_|dummy|ignore + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid to define new builtins when possible. +additional-builtins= + +# List of strings which can identify a callback function by name. A callback +# name must start or end with one of those strings. +callbacks=cb_,_cb + + +[CLASSES] + +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__,__new__,setUp + +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls + +# List of valid names for the first argument in a metaclass class method. +valid-metaclass-classmethod-first-arg=mcs + +# List of member names, which should be excluded from the protected access +# warning. +exclude-protected=_asdict,_fields,_replace,_source,_make + + +[DESIGN] + +# Maximum number of arguments for function / method +max-args=5 + +# Argument names that match this expression will be ignored. Default to name +# with leading underscore +ignored-argument-names=_.* + +# Maximum number of locals for function / method body +max-locals=15 + +# Maximum number of return / yield for function / method body +max-returns=6 + +# Maximum number of branch for function / method body +max-branches=12 + +# Maximum number of statements in function / method body +max-statements=30 + +# Maximum number of parents for a class (see R0901). +max-parents=6 + +# Maximum number of attributes for a class (see R0902). +max-attributes=7 + +# Minimum number of public methods for a class (see R0903). +min-public-methods=0 + +# Maximum number of public methods for a class (see R0904). +max-public-methods=20 + + +[IMPORTS] + +# Deprecated modules which should not be used, separated by a comma +deprecated-modules=regsub,string,TERMIOS,Bastion,rexec,UserDict + +# Create a graph of every (i.e. internal and external) dependencies in the +# given file (report RP0402 must not be disabled) +import-graph= + +# Create a graph of external dependencies in the given file (report RP0402 must +# not be disabled) +ext-import-graph= + +# Create a graph of internal dependencies in the given file (report RP0402 must +# not be disabled) +int-import-graph= + +[EXCEPTIONS] + +# Exceptions that will emit a warning when being caught. Defaults to +# "Exception" +overgeneral-exceptions=Exception \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2d302d1c9..78def1fc1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,7 +11,7 @@ information to effectively respond to your bug report or contribution. We welcome you to use the GitHub issue tracker to report bugs or suggest features. -When filing an issue, please check [existing open](https://github.com/awslabs/PRIVATE-aws-lambda-builders/issues), or [recently closed](https://github.com/awslabs/PRIVATE-aws-lambda-builders/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), issues to make sure somebody else hasn't already +When filing an issue, please check [existing open](https://github.com/awslabs/aws-lambda-builders/issues), or [recently closed](https://github.com/awslabs/aws-lambda-builders/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), issues to make sure somebody else hasn't already reported the issue. Please try to include as much information as you can. Details like these are incredibly useful: * A reproducible test case or series of steps @@ -41,7 +41,7 @@ GitHub provides additional document on [forking a repository](https://help.githu ## Finding contributions to work on -Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/awslabs/PRIVATE-aws-lambda-builders/labels/help%20wanted) issues is a great place to start. +Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/awslabs/aws-lambda-builders/labels/help%20wanted) issues is a great place to start. ## Code of Conduct @@ -56,6 +56,6 @@ If you discover a potential security issue in this project we ask that you notif ## Licensing -See the [LICENSE](https://github.com/awslabs/PRIVATE-aws-lambda-builders/blob/master/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. +See the [LICENSE](https://github.com/awslabs/aws-lambda-builders/blob/master/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes. diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..c9849d44d --- /dev/null +++ b/Makefile @@ -0,0 +1,26 @@ +init: + LAMBDA_BUILDERS_DEV=1 pip install -e '.[dev]' + +test: + # Run unit tests + # Fail if coverage falls below 95% + pytest --cov lambda_builders --cov-report term-missing --cov-fail-under 95 tests/unit + +integ-test: + # Integration tests don't need code coverage + LAMBDA_BUILDERS_DEV=1 pytest tests/integration + +flake: + # Make sure code conforms to PEP8 standards + flake8 lambda_builders + flake8 tests/unit tests/integration + +lint: + # Liner performs static analysis to catch latent bugs + pylint --rcfile .pylintrc lambda_builders + +# Command to run everytime you make changes to verify everything works +dev: flake lint test + +# Verifications to run before sending a pull request +pr: init dev diff --git a/NOTICE b/NOTICE index db34be100..06e1c1af1 100644 --- a/NOTICE +++ b/NOTICE @@ -1,2 +1,2 @@ -PRIVATE AWS Lambda Builders -Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +AWS Lambda Builders +Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/lambda_builders/__init__.py b/lambda_builders/__init__.py new file mode 100644 index 000000000..b8023d8bc --- /dev/null +++ b/lambda_builders/__init__.py @@ -0,0 +1 @@ +__version__ = '0.0.1' diff --git a/src/dotnet-cli/README.md b/lambda_builders/builders/dotnet-cli/README.md similarity index 100% rename from src/dotnet-cli/README.md rename to lambda_builders/builders/dotnet-cli/README.md diff --git a/src/golang-cli/README.md b/lambda_builders/builders/golang-cli/README.md similarity index 100% rename from src/golang-cli/README.md rename to lambda_builders/builders/golang-cli/README.md diff --git a/src/nodejs-npm/README.md b/lambda_builders/builders/nodejs-npm/README.md similarity index 100% rename from src/nodejs-npm/README.md rename to lambda_builders/builders/nodejs-npm/README.md diff --git a/src/nodejs-npm/build.js b/lambda_builders/builders/nodejs-npm/build.js similarity index 100% rename from src/nodejs-npm/build.js rename to lambda_builders/builders/nodejs-npm/build.js diff --git a/src/python-pip/README.md b/lambda_builders/builders/python-pip/README.md similarity index 100% rename from src/python-pip/README.md rename to lambda_builders/builders/python-pip/README.md diff --git a/src/python-pip/build.py b/lambda_builders/builders/python-pip/build.py similarity index 100% rename from src/python-pip/build.py rename to lambda_builders/builders/python-pip/build.py diff --git a/lambda_builders/builders/python-pip/cli.py b/lambda_builders/builders/python-pip/cli.py new file mode 100644 index 000000000..e69de29bb diff --git a/lambda_builders/cli/main.py b/lambda_builders/cli/main.py new file mode 100644 index 000000000..ac1658c90 --- /dev/null +++ b/lambda_builders/cli/main.py @@ -0,0 +1,6 @@ + +def cli(): + """ + CLI Entry point + """ + pass diff --git a/lambda_builders/lib/__init__.py b/lambda_builders/lib/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/requirements/base.txt b/requirements/base.txt new file mode 100644 index 000000000..e69de29bb diff --git a/requirements/dev.txt b/requirements/dev.txt new file mode 100644 index 000000000..32722b16d --- /dev/null +++ b/requirements/dev.txt @@ -0,0 +1,15 @@ +coverage==4.3.4 +flake8==3.3.0 +tox==2.2.1 +pytest-cov==2.4.0 +pylint==1.7.2 + +# Test requirements +pytest==3.0.7 +py==1.4.33 +mock==2.0.0 +parameterized==0.6.1 +pathlib2==2.3.2; python_version<"3.4" +futures==3.2.0; python_version<"3.2.3" +# Py3.2 backport +backports.tempfile==1.0 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 000000000..b88034e41 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[metadata] +description-file = README.md diff --git a/setup.py b/setup.py new file mode 100644 index 000000000..8c5a7685a --- /dev/null +++ b/setup.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python + +import io +import re +import os +from setuptools import setup, find_packages + + +def read(*filenames, **kwargs): + encoding = kwargs.get('encoding', 'utf-8') + sep = kwargs.get('sep', os.linesep) + buf = [] + for filename in filenames: + with io.open(filename, encoding=encoding) as f: + buf.append(f.read()) + return sep.join(buf) + + +def read_requirements(req='base.txt'): + content = read(os.path.join('requirements', req)) + return [line for line in content.split(os.linesep) + if not line.strip().startswith('#')] + + +def read_version(): + content = read(os.path.join( + os.path.dirname(__file__), 'lambda_builders', '__init__.py')) + return re.search(r"__version__ = '([^']+)'", content).group(1) + + +cmd_name = "lambda-builders" +if os.getenv("LAMBDA_BUILDERS_DEV"): + # We are installing in a dev environment + cmd_name = "lambda-builders-dev" + +setup( + name='aws-lambda-builders', + version=read_version(), + description='Python library to compile, build & package AWS Lambda functions for several runtimes & framework', + long_description=read('README.md'), + author='Amazon Web Services', + author_email='aws-sam-developers@amazon.com', + url='https://github.com/awslabs/aws-lambda-builders', + license=read('LICENSE'), + packages=find_packages(exclude=('tests', 'docs')), + keywords="AWS Lambda Functions Building", + # Support Python 2.7 and 3.6 or greater + python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*', + entry_points={ + 'console_scripts': [ + '{}=lambda_builders.cli.main:cli'.format(cmd_name) + ] + }, + install_requires=read_requirements('base.txt'), + extras_require={ + 'dev': read_requirements('dev.txt') + }, + include_package_data=True, + classifiers=[ + 'Development Status :: 4 - Beta', + 'Environment :: Console', + 'Environment :: Other Environment', + 'Intended Audience :: Developers', + 'Intended Audience :: Information Technology', + 'License :: OSI Approved :: Apache Software License', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Topic :: Internet', + 'Topic :: Software Development :: Build Tools', + 'Topic :: Utilities', + ] +) \ No newline at end of file diff --git a/tests/integration/.gitkeep b/tests/integration/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/tests/unit/.gitkeep b/tests/unit/.gitkeep new file mode 100644 index 000000000..e69de29bb