palantir / conjure-python

Conjure generator for Python clients
Apache License 2.0
19 stars 18 forks source link

Python constructor argument order is alphabetical #55

Open vipshek opened 5 years ago

vipshek commented 5 years ago

The generated constructor for a Conjure-defined object currently has its arguments ordered by optional vs. non-optional, followed by alphabetical order. This is defined here.

This seems to be out of sync with generated Java clients for Conjure objects, which have an .of() method whose argument order matches the order in the original Conjure YML definition. Is there a strong reason for this difference between the Java and Python clients?

ferozco commented 5 years ago

I would not compare the .of() factory method of some conjure-java beans with the constructor of the conjure-python "object" classes.

In Java, the .of() method is simply a convenience wrapper around the builder for beans with small number of arguments. In Python, the constructor is the equivalent of the Java builder and is the only way to create these objects.

I do agree though that the current ordering is not ideal. Long term we want to major rev the code gen and make all constructor and endpoint arguments kwargs for robustness (prevent binary breaks caused by backwards compatible API changes) and clarity

AaronJRubin commented 3 years ago

@ferozco : Is this long-term change (making all constructor and endpoint arguments kwargs for robustness) still on your roadmap? I think that there is an argument to be made that this major rev can also come with dropping Python2 support (Python2 was sunset more than a year ago), which would make the implementation of enforcing mandatory keyword args a great deal simpler.

ferozco commented 3 years ago

Hey @AaronJRubin I've rolled off of the team and I don't believe there is any active development on Conjure-python right now. @carterkozak or @jkozlowski are the best people to ask