cloudtools / cloudtools/troposphere
Better Implementation of troposphere API
- Dominant language
- Python
- Stars
- 4.9k
- Forks
- 1.4k
- PR merge metrics
- No merged PRs in 30d
Description
@markpeek
The way you implement the AWS Resource Class is this, and it uses customized __getattr__, __setattr__ method:
```python
class Instance(AWSObject):
resource_type = "AWS::EC2::Instance"
props = {
'Affinity': (str, False),
'AvailabilityZone': (str, False),
'BlockDeviceMappings': (list, False),
'CreditSpecification': (CreditSpecification, False),
'DisableApiTermination': (boolean, False),
'EbsOptimized': (boolean, False),
```
By doing this, No IDLE can predict what properties the class has, in another word, auto hint and auto completion will not work.
If you look at sqlalchemy, attrs, marshmallow or WtfForm, you will see that you should use MetaClass to implement that, here's the example, then the IDLE can tell users about it.
```
class Instance(object):
Affinity = Property(...)
AvailabilityZone = Property(...)
```
Have you ever thinking of refactor it with the better design?
Contributor guide
Assessment
This issue has not been assessed yet.