Metadata / notes / comments in .blend files?
Its quite common just to distribute a text block with some plain text information.

Some options you have for storing more structured meta-data in a Blend file.


Text-Block

You might want to use JSON/XML/MIME encoding to dump your data to this in your own format which you can read back.
Text blocks can be hidden (indeed any data-blocks), by starting the name with a . - Unix .convention).



Example:

import bpy
import json
metadata = dict(author="Me", date="Today", rating=100)

# hidden text block
text = bpy.data.texts.new(".metadata")
text.write(json.dumps(metadata))

# print it back out
print(text.as_string())



ID Properties

attach a dictionary like object to any data-block.
only support primitive data types str,int,float,dict,array - but can be nested.



Example:

import bpy
metadata = dict(author="Me", date="Today", rating=100)
# attach to current Scene
scene = bpy.context.scene
scene["metadata"] = metadata

# print it back out
print(scene["metadata"].to_dict())




Neither of these options are especially easy to extract from the Blend file without loading the file in Blender first, however it is possible.

See: https://developer.blender.org/diffusion/BAM/browse/master/bam/blend/blendfile.py