This style guide will be enforced for all incoming PRs. However, certain legacy areas within the repo do not yet fully adhere to the style guide. We welcome PRs to bring these areas up to code.
Methods are almost always named using snake_case.
Methods that behave as operators (e.g. comparison or equality) are named using camelCase. These methods are rare and should be changed with great caution. Please reach out to us if you see the need for a change of this kind.
Experimental methods should log an experimental warning when called: “Warning: some_method is experimental. Methods, APIs, and core behavior may change in the future.”
Experimental classes should log an experimental warning when initialized: “Warning: great_expectations.some_module.SomeClass is experimental. Methods, APIs, and core behavior may change in the future.”
Docstrings are highly recommended. We use the Sphinx’s Napoleon extension to build documentation from Google-style docstrings.
Lint your code. Our CI system will check using
pyupgrade. - Linting with
isortMUST occur from a virtual environment that has all required packages installed, and pre-commit uses the virtual environment from which it was installed, whether or not that environment is active when making the commit. So, before running
pre-commit installensure you have activated a virtual environment that has all development requirements installed.
pre-commit uninstall# ACTIVATE ENV, e.g.: conda activate pre_commit_env OR source pre_commit_env/bin/activatepip install -r requirements-dev.txtpre-commit install --install-hooks
* If you have already committed files but are seeing errors during the continuous integration tests, you can run tests manually:
black .isort . --check-only --skip docsflake8 great_expectations/corepyupgrade --py3-plus
Use unambiguous Expectation names, even if they’re a bit longer, e.g.
Avoid abbreviations, e.g.
((Expectation names should reflect their decorators:**
expect_table_...for methods decorated directly with