{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/configman/pulls/comments/25812419","id":25812419,"diff_hunk":"@@ -0,0 +1,477 @@\n+# This Source Code Form is subject to the terms of the Mozilla Public\n+# License, v. 2.0. If a copy of the MPL was not distributed with this\n+# file, You can obtain one at http://mozilla.org/MPL/2.0/.\n+\n+from unittest import TestCase\n+from mock import patch\n+\n+from StringIO import StringIO\n+\n+try:\n+    import argparse\n+except ImportError:\n+    try:\n+        from unittest import SkipTest\n+    except ImportError:\n+        from nose.plugins.skip import SkipTest\n+    raise SkipTest","path":"configman/tests/test_def_for_argparse.py","position":17,"original_position":17,"commit_id":"cb8230cb4bcda0c1bfc6ed5ca548cab8e083a860","original_commit_id":"cb8230cb4bcda0c1bfc6ed5ca548cab8e083a860","user":{"login":"peterbe","id":26739,"avatar_url":"https://avatars.githubusercontent.com/u/26739?v=3","gravatar_id":"","url":"https://api.github.com/users/peterbe","html_url":"https://github.com/peterbe","followers_url":"https://api.github.com/users/peterbe/followers","following_url":"https://api.github.com/users/peterbe/following{/other_user}","gists_url":"https://api.github.com/users/peterbe/gists{/gist_id}","starred_url":"https://api.github.com/users/peterbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterbe/subscriptions","organizations_url":"https://api.github.com/users/peterbe/orgs","repos_url":"https://api.github.com/users/peterbe/repos","events_url":"https://api.github.com/users/peterbe/events{/privacy}","received_events_url":"https://api.github.com/users/peterbe/received_events","type":"User","site_admin":false},"body":"Mayhaps do this as `raise SkipText(\"argparse not installed so we can't test def_for_argparse\")`","created_at":"2015-03-04T20:49:07Z","updated_at":"2015-03-04T20:49:07Z","html_url":"https://github.com/mozilla/configman/pull/144#discussion_r25812419","pull_request_url":"https://api.github.com/repos/mozilla/configman/pulls/144","_links":{"self":{"href":"https://api.github.com/repos/mozilla/configman/pulls/comments/25812419"},"html":{"href":"https://github.com/mozilla/configman/pull/144#discussion_r25812419"},"pull_request":{"href":"https://api.github.com/repos/mozilla/configman/pulls/144"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/configman/pulls/144","id":30490923,"html_url":"https://github.com/mozilla/configman/pull/144","diff_url":"https://github.com/mozilla/configman/pull/144.diff","patch_url":"https://github.com/mozilla/configman/pull/144.patch","issue_url":"https://api.github.com/repos/mozilla/configman/issues/144","number":144,"state":"open","locked":false,"title":"added support for argparse","user":{"login":"twobraids","id":581227,"avatar_url":"https://avatars.githubusercontent.com/u/581227?v=3","gravatar_id":"","url":"https://api.github.com/users/twobraids","html_url":"https://github.com/twobraids","followers_url":"https://api.github.com/users/twobraids/followers","following_url":"https://api.github.com/users/twobraids/following{/other_user}","gists_url":"https://api.github.com/users/twobraids/gists{/gist_id}","starred_url":"https://api.github.com/users/twobraids/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twobraids/subscriptions","organizations_url":"https://api.github.com/users/twobraids/orgs","repos_url":"https://api.github.com/users/twobraids/repos","events_url":"https://api.github.com/users/twobraids/events{/privacy}","received_events_url":"https://api.github.com/users/twobraids/received_events","type":"User","site_admin":false},"body":"big change, not sure how to make it smaller as the changes are comprehensive.\r\n\r\nThis makes configman a drop in replacement for argparse (including support for subparsers), but giving argparse all the \"--admin...\" stuff including config files (.conf, .ini, .json, .py), environment vars, etc.  \r\n\r\nI would love to see this tried with some known python programs just to see how well (or badly) it works.  \r\n\r\n``` python\r\nfrom configman import ArgumentParser\r\nparser = ArgumentParser(prog='my_app')\r\nparser.add_argument('--foo', action='store_true', help='foo help', dest='foo')\r\nparser.add_argument('--egg', action='store', help='eggs', type=str)\r\nsubparsers = parser.add_subparsers(help='sub-command help', dest='sub_command')\r\nparser_a = subparsers.add_parser('a', help='a help')\r\nparser_a.add_argument('bar', type=int, help='bar help')\r\nparser_a.add_argument('--fff', type=int, help='a fff help')\r\nparser_b = subparsers.add_parser('b', help='b help')\r\nparser_b.add_argument('--baz', choices='XYZ', help='baz help')\r\nparser_b.add_argument('--fff', choices='XYZ', help='b fff help')\r\n\r\nc = parser.parse_args()\r\n```\r\n\r\n","created_at":"2015-03-04T18:27:54Z","updated_at":"2015-03-04T20:49:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2942953f604f115818493546f7009e5108945f6a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/configman/pulls/144/commits","review_comments_url":"https://api.github.com/repos/mozilla/configman/pulls/144/comments","review_comment_url":"https://api.github.com/repos/mozilla/configman/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/configman/issues/144/comments","statuses_url":"https://api.github.com/repos/mozilla/configman/statuses/cb8230cb4bcda0c1bfc6ed5ca548cab8e083a860","head":{"label":"twobraids:with-argparse","ref":"with-argparse","sha":"cb8230cb4bcda0c1bfc6ed5ca548cab8e083a860","user":{"login":"twobraids","id":581227,"avatar_url":"https://avatars.githubusercontent.com/u/581227?v=3","gravatar_id":"","url":"https://api.github.com/users/twobraids","html_url":"https://github.com/twobraids","followers_url":"https://api.github.com/users/twobraids/followers","following_url":"https://api.github.com/users/twobraids/following{/other_user}","gists_url":"https://api.github.com/users/twobraids/gists{/gist_id}","starred_url":"https://api.github.com/users/twobraids/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twobraids/subscriptions","organizations_url":"https://api.github.com/users/twobraids/orgs","repos_url":"https://api.github.com/users/twobraids/repos","events_url":"https://api.github.com/users/twobraids/events{/privacy}","received_events_url":"https://api.github.com/users/twobraids/received_events","type":"User","site_admin":false},"repo":{"id":2892179,"name":"configman","full_name":"twobraids/configman","owner":{"login":"twobraids","id":581227,"avatar_url":"https://avatars.githubusercontent.com/u/581227?v=3","gravatar_id":"","url":"https://api.github.com/users/twobraids","html_url":"https://github.com/twobraids","followers_url":"https://api.github.com/users/twobraids/followers","following_url":"https://api.github.com/users/twobraids/following{/other_user}","gists_url":"https://api.github.com/users/twobraids/gists{/gist_id}","starred_url":"https://api.github.com/users/twobraids/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twobraids/subscriptions","organizations_url":"https://api.github.com/users/twobraids/orgs","repos_url":"https://api.github.com/users/twobraids/repos","events_url":"https://api.github.com/users/twobraids/events{/privacy}","received_events_url":"https://api.github.com/users/twobraids/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/twobraids/configman","description":"the grand unified configuration system","fork":true,"url":"https://api.github.com/repos/twobraids/configman","forks_url":"https://api.github.com/repos/twobraids/configman/forks","keys_url":"https://api.github.com/repos/twobraids/configman/keys{/key_id}","collaborators_url":"https://api.github.com/repos/twobraids/configman/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/twobraids/configman/teams","hooks_url":"https://api.github.com/repos/twobraids/configman/hooks","issue_events_url":"https://api.github.com/repos/twobraids/configman/issues/events{/number}","events_url":"https://api.github.com/repos/twobraids/configman/events","assignees_url":"https://api.github.com/repos/twobraids/configman/assignees{/user}","branches_url":"https://api.github.com/repos/twobraids/configman/branches{/branch}","tags_url":"https://api.github.com/repos/twobraids/configman/tags","blobs_url":"https://api.github.com/repos/twobraids/configman/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/twobraids/configman/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/twobraids/configman/git/refs{/sha}","trees_url":"https://api.github.com/repos/twobraids/configman/git/trees{/sha}","statuses_url":"https://api.github.com/repos/twobraids/configman/statuses/{sha}","languages_url":"https://api.github.com/repos/twobraids/configman/languages","stargazers_url":"https://api.github.com/repos/twobraids/configman/stargazers","contributors_url":"https://api.github.com/repos/twobraids/configman/contributors","subscribers_url":"https://api.github.com/repos/twobraids/configman/subscribers","subscription_url":"https://api.github.com/repos/twobraids/configman/subscription","commits_url":"https://api.github.com/repos/twobraids/configman/commits{/sha}","git_commits_url":"https://api.github.com/repos/twobraids/configman/git/commits{/sha}","comments_url":"https://api.github.com/repos/twobraids/configman/comments{/number}","issue_comment_url":"https://api.github.com/repos/twobraids/configman/issues/comments{/number}","contents_url":"https://api.github.com/repos/twobraids/configman/contents/{+path}","compare_url":"https://api.github.com/repos/twobraids/configman/compare/{base}...{head}","merges_url":"https://api.github.com/repos/twobraids/configman/merges","archive_url":"https://api.github.com/repos/twobraids/configman/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/twobraids/configman/downloads","issues_url":"https://api.github.com/repos/twobraids/configman/issues{/number}","pulls_url":"https://api.github.com/repos/twobraids/configman/pulls{/number}","milestones_url":"https://api.github.com/repos/twobraids/configman/milestones{/number}","notifications_url":"https://api.github.com/repos/twobraids/configman/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/twobraids/configman/labels{/name}","releases_url":"https://api.github.com/repos/twobraids/configman/releases{/id}","created_at":"2011-12-01T16:00:15Z","updated_at":"2014-08-16T16:46:00Z","pushed_at":"2015-03-04T20:24:30Z","git_url":"git://github.com/twobraids/configman.git","ssh_url":"git@github.com:twobraids/configman.git","clone_url":"https://github.com/twobraids/configman.git","svn_url":"https://github.com/twobraids/configman","homepage":"","size":2182,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":3,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"ce9ac5e7d51c84ca1247924f6b7b6e28d46e91d6","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":2815861,"name":"configman","full_name":"mozilla/configman","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/configman","description":"the grand unified configuration system","fork":false,"url":"https://api.github.com/repos/mozilla/configman","forks_url":"https://api.github.com/repos/mozilla/configman/forks","keys_url":"https://api.github.com/repos/mozilla/configman/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/configman/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/configman/teams","hooks_url":"https://api.github.com/repos/mozilla/configman/hooks","issue_events_url":"https://api.github.com/repos/mozilla/configman/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/configman/events","assignees_url":"https://api.github.com/repos/mozilla/configman/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/configman/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/configman/tags","blobs_url":"https://api.github.com/repos/mozilla/configman/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/configman/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/configman/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/configman/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/configman/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/configman/languages","stargazers_url":"https://api.github.com/repos/mozilla/configman/stargazers","contributors_url":"https://api.github.com/repos/mozilla/configman/contributors","subscribers_url":"https://api.github.com/repos/mozilla/configman/subscribers","subscription_url":"https://api.github.com/repos/mozilla/configman/subscription","commits_url":"https://api.github.com/repos/mozilla/configman/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/configman/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/configman/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/configman/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/configman/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/configman/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/configman/merges","archive_url":"https://api.github.com/repos/mozilla/configman/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/configman/downloads","issues_url":"https://api.github.com/repos/mozilla/configman/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/configman/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/configman/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/configman/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/configman/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/configman/releases{/id}","created_at":"2011-11-20T21:34:33Z","updated_at":"2015-02-27T19:37:54Z","pushed_at":"2015-02-27T19:37:54Z","git_url":"git://github.com/mozilla/configman.git","ssh_url":"git@github.com:mozilla/configman.git","clone_url":"https://github.com/mozilla/configman.git","svn_url":"https://github.com/mozilla/configman","homepage":"http://configman.readthedocs.org/","size":1484,"stargazers_count":23,"watchers_count":23,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":9,"forks":13,"open_issues":9,"watchers":23,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/configman/pulls/144"},"html":{"href":"https://github.com/mozilla/configman/pull/144"},"issue":{"href":"https://api.github.com/repos/mozilla/configman/issues/144"},"comments":{"href":"https://api.github.com/repos/mozilla/configman/issues/144/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/configman/pulls/144/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/configman/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/configman/pulls/144/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/configman/statuses/cb8230cb4bcda0c1bfc6ed5ca548cab8e083a860"}}}}