add documentation for parsing canonical form and fingerprint
MODIFY
docs/schema.rst
docs/schema.rst
@@ -6,3 +6,5 @@ fastavro.schema
.. autofunction:: fastavro._schema_py.expand_schema
.. autofunction:: fastavro._schema_py.load_schema
.. autofunction:: fastavro._schema_py.load_schema_ordered
+.. autofunction:: fastavro._schema_py.to_parsing_canonical_form
+.. autofunction:: fastavro._schema_py.fingerprint

MODIFY
fastavro/_schema.pyx
fastavro/_schema.pyx
@@ -501,7 +501,10 @@ cdef _to_parsing_canonical_form(schema, fo):
def fingerprint(parsing_canonical_form, algorithm):
if algorithm not in FINGERPRINT_ALGORITHMS:
- raise ValueError(f"Unknown schema fingerprint algorithm {algorithm}")
+ raise ValueError(
+ f"Unknown schema fingerprint algorithm {algorithm}. "
+ + f"Valid values include: {FINGERPRINT_ALGORITHMS}"
+ )
# Fix Java names
algorithm = JAVA_FINGERPRINT_MAPPING.get(algorithm, algorithm)

MODIFY
fastavro/_schema_py.py
fastavro/_schema_py.py
@@ -664,6 +664,11 @@ def load_schema_ordered(ordered_schemas, *, _write_hint=True):
def to_parsing_canonical_form(schema):
+ """Returns a string represening the parsing canonical form of the schema.
+
+ For more details on the parsing canonical form, see here:
+ https://avro.apache.org/docs/current/spec.html#Parsing+Canonical+Form+for+Schemas
+ """
fo = StringIO()
_to_parsing_canonical_form(parse_schema(schema), fo)
return fo.getvalue()
@@ -730,8 +735,17 @@ def _to_parsing_canonical_form(schema, fo):
def fingerprint(parsing_canonical_form, algorithm):
+ """Returns a string represening a fingerprint/hash of the parsing canonical
+ form of a schema.
+
+ For more details on the fingerprint, see here:
+ https://avro.apache.org/docs/current/spec.html#schema_fingerprints
+ """
if algorithm not in FINGERPRINT_ALGORITHMS:
- raise ValueError(f"Unknown schema fingerprint algorithm {algorithm}")
+ raise ValueError(
+ f"Unknown schema fingerprint algorithm {algorithm}. "
+ + f"Valid values include: {FINGERPRINT_ALGORITHMS}"
+ )
# Fix Java names
algorithm = JAVA_FINGERPRINT_MAPPING.get(algorithm, algorithm)

MODIFY
publish.sh
publish.sh
@@ -25,6 +25,9 @@ PyVers="36
for os in $OSes; do
for pyver in $PyVers; do
+ if [[ ${os} == "manylinux2014_aarch64" && ${pyver} == "37" ]]; then
+ continue # Currently having trouble building ARM64 for Python 3.7
+ fi
wget -q --directory-prefix=dist/ https://github.com/fastavro/fastavro/releases/download/${ver}/fastavro-${ver}-cp${pyver}-cp${pyver}m-${os}.whl
done
done

add documentation for parsing canonical form and fingerprint