dk-tasklib¶
dktasklib package¶
Subpackages¶
dktasklib.entry_points package¶
Submodules¶
dktasklib.entry_points.dktasklibcmd module¶
Commands installed by setup.py
dktasklib.entry_points.taskbase module¶
Module contents¶
dktasklib.package package¶
Submodules¶
dktasklib.package.package_interface module¶
-
class
dktasklib.package.package_interface.Package(ctx=None)[source]¶ Bases:
dkpkg.directory.Package-
overridables= set(['source_less', 'tests', 'build_docs', 'django_templates', 'package_name', 'docs', 'build_coverage', 'name', 'build_lintscore', 'source', 'build_pytest', 'version', 'location', 'source_js', 'build_meta', 'django_static', 'build'])¶
-
Module contents¶
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:
objectClass for finding executables on the host system.
-
ctx¶
-
find(name, requires=(), install_txt='')[source]¶ Find the executable named
nameon 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.ExceptionException thrown when a command (executable) is not found.
-
dktasklib.executables.exe= <dktasklib.executables.Executables object>¶ public interface to the
Executablesclass
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:
dictProperty 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
kindparameter 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
kindparameter 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 namedmytaskwith a simple@taskwrapper 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--helpoutput.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
prekwarg for convenience’s sake. (It is an error to give both*argsandpreat the same time.)New in version 1.0.
Changed in version 1.1: Added the
klasskeyword argument.
Module contents¶
Developing dktasklib¶
Uploading to PyPI¶
only source distribution:
python setup.py sdist upload
source and windows installer:
python setup.py sdist bdist_wininst upload
source, windows, and wheel installer:
python setup.py sdist bdist_wininst bdist_wheel upload
create a documentation bundle to upload to PyPi:
python setup.py build_sphinx python setup.py upload_docs
Note
if you’re using this as a template for new projects, remember to python setup.py register <projectname> before you upload to PyPi.
Running tests¶
One of:
python setup.py test
py.test dktasklib
with coverage:
py.test --cov=dktasklib .
Building documentation¶
python setup.py build_sphinx