{ "info": { "author": "Declan Keyes-Bevan", "author_email": "declankeyesbevan@users.noreply.github.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Build Tools" ], "description": "# Py Dev Hammer\n\n:snake: :nerd_face: :hammer: \nWhen all you have is a hammer, everything looks like a dev.\n\n## About\nPy Dev Hammer is a collection of tools to help in developing Python applications. \n\nThis pre-alpha release contains a single tool. It is a Continuous Integration helper which performs\ndynamic and static code analysis on your project and POSTs the results to GitHub as statuses.\n\nSee [road map](#road-map) for further release plans. The first item is to use AWS CloudFormation to\nmake most of this document redundant. As the project progresses this README will reference other\nREADMEs instead of detailing everything.\n\n## Requires\n\n python3.6\n\n## Prerequisites\nNote: this guide attempts to keep specific references to third-party tools to a minimum as they are\nvery likely to change. Use your intuition and please get in\n[contact](https://www.declankeyesbevan.com/contact) if there are glaring problems and/or you want to\nbuy me a beer. The latter is recommended.\n\n### GitHub\nTo enable Continuous Integration of your commits, GitHub communicates with AWS CodeBuild via\n[Webhooks](https://help.github.com/articles/about-webhooks/). For ease of use you can set this up in\nthe [GitHub UI](https://developer.github.com/webhooks/creating/#setting-up-a-webhook) rather than\nusing the API. The following options should be used:\n\n- Payload URL: `https://codebuild.{your-aws-region}.amazonaws.com/webhooks`\n- Content type: `application/json`\n- Secret: [Create a secure secret](https://developer.github.com/webhooks/securing/)\n- SSL verification: `Enable`\n- Which events would you like to trigger this webhook?: `Just the push event.`\n- Active: `Ticked`\n\nYou will link CodeBuild to GitHub [next](#codebuild).\n\n### AWS\n#### CodeBuild\nYou must\n[configure your build](https://docs.aws.amazon.com/codebuild/latest/userguide/create-project.html)\nto integrate with GitHub. For the `Source provider` option choose GitHub then `Connect to GitHub`.\nFollow the authentication path then pick the source repository.\n\nThe following options should be used:\n- Report build status: `Ticked`\n- Webhook: `Ticked`\n- Branch filter: `Leave blank` (Build them all!)\n- Build Badge: `Ticked`\n- Build specification: `Use the buildspec.yml in the source code root directory`\n- Buildspec name: `buildspec.yml`\n- Service role: `Create a service role in your account`\n\n#### DynamoDB\nTo maintain the state of multiple builds, a [DynamoDB table](\nhttps://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.html)\nwith a partition and sort key needs to be created. The [example app file](#app) uses the following\nvalues:\n\n dynamo:\n table_name: 'build-status'\n partition_key_name: 'branch_name'\n sort_key_name: 'build_start_time'\n\nThe primary partition key is a `String` and the primary sort key is a `Number`.\n\n#### Systems Manager (SSM)\nTo POST to GitHub a `github_owner` and `github_token` are [required](#github). These are to\nbe kept in the [AWS Systems Manager Parameter Store](\nhttps://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-paramstore.html)\nas type `SecureString`.\n\n#### IAM\nYou will be creating an IAM service role when configuring [CodeBuild](#codebuild).\n\n### Config\nTwo configuration files are required for the scripts: `app` and `user`. Examples are located at\n[`examples/app_config.example.yml`](examples/app_config.example.yml) and\n[`examples/user_config.example.yml`](examples/user_config.example.yml).\n\n#### App\nThe example app config can be copied and used as is, however you may want to remove some of the test\ntypes under `tests_to_run` and note that your [`buildspec.yml`](#usage) will need to be adjusted to\nmatch. \n\n#### User\nThe example user config should be modified to suit your GitHub and AWS project details.\n\n### Certificates\nTo POST securely to GitHub (as you are sending your GitHub token over the Internet) a certificate\nmust be used. Pass your file path as an environment variable `CERTIFICATE_FILE`. Alternatively you\ncan use the third-party Python module [certifi](https://pypi.org/project/certifi/) to generate this.\nThe script will look for the environment variable first and fall back to using `certifi.where()`.\n\n### Environment variables\nA number of environment variables must be set for the CodeBuild environment via the\n[`buildspec.yml`](#usage) file.\n\nThis variable is set automatically by AWS CodeBuild:\n - CODEBUILD_SRC_DIR\n\nThese variables are used by the scripts of this project: \n(Note: the back-ticks are important as this is BASH-land)\n- PYTHONPATH=`` `pwd` ``\n- CONFIG_DIR=`/path/to/your/config/dir`\n- CERTIFICATE_FILE=`/path/to/your/cert.file` (Note: [optional](#certificates))\n- CODEBUILD_GIT_BRANCH=`` `git branch -a --contains HEAD | sed -n 2p | awk '{ printf $1 }'` `` \n(Note: deprecation warning; will be sourced from within Python in future releases)\n\nThis variable is used by CodeBuild:\n- TESTS_DIR=`$CODEBUILD_SRC_DIR/path/to/your/tests/results/dir` \n(Note: this is the test directory for your project, not this project)\n\n## Installation\n`pip install pydevhammer`\n\n## Usage\nCreate a Python file to run the scripts from the command line via `buildspec.yml`. An example file\ncan be found in [`examples/run_github_status_posting.py`](examples/run_github_status_posting.py).\n\nTo use CodeBuild with the above [AWS config](#codebuild), you will need to create a `buildspec.yml`\nfile. An example file is located in [`examples/buildspec.yml`](examples/buildspec.yml). The `build`\nsection of that file is where you will call the [`tests_to_run`](#app).\n\n## Road Map\n- Set up all AWS resources with CloudFormation (who wants to read this README?)\n- reStructuredText to Markdown converter (mostly already written)\n- Visualisation of the toolkit with dashboards (need more tools in the old toolkit first)\n- Dockerising things (that should be Dockerised)\n- Monitoring (comings and goings of electrons)\n- Other cool things I'm sure (fingers crossed)", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/declankeyesbevan/py-dev-hammer", "keywords": "github aws codebuild continuous-integration dev-tools", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pydevhammer", "package_url": "https://pypi.org/project/pydevhammer/", "platform": "", "project_url": "https://pypi.org/project/pydevhammer/", "project_urls": { "Documentation": "https://github.com/declankeyesbevan/py-dev-hammer/docs", "Homepage": "https://github.com/declankeyesbevan/py-dev-hammer", "Issues": "https://github.com/declankeyesbevan/py-dev-hammer/issues", "Source": "https://github.com/declankeyesbevan/py-dev-hammer" }, "release_url": "https://pypi.org/project/pydevhammer/0.1.1/", "requires_dist": null, "requires_python": "~=3.6", "summary": "Python development tools using AWS and GitHub", "version": "0.1.1" }, "last_serial": 4430724, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "85438e7ee7d5dd3dd42cd8d3c1c5279e", "sha256": "a0edf70dfd34916e6a11831f56c4d3351a80eace6ff18c68e245763741c0b2cc" }, "downloads": -1, "filename": "pydevhammer-0.1.0.tar.gz", "has_sig": false, "md5_digest": "85438e7ee7d5dd3dd42cd8d3c1c5279e", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.6", "size": 15368, "upload_time": "2018-08-20T11:44:58", "url": "https://files.pythonhosted.org/packages/ef/13/438e10eb6b8c4232a861646da8d02ea7c02dae91e390f31b480766255ed0/pydevhammer-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "d7f60c03292c476f1808700f2f061841", "sha256": "672aa327c28c0161a7f62f8a0f7825640021d0374317cee09d8a046d1962ab6a" }, "downloads": -1, "filename": "pydevhammer-0.1.1.tar.gz", "has_sig": false, "md5_digest": "d7f60c03292c476f1808700f2f061841", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.6", "size": 16647, "upload_time": "2018-10-30T09:09:24", "url": "https://files.pythonhosted.org/packages/61/16/223f6cce6bca28af0c4a7ef9cbad523a96038f456b10a6fd9ab30268c025/pydevhammer-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d7f60c03292c476f1808700f2f061841", "sha256": "672aa327c28c0161a7f62f8a0f7825640021d0374317cee09d8a046d1962ab6a" }, "downloads": -1, "filename": "pydevhammer-0.1.1.tar.gz", "has_sig": false, "md5_digest": "d7f60c03292c476f1808700f2f061841", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.6", "size": 16647, "upload_time": "2018-10-30T09:09:24", "url": "https://files.pythonhosted.org/packages/61/16/223f6cce6bca28af0c4a7ef9cbad523a96038f456b10a6fd9ab30268c025/pydevhammer-0.1.1.tar.gz" } ] }