cape.dkit.pkgutils: Tools for creating DataKit packages¶
This module provides a handle to setuptools.setup() with useful
defaults. The goal is for most datakit packages to just be able to call
setup() with no arguments.
- cape.dkit.pkgutils.find_package_data(pkg, meta=True, db=True, rawdata=False, **kw)¶
Find extra data files for a datakit package
- Call:
>>> pkg_files = find_package_data(pkg, **kw)
- Inputs:
- pkg:
str Name of package
- meta: {
True} |False Flag to include
meta.json- db: {
True} |False Flag to include processed
db/files- rawdata:
True| {False} Flg to include source data in
rawdata/folder
- pkg:
- Outputs:
- Versions:
2021-10-21
@ddalle: Version 1.0
- cape.dkit.pkgutils.find_packages(where='.', **kw)¶
Find packages that appear to be datakit packages
In order for a package to qualify as a datakit package, it must satisfy 2 of the following 4 criteria:
The package contains the file
meta.jsonThe
__init__.pyhas a functionread_db()The
__init__.pyhas a functionwrite_db()The
__init__.pyimportsdatakitloader
(A package created by
dkit-quickstartwill satisfy all of these criteria.)- Call:
>>> pkgs = find_packages(where=".", **kw)
- Inputs:
- Outputs:
- Versions:
2021-08-23
@ddalle: Version 1.0
- cape.dkit.pkgutils.read_metadata(pkg)¶
Read metadata for a package
- cape.dkit.pkgutils.setup(**kw)¶
Create a package using
setuptoolsand some extra defaults- Call:
>>> setup(**kw)
- Inputs:
- name: {
None} |str Name of the package (default from
find_packages())- packages: {
None} |list[str] Packages to include (default from
find_packages())- title: {
None} |str Short description (default from
meta.json)- description: {title} |
str Description
- package_data: {
{}} |dict Extra files to include for name
- db: {
True} |False Search for
db/data files in package_data- meta: {
True} |False Automatically include
meta.jsonin package_data- rawdata:
True| {False} Search for
rawdata/files in package_data
- name: {
- Versions:
2021-10-21
@ddalle: Version 1.0