Skip to content

โœ… Standards

Enumerations of standards for code and its documentation to be maintained in trulens_eval. Ongoing work aims at adapting these standards to existing code.

Proper Names

In natural language text, style/format proper names using italics if available. In Markdown, this can be done with a single underscore character on both sides of the term. In unstyled text, use the capitalization as below. This does not apply when referring to things like package names, classes, methods.

  • TruLens, TruLens-Eval, TruLens-Explain

  • LangChain

  • LlamaIndex

  • NeMo Guardrails

  • OpenAI

  • Bedrock

  • LiteLLM

  • Pinecone

  • HuggingFace

Python

Format

  • Use pylint for various code issues.

  • Use yapf to format code with configuration:

    [style]
    based_on_style = google
    DEDENT_CLOSING_BRACKETS=true
    SPLIT_BEFORE_FIRST_ARGUMENT=true
    SPLIT_COMPLEX_COMPREHENSION=true
    COLUMN_LIMIT=80
    

Imports

Docstrings

Example: Modules

"""Summary line.

More details if necessary.

Design:

Discussion of design decisions made by module if appropriate.

Examples:

```python
# example if needed
```

Deprecated:
    Deprecation points.
"""

Example: Classes

"""Summary line.

More details if necessary.

Examples:

```python
# example if needed
```

Attrs:
    attribute_name (attribute_type): Description.

    attribute_name (attribute_type): Description.
"""

Example: Functions/Methods

"""Summary line.

More details if necessary.

Examples:

```python
# example if needed
```

Args:
    argument_name: Description. Some long description of argument may wrap over to the next line and needs to
        be indented there.

    argument_name: Description.

Returns:

    return_type: Description.

    Additional return discussion. Use list above to point out return components if there are multiple relevant components.

Raises:

    ExceptionType: Description.
"""

Note that the types are automatically filled in by docs generator from the function signature.

Markdown

  • Always indicate code type in code blocks as in python in

    ```python
    # some python here
    ```
    
  • Use markdownlint to suggest formatting.

  • Use 80 columns if possible.

Jupyter notebooks

Do not include output unless core goal of given notebook.

Tests

Unit tests

See tests/unit.

Static tests

See tests/unit/static.

Static tests run on multiple versions of python: 3.8, 3.9, 3.10, and being a subset of unit tests, are also run on latest supported python, 3.11.

Test pipelines

Defined in .azure_pipelines/ci-eval{-pr,}.yaml.