dktasklib package

dktasklib.clean module

clean tasks

task: clean

Remove all contents from build subdirectory directory.
options
-d STRING, --directory=STRING

dktasklib.docs module

docs tasks

task: build (default)

Build the project’s Sphinx docs.
options
-b, --browse Open docs index in browser after building
-c, --clean Remove build tree before building
-f, --force Force re-reading of all files (ignore cache)
-o STRING, --opts=STRING Extra sphinx-build options/args
-u STRING, --builder=STRING Builder to use, defaults to html
-w, --warn Build with stricter warnings/errors enabled

task: browse

Open build target’s index.html in a browser (using the webbrowser module).

task: clean

Nuke docs build target directory so next build is clean.

task: tree

Display the docs tree.

dktasklib.executables module

class dktasklib.executables.Executables[source]

Class for finding executables on the host system.

find(name, requires=(), install_txt='')[source]

Find the executable named name on the PATH.

Parameters:
  • name (str) – name of executable to find.
  • requires (List[str]) – list of executables to find first.
  • install_txt (str) – instructions for how to install the executable if it is not found.
find_nodejs()[source]

Find node.

find_npm()[source]

Find the node package manager (npm).

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]

Exception thrown when a command (executable) is not found.

dktasklib.executables.exe = <dktasklib.executables.Executables object at 0x0444BCB0>

public interface to the Executables class

dktasklib.executables.requires(*deps)[source]

Decorator to declare global dependencies/requirements.

Usage (@task must be last):

@requires('nodejs', 'npm', 'lessc')
@task
def mytask(..)

dktasklib.jstools module

dktasklib.jstools.ensure_babelrc(ctx)[source]

babel needs a .babelrc file to do any work.

dktasklib.jstools.ensure_node_modules(ctx)[source]

Has node init been called? (if not call it).

dktasklib.jstools.ensure_package_json(ctx)[source]

Is this a node package?

dktasklib.jstools.version_js(ctx, fname, kind='pkg', force=False)[source]

Add version number to a .js file.

jstools tasks

task: babel

–source-maps –out-file $ProjectFileDir$/$ProjectName$/static/$ProjectName$/$FileNameWithoutExtension$.js $FilePath$
options
-d STRING, --dest=STRING
-f, --force
-o, --[no-]source-maps
-s STRING, --source=STRING

task: browserify

Run browserify

Args:

ctx (pyinvoke.Context): context source (str): root source file dest (str): path/name of assembled file babelify (Bool): use babel transform require (iterable): A module name or file to bundle.require()

Optionally use a colon separator to set the target.

external: Reference a file from another bundle. Files can be globs. entry:

Returns:
None
options
-b, --babelify
-d STRING, --dest=STRING
-e, --external
-n STRING, --entry=STRING
-r, --require
-s STRING, --source=STRING

task: uglifyjs

options
-c, --[no-]compress
-d STRING, --dst=STRING
-m, --[no-]mangle
-s STRING, --src=STRING

dktasklib.lessc module

lessc tasks

task: build_less (default)

Build a .less file into a versioned and minified .css file.
options
-b, --[no-]bootstrap
-d STRING, --dst=STRING
-f, --force
-s STRING, --src=STRING
-v STRING, --version=STRING one of pkg|hash|svn

dktasklib.manage module

manage tasks

task: collectstatic

Run collectstatic with settings from package.json (‘django_settings_module’)
options
-c, --clobber
-f, --force
-s STRING, --settings=STRING
-v STRING, --venv=STRING

task: manage

Run manage.py with settings in a separate process.
options
-c STRING, --cmd=STRING
-m STRING, --manage-path=STRING
-s STRING, --settings=STRING
-v STRING, --venv=STRING

dktasklib.npm module

dktasklib.npm.global_package(pkgname)[source]

Check if an npm package is installed globally.

dktasklib.package module

dktasklib.runners 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.filename(fname)[source]

Return only the file name (removes the path)

dktasklib.utils.find_pymodule(dotted_name)[source]

Find the directory of a python module, without importing it.

dktasklib.utils.fmt(s, ctx)[source]

Use the mapping ctx as a formatter for the {new.style} formatting string s.

dktasklib.utils.switch_extension(fname, ext='', old_ext=None)[source]

Switch file extension on fname to ext. Returns the resulting file name.

Usage:

switch_extension('a/b/c/d.less', '.css')

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.get_version(ctx, fname, kind='pkg')[source]

Return the version number for fname.

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.version.versioned_name(fname)[source]

Returns a template string containing {version} in the correct place.

version tasks

task: version (default)

Print this package’s version number.

Module contents