weberc2 / nimbus Goto Github PK
View Code? Open in Web Editor NEWGenerate CloudFormation bindings for Python
Generate CloudFormation bindings for Python
Currently the reference()
method for property types raises NotImplementedError. This is preventing me from using the BucketEncryption property type in an S3 bucket example.
Ideally attributes are accessed as properties (e.g., Bucket.Arn
). Today they are accessed via accessor methods (e.g., Bucket.GetArn()
). The Get
prefix is necessary because frequently a Resource will have properties and attributes with the same name, and the Get
allows us to disambiguate. In cases where there is an attribute and a property with the same name, it would be easy to accidentally access the property when you were intending to access the attribute (the static type checker will save those who use it, but even they might have a bit of confusion trying to debug the type checker error message).
To address this, I propose making resources with this template:
class MyResource:
def __init__(self, {prop_0}, {prop_1}, ... {prop_n}) -> None:
self._{prop_0} = {prop_0}
self._{prop_1} = {prop_1}
...
self._{prop_n} = {prop_n}
@property
def {Attr0}(self) -> {attribute_python_type(Attr0)}:
return {attribute_python_type(Attr0)}(self, {Attr0})
Since mutating properties isn't supported today, this is no worse in that regard. Further, if we wanted to support mutating properties, we could still provide SetProperty() methods (this is less natural in Python, but it feels more natural for this application to leave the getattr syntax for attributes.
Similarly, accessing properties via the __getattr__
syntax doesn't feel like a very natural use pattern; if someone needs a handle for a property, they can use whatever was passed into the constructor--if that thing was a literal of some sort, they can put the literal in a variable before passing it into the constructor. If we really want to support this case, we could support it with a GetProperty() method.
PropBucketName
instead of BucketName
and attributes are AttrArn
instead of Arn
(possibly even .AttrArn() # method
instead of `.AttrArn # @Property)?Currently only string attributes are generated.
For now, set up CI to run mypy for non-generated code only
i don't see a license file in the repo, in the setup, or a header in the files, please provide one else now can really look at or contribute.
on a separate note, also out of curiosity, why bazel?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.