Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naming conventions or style in pyamrex #144

Open
RevathiJambunathan opened this issue Jul 12, 2023 · 4 comments
Open

Naming conventions or style in pyamrex #144

RevathiJambunathan opened this issue Jul 12, 2023 · 4 comments
Labels
question Further information is requested

Comments

@RevathiJambunathan
Copy link
Contributor

We were adding some examples in pyamrex and observed that we use small-case with underscore for functions
For example, in amrex, we have a function, setVal(), while in pyamrex we have set_val()

Additionally, the python bindings in warpx also dont have consistent conventions.
Is there a preferable style, so going forward when we make changes, we ensure to stay aligned with preferred style.

@zingale
Copy link
Member

zingale commented Jul 12, 2023

The python is probably following pep-8

@ax3l
Copy link
Member

ax3l commented Oct 6, 2023

Good question!

Yes, somewhat inconsistently, I started to use more Pythonic names for methods where appropriate (or even standardized) in Python.

As Mike mentioned, part of PEP-8 is:

Use the function naming rules: lowercase with words separated by underscores as necessary to improve readability.

For formatting, we use black. black is a somewhat superset (with some reasonable breaks) of PEP-8, but the tool does not control that we use proper naming schemes (just formatting).

@ax3l ax3l added the question Further information is requested label Oct 6, 2023
@ax3l
Copy link
Member

ax3l commented Oct 6, 2023

Going forward, I want the Python bindings to look Pythonic (and not like a wrapper on C++).
Thus, renaming things to follow Python style guides as PRs is very welcome and breakage is encouraged to fulfill it.

We have tab completion and a full doc now, thus people will still find the methods they know from AMReX C++, as long as we keep the same naming schemes, but in the proper Python style.

@ax3l
Copy link
Member

ax3l commented Dec 14, 2023

I started to merge some breakage for the 24.01 release in that direction :)

  • getter functions to properties
  • snake_case instead of camelCase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants