Winnow

A library for publishing and manipulating families of products

View project on GitHub

winnow

Winnow is a json interchange format for publishing families of configurable products.

It has several distinct parts:

  • A set of json schemata for documents describing products and associated information.
  • A schema for defining sets of configuration options in products.
  • A defined set of basic logical operations for manipulating documents with options.
  • A python library that implements these operations

In order to write and publish winnow documents you use the first two of these as they define how winnow documents are constructed. To apply logical operations to, and manipulate, winnow documents you will need to understand winnow's operations and it's library that implements them.

resources and documents

Most winnow documents describe named resources. Resource documents are discoverable, composed and versioned.

You can read about resource documents in more detail here and how they are composed with references here

Eight resource types are currently defined in winnow. Follow links to see their full descriptions.

  • range - A collection of related designs with common authorship
  • design - A design
  • product - A family of versions of a design defined by a common set of options
  • fileset - A set of files that are useful for making all or a subset of a product family
  • finish - A finish for a product defined by a set of materials and processes
  • material - A material
  • process - A process that is applied to a material
  • context - An collection of options used to filter or extend a product's options

validation

In winnow.schemata there are json schemata that can be used to validate winnow documents. This can be done using tools available from json-schema.org, or using winnow's python library like this:

    with open(filepath, "r") as f:
        doc = json.loads(f.read())
        winnow.validate(doc)

options

Some winnow documents have a top level options attribute. This object describes a related family of products by defining a set of possible configurations for a product, for example available colours or sizes.

 {
    "options":{
        "colour": ["red", "blue", "green"],
        "size": ["big", "small"],
        "wheels": [4, 6]
     }
     ...
 }

This describes the product family for a toy that comes in three colours, two sizes and can have either four or six wheels. Winnow provides both a json language for defining these options and a set of operations for manipulating them.

You can read more about winnow's values here options

operations

Winnow defines a set of simple, but powerful, operations to help manipulate winnow documents.

  • add_doc
  • allows
  • is_allowed
  • merge
  • scope
  • default_choices
  • quantify
  • filter_allows
  • filter_allowed_by
  • is_allowed_by
  • expand
  • asset_props
  • validate