cape.tnakit.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.attdb.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:
- pkg_files:
list
[str
] List of files to include
- pkg_files:
- Versions:
2021-10-21
@ddalle
: Version 1.0
- cape.attdb.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.json
The
__init__.py
has a functionread_db()
The
__init__.py
has a functionwrite_db()
The
__init__.py
importsdatakitloader
(A package created by
dkit-quickstart
will satisfy all of these criteria.)- Call:
>>> pkgs = find_packages(where=".", **kw)
- Inputs:
- where: {
"."
} |str
Location from which to search for packages
- exclude: {
()
} |tuple
[str
] List of globs to exclude from package search
- include: {
("*",)
} |tuple
[str
] List of globs to include during package search
- re, regex, {
None
} |str
Only include packages including regular expression regex
- where: {
- Outputs:
- pkgs:
list
[str
] List of packages that look like datakit packages
- pkgs:
- Versions:
2021-08-23
@ddalle
: Version 1.0
- cape.attdb.pkgutils.read_metadata(pkg)¶
Read metadata for a package
- Call:
>>> meta = read_metadata(pkg)
- Inputs:
- pkg:
str
Name of package
- pkg:
- Outputs:
- meta:
ModuleMetadata
dict
-like container formeta.json
- meta:
- Versions:
2021-10-21
@ddalle
: Version 1.0
- cape.attdb.pkgutils.setup(**kw)¶
Create a package using
setuptools
and 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.json
in package_data- rawdata:
True
| {False
} Search for
rawdata/
files in package_data
- name: {
- Versions:
2021-10-21
@ddalle
: Version 1.0