{ "info": { "author": "Paul Glass", "author_email": "pnglass@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "Overview\n--------\n\nThis is a CLI tool that can list open pull requests and post them somewhere,\nmainly Slack. This is useful to help a team stay on top of pull request\nreviews.\n\nIt is configurable, supports multiple publishers, and makes it easy to write\nyour own publishers.\n\n```bash\npip install pr-publisher\n```\n\nnote: This is NOT a bot, it is NOT a Slack plugin, and it does NOT support\nupdating pull requests in any way from the command line.\n\nPlease report any issues or feature requests [on Github](https://github.com/pglass/pr-publisher/issues)\n\nUsage\n-----\n\nThis installs a script called `pr-publisher`,\n\n```bash\npr-publisher --help\n```\n\nArguments are supplied with CLI options, or environment variables. See the\n`--help` output or below for available options.\n\n### Basic usage\n\nThe tool needs a Github personal access token with `repo` and `read:org` permissions.\n\n```\n[x] repo\n[ ] admin:org\n [ ] write:org\n [x] read:org\n```\n\n(note: It will try to read branch protection settings to determine the required\nchecks for the repository. I forget if an additional permission is required\nfor this)\n\nProvide the token either by CLI option, or environment variable.\n\n| Flag | Env Var | Example |\n| ----- | ----- | ----- |\n| `--github-org` | `GITHUB_ORG` | `pglbutt` |\n| `--github-token` | `GITHUB_TOKEN` | |\n| `--github-url` | `GITHUB_URL` | `https://github..com` |\n| `--include-wip` | | |\n| `--users` | | `pglass,hotpie` |\n| `--approvals-needed` | | `2` |\n| `--show-labels` | | |\n\nCurrently, the Github organization is required. Open pull requests will be\ndiscovered from all repositories in the org. Optionally, that list can be\nfiltered down to those owned by specific Github usernames.\n\nGithub enterprise is supported. Just provide your Github enterprise url with\nthe `--github-url` (however, I have not tested 2fa).\n\n```bash\n### Using flags\npr-publisher --github-org my-org --github-token table slack\n```\n\n```bash\n### Using environment variables\nexport GITHUB_TOKEN=\nexport GITHUB_ORG=my-org\npr-publisher --users pglass,hotpie table slack\n```\n\nBy default, PRs with titles that contain \"wip\" (case-insensitive) are ignored.\nUse the `--include-wip` flag if you wish to include those.\n\n### Publishers\n\nThe script accepts a list of publisher names. Currently there are two publishers\n\n- `table`: prints the list of pull requests in a table to stdout\n- `slack`: posts the list of pull requests to slack\n\nEach publisher specified will be run and will publish the list of open pull\nrequests.\n\n```bash\n### Run the \"table\" publisher\npr-publisher table\n\n### Run both the \"table\" and \"slack\" publishers\npr-publisher table slack\n```\n\n### Slack publisher\n\nThe slack publisher requires a slack url and token. Currently, the Slack\nJenkins CI integration url is the only tested and known working webhook url.\n\nBelow is a full list of options,\n\n| Flag | Env Var | Example |\n| ----- | ----- | ----- |\n| `--slack-token` | `SLACK_TOKEN` | |\n| `--slack-url` | `SLACK_URL` | `https://.slack.com/services/hooks/jenkins-ci` |\n| `--slack-channel` | `SLACK_CHANNEL` | `#my-team` |\n| `--slack-approved-emoji` | `SLACK_APPROVED_EMOJI` | `:+1:` |\n| `--slack-changes-requested-emoji` | `SLACK_CHANGES_REQUESTED_EMOJI` | `:-1:` |\n| `--slack-status-check-success-emoji` | `SLACK_STATUS_CHECK_SUCCESS_EMOJI` | `:white_check_mark:` |\n| `--slack-status-check-pending-emoji` | `SLACK_STATUS_CHECK_PENDING_EMOJI` | `:grey_question:` |\n| `--slack-status-check-failed-emoji` | `SLACK_STATUS_CHECK_FAILED_EMOJI` | `:x:` |\n\n- The slack channel is optional. If not supplied, the slack message is sent to\nthe channel associated with the token.\n- All emojis default to the empty string and can be plain text strings if you like\n- The \"approved\" and \"changes requested\" emojis are used to display pull request\napprovals. If your team requires a minimum number of approvals for a pull request,\nyou should supply the `--approvals-needed` flag to display how many more approvals\nare needed.\n\n\nCustom Publishers\n-----------------\n\nThere are two basic steps for a writing your own custom publisher,\n\n- Subclass `BasePublisher` when creating your publisher class\n- Register your publisher with `Main`\n\n[Here's a basic example](examples/custom_publisher.py). You create your\npublisher class, add any cli args you like, and then implement the publish\nmethod.\n\n```python\n\"\"\"Example of a custom publisher\"\"\"\nfrom pr_publisher.publishers.base import BasePublisher\nfrom pr_publisher.main import Main\n\n\nclass CustomPublisher(BasePublisher):\n\n @classmethod\n def add_cli_arguments(cls, parser):\n # All publisher cli args should be optional. (A user may only care to\n # run a single publisher, and doesn't want to supply values for the\n # rest of the publishers)\n parser.add_argument(\"--some-chat-url\", default=None)\n\n def __init__(self, args):\n super(CustomPublisher, self).__init__(args)\n\n if not args.some_chat_url:\n raise Exception(\"--some-chat-url is required\")\n\n def publish(self, publish_entries):\n for entry in publish_entries:\n # Just printing, for the sake of this example.\n # see pr_publisher.entry.PublishEntry for all available fields.\n print(\"{}\\n {}\".format(entry.pr.title, entry.pr.html_url))\n\n\ndef main():\n # Register the publisher before we run the program\n Main.register_publisher(\"some-chat\", CustomPublisher)\n\n # Run the program\n Main().run()\n\n\nif __name__ == \"__main__\":\n main()\n```\n\nYou now have your publisher hooked up. You should see the new CLI arguments\nshow up for the `some-chat` publisher, as well as CLI args for all other\nregistered publishers (but this is truncated for the example).\n\n```bash\n$ python custom_publisher.py -h\n...\n\npositional arguments:\n {table,slack,some-chat}\n List of publishers to run\n\noptional arguments:\n -h, --help show this help message and exit\n ...\n --some-chat-url SOME_CHAT_URL\n```\n\nTo run your publisher, specify the publisher name (`some-chat` on the command\nline.\n\n```bash\n$ python custom_publisher.py ... --some-chat-url 'http://chat.example.com' --users pglass some-chat\nLogging in...\nCollecting info...\nPublishing with CustomPublisher\nFixing some bug\n https://github.com/pglass/pr-publisher/pull/2\nFixing another bug\n https://github.com/pglass/pr-publisher/pull/5\nAdding some feature\n https://github.com/pglass/pr-publisher/pull/6\n```\n\n\n", "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/pglass/pr-publisher", "keywords": "github slack pull request list publish remind", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pr-publisher", "package_url": "https://pypi.org/project/pr-publisher/", "platform": "", "project_url": "https://pypi.org/project/pr-publisher/", "project_urls": { "Homepage": "https://github.com/pglass/pr-publisher" }, "release_url": "https://pypi.org/project/pr-publisher/0.0.2/", "requires_dist": [ "PTable (==0.9.2)", "ConfigArgParse (==0.14.0)", "github3.py (==1.3.0)", "requests (==2.21.0)" ], "requires_python": "", "summary": "publish a list of open pull requests", "version": "0.0.2" }, "last_serial": 4906294, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "4c9f59e33313b6aff81204567c576cac", "sha256": "d6e510865085276fbe60d55a420a23d253c5184a2b86fed528332297e81ddd3c" }, "downloads": -1, "filename": "pr_publisher-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "4c9f59e33313b6aff81204567c576cac", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12327, "upload_time": "2019-03-04T03:21:19", "url": "https://files.pythonhosted.org/packages/78/9e/f1e253451ff7367983bfb581a86b18e86c4de74dfdbcc91d3e39369a5513/pr_publisher-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b86b422efd191d157a89686bc46e3bc5", "sha256": "7f0c5d3fd2362079d61772a72167e9e6ec7d2731e5ee64a40a06f8bf5cd54a0b" }, "downloads": -1, "filename": "pr-publisher-0.0.1.tar.gz", "has_sig": false, "md5_digest": "b86b422efd191d157a89686bc46e3bc5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11861, "upload_time": "2019-03-04T03:21:21", "url": "https://files.pythonhosted.org/packages/24/4a/2cbdf3f87590086994c7d9d8a752b5814f2390842a365352494696b8422d/pr-publisher-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "b4c6aa8b3460646c191c8b6acc35485b", "sha256": "6cf4aaca8444cd4d49f98d83a9ea8aed30614e35705aa9d7d4b0f3451317a20a" }, "downloads": -1, "filename": "pr_publisher-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "b4c6aa8b3460646c191c8b6acc35485b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12667, "upload_time": "2019-03-06T16:52:13", "url": "https://files.pythonhosted.org/packages/48/4c/83eb90cc90803b593afe5fa23558fd01b0c20167cba0e66e0939018045d0/pr_publisher-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1cd8fbe7727b3107bca8b9b9b9f5062e", "sha256": "b67f4a532f527018a6638de1d9768bf92d8964b0d90dbc990d8ecf6559d380c0" }, "downloads": -1, "filename": "pr-publisher-0.0.2.tar.gz", "has_sig": false, "md5_digest": "1cd8fbe7727b3107bca8b9b9b9f5062e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12047, "upload_time": "2019-03-06T16:52:14", "url": "https://files.pythonhosted.org/packages/a1/5d/e15b931e0649fe9b8d5e0090d3f20ae4180b3ce588b58c3a17a0479b2b69/pr-publisher-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b4c6aa8b3460646c191c8b6acc35485b", "sha256": "6cf4aaca8444cd4d49f98d83a9ea8aed30614e35705aa9d7d4b0f3451317a20a" }, "downloads": -1, "filename": "pr_publisher-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "b4c6aa8b3460646c191c8b6acc35485b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12667, "upload_time": "2019-03-06T16:52:13", "url": "https://files.pythonhosted.org/packages/48/4c/83eb90cc90803b593afe5fa23558fd01b0c20167cba0e66e0939018045d0/pr_publisher-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1cd8fbe7727b3107bca8b9b9b9f5062e", "sha256": "b67f4a532f527018a6638de1d9768bf92d8964b0d90dbc990d8ecf6559d380c0" }, "downloads": -1, "filename": "pr-publisher-0.0.2.tar.gz", "has_sig": false, "md5_digest": "1cd8fbe7727b3107bca8b9b9b9f5062e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12047, "upload_time": "2019-03-06T16:52:14", "url": "https://files.pythonhosted.org/packages/a1/5d/e15b931e0649fe9b8d5e0090d3f20ae4180b3ce588b58c3a17a0479b2b69/pr-publisher-0.0.2.tar.gz" } ] }