Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products.

Python 3.10 is now available in preview.


Helper class for updating index.yaml.

Inherits From: expected_type

This class maintains some state about the query history and the index.yaml file in order to minimize the number of times index.yaml is actually overwritten.

root_path Path to the app's root directory.



View source


View source

Update index.yaml.

openfile Used for dependency injection.

We only ever write to index.yaml if either:

  • it doesn't exist yet; or
  • it contains an 'AUTOGENERATED' comment.

All indexes before the AUTOGENERATED comment will be written back unchanged. All indexes after the AUTOGENERATED comment will be updated with the latest query counts (query counts are reset by --clear_datastore). Indexes that aren't yet in the file will be appended to the AUTOGENERATED section.

We keep track of some data in order to avoid doing repetitive work:

  • if index.yaml is fully manual, we keep track of its mtime to avoid parsing it over and over;
  • we keep track of the number of keys in the history dict since the last time we updated index.yaml (or decided there was nothing to update).

index_yaml_is_manual False
index_yaml_mtime None
last_history_size 0