cloudtools / cloudtools/troposphere

PyCharm autocompletion for properties

Open
#1,078 33 comments 2 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
4.9k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

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.

For example:
```Python
from troposphere import Template, apigateway

t = Template()

apiResource = apigateway.Resource("contactcloud")
apiResource.ParentId #<-- won't be suggested by autocompletion!
```

This could be remedied in two ways:

### 1. Add type hints to the beginning of classes, e.g.:
```Python
class Resource(AWSObject):
ParentId: basestring # Python 3 type hints for fields
PathPart: basestring
RestApiId: basestring

resource_type = "AWS::ApiGateway::Resource"

props = {
"ParentId": (basestring, True),
"PathPart": (basestring, True),
"RestApiId": (basestring, True)
}
```

### 2. Generate stub files
This is outlined by [PEP 484#stub-files](https://www.python.org/dev/peps/pep-0484/#stub-files)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.