dktasklib package¶
Subpackages¶
Submodules¶
dktasklib.clean module¶
dktasklib.commands module¶
dktasklib.concat module¶
dktasklib.docs module¶
dktasklib.environment module¶
Global state.
dktasklib.executables module¶
-
class
dktasklib.executables.
Executables
[source]¶ Bases:
object
Class for finding executables on the host system.
-
ctx
¶
-
find
(name, requires=(), install_txt='')[source]¶ Find the executable named
name
on thePATH
.Parameters:
-
require
(*dependencies)[source]¶ Ensure that all dependencies are available. You should not need to call this yourself, use the
requires()
decorator instead.
-
-
exception
dktasklib.executables.
MissingCommand
[source]¶ Bases:
exceptions.Exception
Exception thrown when a command (executable) is not found.
-
dktasklib.executables.
exe
= <dktasklib.executables.Executables object>¶ public interface to the
Executables
class
dktasklib.help module¶
dktasklib.jstools module¶
dktasklib.lessc module¶
dktasklib.manage module¶
dktasklib.npm module¶
dktasklib.pset module¶
-
class
dktasklib.pset.
pset
(items=(), **attrs)[source]¶ Bases:
dict
Property Set class. A property set is an object where values are attached to attributes, but can still be iterated over as key/value pairs. The order of assignment is maintained during iteration. Only one value allowed per key.
>>> x = pset() >>> x.a = 42 >>> x.b = 'foo' >>> x.a = 314 >>> x pset(a=314, b='foo')
dktasklib.publish module¶
dktasklib.rule module¶
dktasklib.runners module¶
dktasklib.upversion module¶
Update a package’s version number.
-
class
dktasklib.upversion.
UpdateTemplateVersion
(*args, **kwargs)[source]¶ Bases:
dktasklib.rule.BuildRule
dktasklib.urlinliner module¶
dktasklib.utils module¶
-
dktasklib.utils.
cd
(*args, **kwds)[source]¶ Context manager to change directory.
Usage:
with cd('foo/bar'): # current directory is now foo/bar # current directory restored.
-
dktasklib.utils.
dest_is_newer_than_source
(src, dst)[source]¶ Check if destination is newer than source.
Usage:
if not force and dest_is_newer_than_source(source, dest): print 'babel:', dest, 'is up-to-date.' return dest
-
dktasklib.utils.
env
(*args, **kwds)[source]¶ Context amanger to temporarily override environment variables.
-
dktasklib.utils.
find_pymodule
(dotted_name)[source]¶ Find the directory of a python module, without importing it.
dktasklib.version module¶
-
dktasklib.version.
add_version
(ctx, source, outputdir=None, kind='pkg', force=False)¶ Copy source with version number to outputdir.
The version type is specified by the
kind
parameter and can be either “pkg” (package version), “svn” (current subversion revision number), or “hash” (the md5 hash of the file’s contents).Returns: (str) output file name
-
dktasklib.version.
copy_to_version
(ctx, source, outputdir=None, kind='pkg', force=False)[source]¶ Copy source with version number to outputdir.
The version type is specified by the
kind
parameter and can be either “pkg” (package version), “svn” (current subversion revision number), or “hash” (the md5 hash of the file’s contents).Returns: (str) output file name
-
dktasklib.version.
min_name
(fname, min='.min')[source]¶ Adds a .min extension before the last file extension.
-
dktasklib.version.
version_name
(fname)¶ Returns a template string containing {version} in the correct place.
dktasklib.watch module¶
Usage:
@task
def watch(ctx):
watcher = Watcher(ctx)
watcher.watch_file(
name='{pkg.source}/less/{pkg.name}.less',
action=lambda e: build(ctx, less=True)
)
watcher.watch_directory(
path='{pkg.source}/js', ext='.jsx',
action=lambda e: build(ctx, js=True)
)
watcher.watch_directory(
path='{pkg.docs}', ext='.rst',
action=lambda e: build(ctx, docs=True)
)
watcher.start()
ns = Collection(..., watch, ...)
ns.configure({
'pkg': Package()
})
-
class
dktasklib.watch.
DirectoryModified
(ctx, path, ext, action)[source]¶ Bases:
watchdog.events.FileSystemEventHandler
dktasklib.wintask module¶
-
dktasklib.wintask.
task
(*args, **kwargs)[source]¶ Marks wrapped callable object as a valid Invoke task.
May be called without any parentheses if no extra options need to be specified. Otherwise, the following keyword arguments are allowed in the parenthese’d form:
name
: Default name to use when binding to a .Collection. Useful for avoiding Python namespace issues (i.e. when the desired CLI level name can’t or shouldn’t be used as the Python level name.)aliases
: Specify one or more aliases for this task, allowing it to be invoked as multiple different names. For example, a task namedmytask
with a simple@task
wrapper may only be invoked as"mytask"
. Changing the decorator to be@task(aliases=['myothertask'])
allows invocation as"mytask"
or"myothertask"
.positional
: Iterable overriding the parser’s automatic “args with no default value are considered positional” behavior. If a list of arg names, no args besides those named in this iterable will be considered positional. (This means that an empty list will force all arguments to be given as explicit flags.)optional
: Iterable of argument names, declaring those args to have optional values. Such arguments may be given as value-taking options (e.g.--my-arg=myvalue
, wherein the task is given"myvalue"
) or as Boolean flags (--my-arg
, resulting inTrue
).iterable
: Iterable of argument names, declaring them to build iterable values.incrementable
: Iterable of argument names, declaring them to increment their values.default
: Boolean option specifying whether this task should be its collection’s default task (i.e. called if the collection’s own name is given.)auto_shortflags
: Whether or not to automatically create short flags from task options; defaults to True.help
: Dict mapping argument names to their help strings. Will be displayed in--help
output.pre
,post
: Lists of task objects to execute prior to, or after, the wrapped task whenever it is executed.autoprint
: Boolean determining whether to automatically print this task’s return value to standard output when invoked directly via the CLI. Defaults to False.klass
: Class to instantiate/return. Defaults to .Task.
If any non-keyword arguments are given, they are taken as the value of the
pre
kwarg for convenience’s sake. (It is an error to give both*args
andpre
at the same time.)New in version 1.0.
Changed in version 1.1: Added the
klass
keyword argument.