{"action":"created","issue":{"url":"https://api.github.com/repos/cloudtools/troposphere/issues/1078","repository_url":"https://api.github.com/repos/cloudtools/troposphere","labels_url":"https://api.github.com/repos/cloudtools/troposphere/issues/1078/labels{/name}","comments_url":"https://api.github.com/repos/cloudtools/troposphere/issues/1078/comments","events_url":"https://api.github.com/repos/cloudtools/troposphere/issues/1078/events","html_url":"https://github.com/cloudtools/troposphere/issues/1078","id":335000955,"node_id":"MDU6SXNzdWUzMzUwMDA5NTU=","number":1078,"title":"PyCharm autocompletion for properties","user":{"login":"DrLuke","id":1679780,"node_id":"MDQ6VXNlcjE2Nzk3ODA=","avatar_url":"https://avatars1.githubusercontent.com/u/1679780?v=4","gravatar_id":"","url":"https://api.github.com/users/DrLuke","html_url":"https://github.com/DrLuke","followers_url":"https://api.github.com/users/DrLuke/followers","following_url":"https://api.github.com/users/DrLuke/following{/other_user}","gists_url":"https://api.github.com/users/DrLuke/gists{/gist_id}","starred_url":"https://api.github.com/users/DrLuke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DrLuke/subscriptions","organizations_url":"https://api.github.com/users/DrLuke/orgs","repos_url":"https://api.github.com/users/DrLuke/repos","events_url":"https://api.github.com/users/DrLuke/events{/privacy}","received_events_url":"https://api.github.com/users/DrLuke/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-22T19:57:45Z","updated_at":"2018-06-22T23:17:10Z","closed_at":null,"author_association":"NONE","body":"Due to the fact that the classes have dynamically generated fields for the AWS resource properties, IDEs like PyCharm doesn't suggest those fields during autocompletion.\r\n\r\nFor example:\r\n```Python\r\nfrom troposphere import Template, apigateway\r\n\r\nt = Template()\r\n\r\napiResource = apigateway.Resource(\"contactcloud\")\r\napiResource.ParentId #<-- won't be suggested by autocompletion!\r\n```\r\n\r\nThis could be remedied in two ways:\r\n\r\n### 1. Add type hints to the beginning of classes, e.g.:\r\n```Python\r\nclass Resource(AWSObject):\r\n    ParentId: basestring    # Python 3 type hints for fields\r\n    PathPart: basestring\r\n    RestApiId: basestring\r\n    \r\n    resource_type = \"AWS::ApiGateway::Resource\"\r\n    \r\n    props = {\r\n        \"ParentId\": (basestring, True),\r\n        \"PathPart\": (basestring, True),\r\n        \"RestApiId\": (basestring, True)\r\n    }\r\n```\r\n\r\n### 2. Generate stub files\r\nThis is outlined by [PEP 484#stub-files](https://www.python.org/dev/peps/pep-0484/#stub-files)\r\n"},"comment":{"url":"https://api.github.com/repos/cloudtools/troposphere/issues/comments/399607776","html_url":"https://github.com/cloudtools/troposphere/issues/1078#issuecomment-399607776","issue_url":"https://api.github.com/repos/cloudtools/troposphere/issues/1078","id":399607776,"node_id":"MDEyOklzc3VlQ29tbWVudDM5OTYwNzc3Ng==","user":{"login":"markpeek","id":638982,"node_id":"MDQ6VXNlcjYzODk4Mg==","avatar_url":"https://avatars2.githubusercontent.com/u/638982?v=4","gravatar_id":"","url":"https://api.github.com/users/markpeek","html_url":"https://github.com/markpeek","followers_url":"https://api.github.com/users/markpeek/followers","following_url":"https://api.github.com/users/markpeek/following{/other_user}","gists_url":"https://api.github.com/users/markpeek/gists{/gist_id}","starred_url":"https://api.github.com/users/markpeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markpeek/subscriptions","organizations_url":"https://api.github.com/users/markpeek/orgs","repos_url":"https://api.github.com/users/markpeek/repos","events_url":"https://api.github.com/users/markpeek/events{/privacy}","received_events_url":"https://api.github.com/users/markpeek/received_events","type":"User","site_admin":false},"created_at":"2018-06-22T23:17:10Z","updated_at":"2018-06-22T23:17:10Z","author_association":"MEMBER","body":"Does the stub file approach work for both python2 and python3? Those likely could be autogenerated similar to the way I'm generating code from the resource specifications."}}
{"actor":{"display_login":"markpeek"}}