A Distribution is a serialization of the Package and optionally the data too (code, database, a book etc) to some concretely addressable form that can be ‘distributed’ (e.g. uploaded) or accessed (e.g. downloaded). For example:
- file(s) on disk
- an API at a specific url.
Note
To the extent possible, we seek to reuse existing ‘distribution’ formats rather than invent our own.
Currently, we provide 2 types of basic file distributions:
- Simple (Ini-Based) Distribution - DEFAULT
- Python Distribution
It is also easy to extend datapkg to support new distribution types. See Extending Datapkg.
Load a L{Package} object from a path to a package distribution.
@return: the Distribution object.
Simple distribution storing metadata in an ini file.
File layout:
{dist-path}/metadata.txt
* metadata.txt: package metadata in ini-file format (key = value or
key: value with support for line continuations). See
http://docs.python.org/library/configparser.html.
* Manifest items are inserted as sections with name of ile and prefix
'manifest::' e.g. [manifest::myfilename.csv]
{dist-path}/....
# Data (and code): any files you want (specify them in the
# manifest).
Writes distribution to disk.
Metadata written to metadata.txt in ini style (python ConfigParser) with encoding to utf8.
Datapkg distribution based on python distribution format (based on setuptools).
File layout:
{dist-path}/setup.py
# as per standard python approach main 'metadata' goes in python
# setup.py file with key/value arguments to setup method.
{dist-path}/MANIFEST.in
# manifest template specifying rules for what files to include in
# the distribution. For details see:
# http://docs.python.org/distutils/sourcedist.html#the-manifest-in-template
# NB: If you want to explicitly list every file you can create a
# MANIFEST file.
{dist-path}/{pkgname}/...
# Data (and code) files. For python to pick up files correctly
# they should be in subdirectory named after the package or
# subdirectories thereof (e.g. {pkgname}/data
See parent.
@param template: paster template to use