anise.features package

Subpackages

Submodules

anise.features.base module

Feature that contains basic versatile tools. They are not associated to any particular kind of functionality.

class anise.features.base.Internals

Bases: object

static _beautify_longdescription()
Return type

None

static _initproject()
Return type

None

static extractfilesfromretval(r, autoopen)

Can be used after executing a task in the anise engine for making a result file available in the target directory. Before you do so, all files created as result are in a temporary area, which will be flushed when the process terminates.

Parameters
  • r (Any) – The raw result (arbitrary object, list, whatever).

  • autoopen (bool) – If anise shall automatically open a file in the result if there is a hint set this way.

Return type

Any

static getbackgroundimage()

Determines the location of the background image.

Returns

File path relative to the project root directory.

Return type

Optional[str]

static getlogoimage()

Determines the location of the background image.

Returns

File path relative to the project root directory.

Return type

Optional[str]

static getprojectstatusdescription()

Returns a short plaintext describing the specified project maturity (universe.base.maturity).

Return type

str

static getregisteredtasks()

Determines the list of all available tasks.

Return type

anise.framework.files.TextFileByContent

class anise.features.base.Maturity

Bases: object

Enumeration describing possible project states.

Alpha = 'Development Status :: 3 - Alpha'
Beta = 'Development Status :: 4 - Beta'
Inactive = 'Development Status :: 7 - Inactive'
Mature = 'Development Status :: 6 - Mature'
Planning = 'Development Status :: 1 - Planning'
PreAlpha = 'Development Status :: 2 - Pre-Alpha'
ProductionStable = 'Development Status :: 5 - Production/Stable'
anise.features.base.pyscript(code, hook, provides=None, requires=None, prepares=None)

Adds a Python function given as source code text to a hook (see Anise documentation for details about hooks).

Note

This call only has an effect, if this hook will be triggered afterwards. So, usage in a project description file has no effect for hooks that are triggered in very early stages!

Parameters
  • code (str) – The Python code block to register as a hook handler.

  • hook (str) – The hook name (i.e. the event). This is typically a variable that begins with HOOK_.

  • provides (Optional[List[str]]) – Used for dependency ordering of hooks. A list of string symbols that this method provides.

  • requires (Optional[List[str]]) – Used for dependency ordering of hooks. A list of string symbols that this method requires. Each method that provides one of those symbols is guaranteed to be executed before.

  • prepares (Optional[List[str]]) – Used for dependency ordering of hooks. A list of string symbols that this method prepares. Each method that provides one of those symbols is guaranteed to be executed afterwards.

Return type

None

anise.features.base.pytask(code, taskname, decorators=None, label=None)

Adds a task implementation to the universe object, so it is available for execution, e.g. directly from command line or from the graphical task chooser.

Parameters
  • code (str) – The Python code block to register as task implementation.

  • taskname (str) – The name for this new task.

  • decorators (Optional[List[str]]) – Additional Python function decorators to apply.

  • label (Optional[str]) – An optional label text.

Return type

None

anise.features.base.set_basecolor(r, g, b)

Sets the project base color. This color is used for all kinds of styling.

Parameters
  • r (float) – Red value (0.0 to 1.0).

  • g (float) – Green value (0.0 to 1.0).

  • b (float) – Blue value (0.0 to 1.0).

Return type

None

anise.features.build module

Features for building binaries from source files.

anise.features.datainjections module

Feature for injecting some kinds of data at anise runtime into some file structures, in order to make it available to other build processes (Makefiles, …) or to the project’s runtime.

class anise.features.datainjections.Internals

Bases: object

class Pool

Bases: object

Storage of all data injections.

add(method, outfile, propnames=None, do_in_source=False, **params)

Add a data injection.

Parameters
  • method (Callable) – The implementation for the injection. This is the name of a function with the parameters outfile and data, writing the data (a dict with key/value pairs) to a given file in some format (as absolute path or relative to the project root directory).

  • outfile (str) – Path to the target file for the injections (relative to anise project root path).

  • propnames (Optional[List[str]]) – List of entry names you want to inject (beyond the few default ones).

  • do_in_source (bool) – If the source itself should be updated as well (instead of only the on-the-fly copies for packages).

  • params – Additional parameters for calling the injection implementation.

Return type

None

static _initproject()
Return type

None

static _sync()

Sync if not marked as omitsyncvcs.

Return type

bool

anise.features.datainjections.getessentials(propnames=None)

Returns essential project data for injecting it into some file.

Parameters

propnames (Optional[List[str]]) – Additional properties to inject on top of the very fundamental ones.

Returns

a list of name/value tuples containing the data for injections.

Return type

List[Tuple[str, Any]]

anise.features.datainjections.inject_c(outfile=None, data=None)

Injects project data into a C++ header file, so it is available at program’s runtime.

Parameters
  • outfile (Optional[str]) – The target file for injection.

  • data (Optional[List[Tuple[str, Any]]]) – The data to inject.

Return type

anise.framework.files.Filestructure

anise.features.datainjections.inject_python(outfile=None, data=None, asclass=None)

Injects project data into a Python file, so it is available at program’s runtime.

Parameters
  • outfile (Optional[str]) – The target file for injection.

  • data (Optional[List[Tuple[str, Any]]]) – The data to inject.

  • asclass (Optional[str]) – Optional class name. If set, the data is written as members into a class with this name.

Return type

anise.framework.files.Filestructure

anise.features.dependencies module

Features for specifying and processing third-party packages that are required by the project in some way.

class anise.features.dependencies.Dependency(type, objectname=None, comment='', icon=None, visible=True, displayname=None, **kwargs)

Bases: object

A dependency.

Parameters
  • type (anise.features.dependencies.Type) – The dependency type.

  • objectname (Optional[str]) – A descriptive name for this dependency (e.g. a library name).

  • comment (str) – A comment.

  • icon (Optional[str]) – The name of a dependency icon.

  • visible (bool) – If it is visible in the dependency list.

  • displayname (Optional[str]) – A display variant of the object name.

  • kwargs – Additional arguments.

class anise.features.dependencies.Internals

Bases: object

class Pool

Bases: object

Storage of all dependencies.

add(dependency)

Adds a dependency.

Parameters

dependency (anise.features.dependencies.Dependency) – The dependency to add.

Return type

None

static _add_homepage_section()
Return type

None

static _initproject()
Return type

None

static getdependencydocument()

Creates a documentation source that describes the project dependencies in a human-readable form.

It is mostly used for including it into Doxygen documentation source.

Returns

The documentation source.

Return type

str

class anise.features.dependencies.Type

Bases: object

Enumeration of different types of dependencies. It describes how strongly required a dependency is.

Included = 'included'
Optional = 'optional'
Recommended_HasAlternatives = 'recommended'
Required = 'required'
Required_HasAlternatives = 'required (has alternatives)'

anise.features.diagnostics module

Feature for universe object exploration and problem analysis.

class anise.features.diagnostics.FeatureAction(label, description, forfeature)

Bases: object

Abstract base class for an action that can be triggered from the feature overview in the console.

Parameters
  • label (str) – The label text.

  • description (str) – The description text (may be a bit longer than label).

  • forfeature (str) – Full name of the feature to associate this action with (like 'foo.bar').

execute()

Executes this feature action. Override this method in custom subclasses.

Return type

None

visible()

Checks if this feature action shall be visible. Override this method in custom subclasses or leave the default implementation.

Return type

bool

anise.features.diagnostics.HOOK_GET_FEATURE_ACTIONS = <anise.framework.features.Hook object>

Hook triggered for collecting all implementations for feature actions, as offered in the console.

class anise.features.diagnostics.Internals

Bases: object

class ChildrenInformation(p)

Bases: object

class Arguments(args, varargs, varkw, doc)

Bases: object

class ConsoleWebModule

Bases: anise.features.ui_.web.helpers.AniseWebApplication

Parameters
  • parentid – Optional id of a parent Application, which e.g. can be redirected back to after exit.

  • returntoparent – If to return back to the parentid application after exit in the user’s browser.

  • show_browser_closed_notification – If to show a useful notification (including a way to close the application) after the browser was closed by the user and restarted.

  • stop_implicitly_when_browser_closed – If to consider the application as intendedly stopped when the user has closed the browser instead of opening a new one.

  • skip_shutdown_dialog – If not to show a ui-blocking ‘application stopped’ dialog on ui shutdown.

  • browser_hook_heartbeat_threshold – The time window within the backend excepts a heartbeat from the browser side before it tries to open a new browser window.

  • head1 – The 1st level header text.

  • head2 – The 2nd level header text.

  • icon – The window icon.

  • mainview_icon – The icon of the mainview header.

_do_exec(p)
_do_execaction(p, idx)
Parameters

idx (int) –

_do_info(p)
_do_listfeatures(p)
_do_listkeys(p)
_do_listmembers(p)
_send_userfeedback_web_request(request)
oninitialize()

Initializes the application. Override this method in custom subclasses or leave the default implementation.

This is called during application startup, so later than __init__ (or never if the app does not start).

Note

You should just override __init__ instead if possible!

class ReadManualApplication

Bases: anise.features.diagnostics.FeatureAction

Parameters
  • label – The label text.

  • description – The description text (may be a bit longer than label).

  • forfeature – Full name of the feature to associate this action with (like 'foo.bar').

_manualpath()
Return type

Optional[str]

execute()

Executes this feature action. Override this method in custom subclasses.

_featureactions = None
static _initproject()
static _initproject2()
static action(i)
Parameters

i (int) –

Return type

None

static checkmembervisible(parent, membername, hidemodules=True)
Parameters
  • parent (Any) –

  • membername (str) –

  • hidemodules (bool) –

Return type

bool

static correctname(s)
Parameters

s (str) –

Return type

str

static detach()
Return type

None

static featureactions()
Return type

List[anise.features.diagnostics.FeatureAction]

static featureactionsforfeature(s)
Parameters

s (str) –

Return type

[<class ‘anise.features.diagnostics.FeatureAction’>]

static getdocumentation(obj)
static getfunctionparamspec(func)
Parameters

func (Callable) –

static geticon(parent, membername)
Parameters
  • parent (Any) –

  • membername (str) –

Return type

str

static getobjects(obj)
static getpriority(parent, membername)
Parameters
  • parent (Any) –

  • membername (str) –

Return type

int

static getuniverseattr(membername)
Parameters

membername (str) –

Return type

Optional[Any]

static getuniversedocumentation()
Return type

str

static info(v='universe')
Parameters

v (str) –

Return type

None

infostring = "\n Information about '{valname}'\n{desc}\n"
static issimplevalue(v)
Parameters

v (type) –

Return type

bool

static isunexpandable(obj)
Parameters

obj (Any) –

Return type

bool

listfeaturesstring = "\n Information about 'universe'\n\nLoaded features:\n{features}\n\nMembers:\n{members}\n\n{documentation}\n\nAvailable actions: {actions}\n"
anise.features.diagnostics.console()

Executes the diagnostics console. Either call this task directly from command line or from within another task implementation in order to inspect the items of the universe object.

Return type

None

anise.features.distributables module

Feature for defining and processing distributables (installation packages for target systems, …).

class anise.features.distributables.FileGroup(sources, name, description=None, linkto=None)

Bases: object

A file group.

Parameters
  • sources (Union[anise.framework.files.Filestructure, List[anise.framework.files.Filestructure]]) – The file structures that return the distributables. For a single entry, you may also pass it directly without a list around it.

  • name (str) – The file group name.

  • description (Optional[str]) – The file group description text.

  • linkto (Optional[str]) – An optional link path that is always kept up to date (pointing to the latest version). This is only applied to the first file in the group.

class anise.features.distributables.Internals

Bases: object

class Pool

Bases: object

Storage of all dependencies.

addgroup(sources, **kwargs)

Adds a group of distributables.

Each group is stored as FileGroup instance.

Parameters
Return type

None

find_by_name(name)

Searches a file group by name and returns it.

Parameters

name (str) – The name of the group to find.

Return type

anise.features.distributables.FileGroup

get()

Prepares the pool for further processing (i.e. firing HOOK_PREPARE_DISTRIBUTABLES_POOL) and returns the pool.

Return type

List[anise.features.distributables.FileGroup]

static _add_homepage_section()
static _initproject()
static _initproject2()

anise.features.docrender module

Feature for generating all kinds of documentation like output.

class anise.features.docrender.AbstractApiReferenceLanguage

Bases: object

Base class for a programming language in api references. See ApiReferencePiece.

sphinx_config(rootpath, outpath)

Returns additional Sphinx conf.py configuration.

Parameters
  • rootpath (str) – Path to the original source directory.

  • outpath (str) – Path to the root directory of the Sphinx input.

Return type

str

sphinx_transfer(srcpath, outpath, heading)

Transfers auxiliary files and prepares the intermediate directory outpath.

Parameters
  • srcpath (str) – The root path of the sources directory.

  • outpath (str) – The root path of the intermediate directory given to Sphinx.

  • heading (str) – The api reference heading.

Return type

None

class anise.features.docrender.AbstractDoxygenSupportedApiReferenceLanguage(*, _doxygenopts=None, extract_all=True, extract_private=True, extract_package=True, extract_static=True, extract_local_classes=True, extract_local_methods=True, extract_anon_nspaces=True, extract_priv_virtual=True, file_patterns='*', inline_inherited_memb=True, inherit_docs=True, hide_undoc_members=False, hide_undoc_classes=False, exclude_patterns='', predefined=None)

Bases: anise.features.docrender.AbstractApiReferenceLanguage

Language support for api references powered by Doxygen.

Parameters
  • _doxygenopts (Optional[Dict[str, str]]) –

  • extract_all (bool) –

  • extract_private (bool) –

  • extract_package (bool) –

  • extract_static (bool) –

  • extract_local_classes (bool) –

  • extract_local_methods (bool) –

  • extract_anon_nspaces (bool) –

  • extract_priv_virtual (bool) –

  • file_patterns (str) –

  • inline_inherited_memb (bool) –

  • inherit_docs (bool) –

  • hide_undoc_members (bool) –

  • hide_undoc_classes (bool) –

  • exclude_patterns (str) –

  • predefined (Optional[List[str]]) –

__info(outpath)
sphinx_config(rootpath, outpath)

Returns additional Sphinx conf.py configuration.

Parameters
  • rootpath – Path to the original source directory.

  • outpath – Path to the root directory of the Sphinx input.

sphinx_transfer(srcpath, outpath, heading)

Transfers auxiliary files and prepares the intermediate directory outpath.

Parameters
  • srcpath – The root path of the sources directory.

  • outpath – The root path of the intermediate directory given to Sphinx.

  • heading – The api reference heading.

class anise.features.docrender.AbstractOutputSpec(path)

Bases: object

Base class for documentation output specifications. See render().

Parameters

path (str) – The output path.

resultpath(projectname, buildpath)

Returns the path to the actual result file/directory, relative to buildpath.

Parameters
  • projectname (str) – The project name (also document header).

  • buildpath (str) – The Sphinx build output path.

Return type

str

sphinx_config(path)

Returns additional Sphinx conf.py configuration.

Parameters

path (str) – Path to the root directory of the Sphinx input.

Return type

str

sphinx_formatname()

Returns the Sphinx format name.

Return type

str

class anise.features.docrender.AbstractPiece(name, rootpath, *, sortidx, source=None)

Bases: object

A subdocument. See render().

Parameters
  • name (str) – The piece name.

  • rootpath (str) – The root directory or file that contains the piece content.

  • sortidx (int) – Sort order index.

  • source (Optional[anise.framework.files.Filestructure]) –

copyto(path)

Copies required data files for this piece to a location.

Parameters

path (str) – The target location (usually inside the intermediate structure given to Sphinx).

Return type

None

property name

The piece name.

Return type

str

Return type

str

Return type

str

property rootpath

The root directory or file that contains the piece content.

Return type

str

Return type

str

Return type

str

property sortidx

The sort order index.

Return type

int

Return type

int

Return type

int

property source

The source file structure.

Return type

anise.framework.files.Filestructure

Return type

anise.framework.files.Filestructure

Return type

anise.framework.files.Filestructure

sphinx_config(path)

Returns additional Sphinx conf.py configuration.

Parameters

path (str) – Path to the root directory of the Sphinx input.

Return type

str

class anise.features.docrender.ApiReferencePiece(name, rootpath, language, *, heading=None, sortidx=100000, source=None)

Bases: anise.features.docrender.AbstractPiece

An api reference.

Parameters
  • name (str) – The piece name.

  • rootpath (str) – The root directory or file that contains the piece content.

  • language (anise.features.docrender.AbstractApiReferenceLanguage) – The programming language related to this api reference.

  • heading (Optional[str]) – The api reference heading.

  • sortidx (int) – Sort order index.

copyto(path)

Copies required data files for this piece to a location.

Parameters

path – The target location (usually inside the intermediate structure given to Sphinx).

sphinx_config(path)

Returns additional Sphinx conf.py configuration.

Parameters

path – Path to the root directory of the Sphinx input.

class anise.features.docrender.CppApiReferenceLanguage(**kwargs)

Bases: anise.features.docrender.AbstractDoxygenSupportedApiReferenceLanguage

C++ language support for api references.

class anise.features.docrender.HtmlOutputSpec(path, *, theme=None, homepagemode=False, title=None, short_title=None, short_desc=None, masterlink=None)

Bases: anise.features.docrender.AbstractOutputSpec

HTML documentation output.

Parameters
  • path (str) – The output path.

  • theme (Optional[str]) – The sphinx html theme name.

  • homepagemode (bool) – If to render output for a homepage with slight different stylings and behaviors.

  • title (Optional[str]) – The html title.

  • short_title (Optional[str]) – The short html title.

  • short_desc (Optional[str]) – The short description. Ignored by most themes.

  • masterlink (Optional[str]) – Url that overrides the target of the main heading (which is also a link).

resultpath(projectname, buildpath)

Returns the path to the actual result file/directory, relative to buildpath.

Parameters
  • projectname – The project name (also document header).

  • buildpath – The Sphinx build output path.

sphinx_config(path)

Returns additional Sphinx conf.py configuration.

Parameters

path – Path to the root directory of the Sphinx input.

sphinx_formatname()

Returns the Sphinx format name.

class anise.features.docrender.Internals

Bases: object

class MediaDirs

Bases: object

Storage of media directories that are used by documentation sources.

add(path)

Adds a media directory.

Parameters

path (str) – Path to the media directory, absolute or relative to the project directory.

Return type

None

get_mediadirs()

Returns a list of all media directories.

Return type

List[str]

class ShortSnippets

Bases: object

Storage of text snippets for use in the documentation texts like |a_foo|.

add(name, text)

Adds a text snippet to the storage, so it can be used.

Parameters
  • name (str) – The snippet alias name. This is the foo in |a_foo|.

  • text (str) – The snippet substitution text.

Return type

None

getall()

Returns all aliases and their snippets.

Return type

Dict[str, str]

static _initproject()
static _initproject2()
static scalecolor(c, brightness, saturation=None)

Internally used for scaling a color tuple to a new one with the same hue but a given brightness.

Parameters
  • c (Tuple[float, float, float]) –

  • brightness (float) –

  • saturation (Optional[float]) –

Return type

Tuple[float, float, float]

class anise.features.docrender.JavaScriptApiReferenceLanguage

Bases: anise.features.docrender.AbstractApiReferenceLanguage

JavaScript language support for api references.

__jsfiles(df)
Parameters

df (str) –

Return type

List[str]

__scanjsfile(f)
Parameters

f (str) –

Return type

str

sphinx_config(rootpath, outpath)

Returns additional Sphinx conf.py configuration.

Parameters
  • rootpath – Path to the original source directory.

  • outpath – Path to the root directory of the Sphinx input.

sphinx_transfer(srcpath, outpath, heading)

Transfers auxiliary files and prepares the intermediate directory outpath.

Parameters
  • srcpath – The root path of the sources directory.

  • outpath – The root path of the intermediate directory given to Sphinx.

  • heading – The api reference heading.

class anise.features.docrender.PdfOutputSpec(path)

Bases: anise.features.docrender.AbstractOutputSpec

PDF documentation output.

Parameters

path (str) – The output path.

resultpath(projectname, buildpath)

Returns the path to the actual result file/directory, relative to buildpath.

Parameters
  • projectname – The project name (also document header).

  • buildpath – The Sphinx build output path.

sphinx_formatname()

Returns the Sphinx format name.

class anise.features.docrender.PlaintextOutputSpec(path)

Bases: anise.features.docrender.AbstractOutputSpec

Plaintext documentation output.

Parameters

path (str) – The output path.

resultpath(projectname, buildpath)

Returns the path to the actual result file/directory, relative to buildpath.

Parameters
  • projectname – The project name (also document header).

  • buildpath – The Sphinx build output path.

sphinx_formatname()

Returns the Sphinx format name.

class anise.features.docrender.Python3ApiReferenceLanguage(show_undoc_members=True, show_protected_members=True, exclude=None, preparecode='')

Bases: anise.features.docrender.AbstractApiReferenceLanguage

Python 3 language support for api references.

Parameters
  • show_undoc_members (bool) –

  • show_protected_members (bool) –

  • exclude (Optional[List[str]]) –

  • preparecode (str) –

patch_property_types_in_docstrings(pd)

Deprecated since version all.

Parameters

pd (str) –

Return type

None

sphinx_config(rootpath, outpath)

Returns additional Sphinx conf.py configuration.

Parameters
  • rootpath – Path to the original source directory.

  • outpath – Path to the root directory of the Sphinx input.

sphinx_transfer(srcpath, outpath, heading)

Transfers auxiliary files and prepares the intermediate directory outpath.

Parameters
  • srcpath – The root path of the sources directory.

  • outpath – The root path of the intermediate directory given to Sphinx.

  • heading – The api reference heading.

class anise.features.docrender.RstGenerator

Bases: object

Generator for some documentation source parts.

static heading(s, *, variant='=', sub=False, anchor=None)

Generates documentation source for a section heading.

Parameters
  • s (str) – The heading text.

  • variant (str) – What heading variant to use. See rst syntax for details.

  • sub (bool) – If to use the sub-variant of variant headings, i.e. with just the symbol line below the heading text. See rst syntax for details.

  • anchor (Optional[str]) – Anchor name for usage by rst :samp:`ref`s.

Return type

str

class anise.features.docrender.RstTextsPiece(name, rootpath, *, sortidx=0, source=None)

Bases: anise.features.docrender.AbstractPiece

A reStructureText formatted file or a directory of such files.

Parameters
  • name (str) – The piece name.

  • rootpath (str) – The root directory or file that contains the piece content.

  • sortidx (int) – Sort order index.

copyto(path)

Copies required data files for this piece to a location.

Parameters

path – The target location (usually inside the intermediate structure given to Sphinx).

anise.features.docrender.docgen

alias of anise.features.docrender.RstGenerator

anise.features.docrender.render(pieces, outputspec, projectname, *, author, heading=None, mainbody=None, basecolor=None, mediadirs=None, exclude_in_toc=None, include_in_toc=None, shortsnippets=None, backgroundimage=None, logoimage=None)

Generate documentation output for some documentation pieces and an output specification.

Parameters
  • pieces (List[anise.features.docrender.AbstractPiece]) – Documentation pieces to include.

  • outputspec (anise.features.docrender.AbstractOutputSpec) – The output specification.

  • projectname (str) – The project name, used as (part of) top-level title.

  • author (str) – The project author(s).

  • heading (Optional[str]) – The main heading text.

  • mainbody (Optional[str]) – reStructuredText source for the main body.

  • basecolor (Optional[Tuple[float, float, float]]) – The base color (used for styling by some kinds of outputs).

  • mediadirs (Optional[List[str]]) – Additional media source paths.

  • exclude_in_toc (Optional[List[str]]) – List of piece names to exclude for the table of contents. Default: Exclude none.

  • include_in_toc (Optional[List[str]]) – List of piece names to include for the table of contents. Default: Include all.

  • shortsnippets (Optional[Dict[str, str]]) – Substitution snippets, used by |a_foo| inside document sources.

  • backgroundimage (Optional[str]) – Absolute path to the background image (will be copied).

  • logoimage (Optional[str]) – Absolute path to the logo image (will be copied).

Return type

None

anise.features.documentation module

Feature for specifying and processing project documentation.

class anise.features.documentation.CppApiReferenceLanguage(**kwargs)

Bases: anise.features.docrender.AbstractDoxygenSupportedApiReferenceLanguage

C++ language support for api references.

anise.features.documentation.DoxygenDescribedApiReferenceLanguage

alias of anise.features.docrender.AbstractDoxygenSupportedApiReferenceLanguage

class anise.features.documentation.ExportFormat

Bases: object

Enumeration of output formats.

HTML = 'HTML'

HTML documentation export.

PDF = 'PDF'

PDF documentation export.

Plaintext = 'Plaintext'

Plaintext documentation export.

class anise.features.documentation.HomepageExport(key, index=100000, **kwargs)

Bases: anise.features.documentation.Internals.Export

Describes an export of an Anise documentation directly into the homepage.

Parameters
  • key (str) – One of the keys stored in pool. Defines which documentation to export.

  • index (int) – A position number. Used for ordering.

class anise.features.documentation.Internals

Bases: object

class AbstractFileExport(outputfile, **kwargs)

Bases: anise.features.documentation.Internals.Export

Abstract base class for exports, which write documentation content to files.

Parameters

outputfile (str) – The content destination path.

class Export(format, name=None, heading=None, mediadirs=None, mainbody=None, exclude_in_toc=None, include_in_toc=None)

Bases: object

Defines a documentation export.

Parameters
  • format (str) – The output format (one of ExportFormat).

  • name (Optional[str]) – The export definition name. Finding definitions by name is possible with exports.getbyname.

  • heading (Optional[str]) – The title.

  • mediadirs (Optional[List[str]]) – Directories for additional media files like images used in the documentation.

  • mainbody (Optional[Union[str, Callable[[], str]]]) – Additional text to append to the selected documentation.

  • exclude_in_toc (Optional[List[str]]) – List of piece names to exclude for the table of contents. Default: Exclude none.

  • include_in_toc (Optional[List[str]]) – List of piece names to include for the table of contents. Default: Include all.

generate(targetpath)

Generates the content.

Parameters

targetpath (str) – The content destination path.

Return type

None

class Exports

Bases: object

Storage of all documentation export definitions (i.e. where and how documentation products are to be created).

add(export)

Exports a documentation to some targets.

Parameters

export (anise.features.documentation.Internals.Export) – A export definition that specifies a documentation export target.

Return type

None

getbyname(name)

Returns all export definitions with a given name.

Parameters

name (str) – A export definition name.

Returns

List of export definitions.

Return type

List[anise.features.documentation.Internals.Export]

class Pieces

Bases: object

Storage for documentation pieces.

add_api_reference(*, language, name=None, rootpath=None, **b)

Adds an api reference piece to the storage of documentation pieces.

Parameters
  • language (anise.features.docrender.AbstractApiReferenceLanguage) – The programming language that is associated with this api.

  • name (Optional[str]) – The internal piece name.

  • rootpath (Optional[str]) – The root path of the source code.

  • b – Additional piece arguments. See docrender.ApiReferencePiece.

Return type

None

get_pieces()

Returns a list of all documentation pieces.

Return type

List[anise.features.docrender.AbstractPiece]

class Pool

Bases: object

Storage of all documentation text generators.

add(key, src)

Adds a documentation.

Parameters
  • key (str) – The documentation key for storage (later used for referencing this text).

  • src (Union[str, Callable[[], str]]) – The documentation source text (or a function that returns one).

Return type

None

gettexts()

Returns all texts.

Returns

A list of key/text tuples.

Return type

List[Tuple[str, str]]

static _add_homepage_section()
static _add_release_task_for_export_to_source()
static _compose_readmes()
static _initproject()
static generate_homepage(*, head1, short_desc, targetdir, sections, basecolor=None, aliases=None)

Writes the project homepage. You find it afterwards in index.html (and tons of other files).

Parameters
  • head1 (str) – The first heading (typically the project name).

  • short_desc (str) – The additional heading description (typically a one-liner).

  • targetdir (str) – The directory for the html output.

  • basecolor (Optional[Tuple[float, float, float]]) – The basecolor for colouring the output.

  • sections (List[Tuple[str, str, str]]) – A list of content tuples.

  • aliases (Optional[Dict[str, str]]) – Custom command aliases.

Return type

str

static generate_raw(*, targetpath, outputformat, mainbody=None, head1=None, basecolor=None, documentations=None, short_desc=None, homepagemode=False, mediadirs=None, aliases=None, exclude_in_toc=None, include_in_toc=None)

Generates some documentation or output. Mostly used by some higher-level functions in this module.

Parameters
  • targetpath (str) – The directory for the output.

  • outputformat (str) – The desired output format. See ExportFormat.

  • mainbody (Optional[str]) – Auxiliary rst source code for additional content.

  • head1 (Optional[str]) – The first heading.

  • basecolor (Optional[Tuple[float, float, float]]) – The basecolor for colouring the output.

  • documentations (Optional[List[Tuple[str, str]]]) – An Anise documentations tuple for further pages that do not exist in the sourcecode (e.g. the readme sources) as added by anise.features.documentation.pool.add.

  • short_desc (Optional[str]) – The additional heading description (typically a one-liner) (html output only).

  • homepagemode (bool) – If to generate html output for a homepage; styling differs a bit, sidebar behavior, … (html output only).

  • mediadirs (Optional[List[str]]) – Directories for additional media files like images used in the documentation.

  • aliases (Optional[Dict[str, str]]) – Custom command aliases.

  • exclude_in_toc (Optional[List[str]]) – List of piece names to exclude for the table of contents. Default: Exclude none.

  • include_in_toc (Optional[List[str]]) – List of piece names to include for the table of contents. Default: Include all.

Return type

None

static writedocumentations(destdir, throw_on_existing, fortype)

Immediately exports the documentation as the export definitions currently specify.

Parameters
  • destdir (str) – The destination directory path.

  • throw_on_existing (bool) – If to raise an exception for an already existing destination.

  • fortype (Type[Internals.AbstractFileExport]) – Which export type to process.

Return type

None

class anise.features.documentation.JavaScriptApiReferenceLanguage

Bases: anise.features.docrender.AbstractApiReferenceLanguage

JavaScript language support for api references.

__jsfiles(df)
Parameters

df (str) –

Return type

List[str]

__scanjsfile(f)
Parameters

f (str) –

Return type

str

sphinx_config(rootpath, outpath)

Returns additional Sphinx conf.py configuration.

Parameters
  • rootpath – Path to the original source directory.

  • outpath – Path to the root directory of the Sphinx input.

sphinx_transfer(srcpath, outpath, heading)

Transfers auxiliary files and prepares the intermediate directory outpath.

Parameters
  • srcpath – The root path of the sources directory.

  • outpath – The root path of the intermediate directory given to Sphinx.

  • heading – The api reference heading.

class anise.features.documentation.PackageExport(**kwargs)

Bases: anise.features.documentation.Internals.AbstractFileExport

Describes an export of an Anise documentation into the distribution package(s).

Parameters

outputfile – The content destination path.

class anise.features.documentation.Python3ApiReferenceLanguage(show_undoc_members=True, show_protected_members=True, exclude=None, preparecode='')

Bases: anise.features.docrender.AbstractApiReferenceLanguage

Python 3 language support for api references.

Parameters
  • show_undoc_members (bool) –

  • show_protected_members (bool) –

  • exclude (Optional[List[str]]) –

  • preparecode (str) –

patch_property_types_in_docstrings(pd)

Deprecated since version all.

Parameters

pd (str) –

Return type

None

sphinx_config(rootpath, outpath)

Returns additional Sphinx conf.py configuration.

Parameters
  • rootpath – Path to the original source directory.

  • outpath – Path to the root directory of the Sphinx input.

sphinx_transfer(srcpath, outpath, heading)

Transfers auxiliary files and prepares the intermediate directory outpath.

Parameters
  • srcpath – The root path of the sources directory.

  • outpath – The root path of the intermediate directory given to Sphinx.

  • heading – The api reference heading.

class anise.features.documentation.RstTextsPiece(name, rootpath, *, sortidx=0, source=None)

Bases: anise.features.docrender.AbstractPiece

A reStructureText formatted file or a directory of such files.

Parameters
  • name (str) – The piece name.

  • rootpath (str) – The root directory or file that contains the piece content.

  • sortidx (int) – Sort order index.

copyto(path)

Copies required data files for this piece to a location.

Parameters

path – The target location (usually inside the intermediate structure given to Sphinx).

class anise.features.documentation.SourceExport(**kwargs)

Bases: anise.features.documentation.Internals.AbstractFileExport

Describes an export of an Anise documentation back into the source tree.

Parameters

outputfile – The content destination path.

anise.features.filesystem module

Feature for some basic filesystem operations.

anise.features.filesystem.filterbyextension(source, exclude=None, include=None, casesensitive=False)

Filters a filestructure filename extension.

Parameters
  • source (anise.framework.files.Filestructure) – The source file structure.

  • exclude (Optional[List[str]]) – A list of extensions to filer away.

  • include (Optional[List[str]]) – A list of extensions to not filter away.

  • casesensitive (bool) – If the check is to be applied in a case sensitive manner.

Return type

anise.framework.files.Filestructure

anise.features.filesystem.filterbyfunction(acceptorfunction, source)

Filters a filestructure by a path acceptor function.

Parameters
  • acceptorfunction (Callable[[str], bool]) – A function returning a bool for a relative file path.

  • source (anise.framework.files.Filestructure) – The source file structure.

Return type

anise.framework.files.Filestructure

anise.features.filesystem.filterbyname(source, exclude=None, include=None, casesensitive=False)

Filters a filestructure by the file name.

Parameters
  • source (anise.framework.files.Filestructure) – The source file structure.

  • exclude (Optional[List[str]]) – A list of file names to filer away.

  • include (Optional[List[str]]) – A list of file names to not filter away.

  • casesensitive (bool) – If the check is to be applied in a case sensitive manner.

Return type

anise.framework.files.Filestructure

anise.features.filesystem.filterbynamepattern(source, exclude=None, include=None, casesensitive=False)

Filters a filestructure by a file name pattern.

Parameters
  • source (anise.framework.files.Filestructure) – The source file structure.

  • exclude (Optional[List[str]]) – A list of file name patterns to filer away.

  • include (Optional[List[str]]) – A list of file name patterns to not filter away.

  • casesensitive (bool) – If the check is to be applied in a case sensitive manner.

Return type

anise.framework.files.Filestructure

anise.features.filesystem.subtree(source, root='', copy=False)

Gets a subtree of a filestructure.

Parameters
  • source (anise.framework.files.Filestructure) – The source file structure.

  • root (str) – The relative path to the new root directory.

  • copy (bool) – If the file structure is to be copied (instead of using the original tree).

Return type

anise.framework.files.Filestructure

anise.features.filetransfer module

Feature for transferring file structures to a destination place, e.g. on a web or file server.

class anise.features.filetransfer.Internals

Bases: object

static createprogresscallback(execscope)
static generatenewindex(appidx, indexpattern, projectname)
static updateindexfile(appidxpath, indexpattern, projectname)
anise.features.filetransfer.localupload(*, destination, source, indexpattern='{name}\n', contentdescription='content', collectlinkshook=None)

Deploys content to a local place (e.g. for testing).

Parameters
  • destination (str) – The destination file path.

  • source (anise.framework.files.Filestructure) – Source file structure.

  • indexpattern (str) – Pattern for index entries.

  • contentdescription (str) – Textual description of the kind of content.

  • collectlinkshook (Optional[anise.framework.features.Hook]) – Which hook to trigger for collecting a list of symlinks to create/refresh after upload.

anise.features.filetransfer.sshupload(*, host, username, destination, source, identityfile=None, indexpattern='{name}\n', port=22, transferstrategy=None, contentdescription='content', collectlinkshook=None)

Deploys content to a server (e.g. a web server) via ssh.

Parameters
  • host (str) – The server host name or address.

  • username (str) – The login username.

  • destination (str) – The destination file path.

  • source (anise.framework.files.Filestructure) – Source file structure.

  • identityfile (Optional[str]) – Path to a ssh identity file for login via public-key.

  • indexpattern (str) – Pattern for index entries.

  • port (int) – Port number.

  • transferstrategy (Optional[str]) – File transfer strategy.

  • contentdescription (str) – Textual description of the kind of content.

  • collectlinkshook (Optional[anise.framework.features.Hook]) – Which hook to trigger for collecting a list of symlinks to create/refresh after upload.

Return type

None

anise.features.gpg module

Feature for gpg encryption.

anise.features.gpg.call_pgp(*args, raise_on_errors='unable to call gpg', **kwargs)

Calls gpg with some arguments.

Parameters
  • args (str) –

  • raise_on_errors (str) –

Return type

Tuple[int, str]

anise.features.gpg.get_key(keyid, homedir=None, witharmor=True, withbase64=True)

Returns a pgp key.

Parameters
  • keyid (str) – The key id to look for.

  • homedir (Optional[str]) – The pgp home directory.

  • witharmor (bool) – If to apply an armor to the output.

  • withbase64 (bool) – If to apply additional base64 encoding to the output.

Return type

bytes

anise.features.homepage module

Feature for generating a project homepage.

class anise.features.homepage.Internals

Bases: object

class Sections

Bases: object

Storage of all homepage sections.

add(index, key, header, textfct)

Adds a homepage section.

Parameters
  • index (int) – A position index number. This controls the ordering of sections.

  • key (str) – The section name. Also used as heading.

  • header (str) – The section header text.

  • textfct (Callable[[], str]) – A function returning the section documentation source.

Return type

None

getsectionbykey(key)

Gets the section record for a key. This is part of a particular piece of internal infrastructure and is typically not required to be used directly.

Parameters

key (str) – The section name.

Return type

Tuple[int, str, Callable[[], str], str]

gettextfct(key)

Returns the generator function for a key, that returns the section documentation source.

Parameters

key (str) – The section name.

Return type

Callable[[], str]

replacetextfct(key, textfct)

Replaces a generator function for a key.

Parameters
  • key (str) – The section name.

  • textfct (Callable[[], str]) – The new generator function.

Return type

None

static _basic_homepage_sections()
static _initproject()
anise.features.homepage.makehomepage()

Creates the project homepage from the registered sections.

Return type

anise.framework.files.Filestructure

anise.features.licensing module

anise.features.mediagalleries module

Feature for specifying, generating and processing image galleries. It is typically used as part of the project homepage.

class anise.features.mediagalleries.Internals

Bases: object

class Pool

Bases: object

Storage of all image galleries.

add(gallery, name='')

Adds an image gallery.

Parameters
Return type

None

static _add_homepage_section()
static _initproject()
class anise.features.mediagalleries.Media(path, description, mediatype)

Bases: object

One image in a gallery.

Parameters
  • path (str) – The image file path.

  • description (str) – Description text.

  • mediatype (str) – The media type. Something like 'video' or 'image'.

class anise.features.mediagalleries.MediaGallery(path=None, paths=None)

Bases: object

An image gallery.

Parameters
  • path (Optional[str]) – The directory path where the image gallery is stored.

  • paths (Optional[str]) – The directory paths where the image gallery is stored.

_matchfile(name)
Parameters

name (str) –

Return type

Optional[str]

cloneto(destpath)

Clones the media gallery directory to a different place.

Parameters

destpath (str) – The destination where to copy the image gallery data. Absolute path.

Returns

The new MediaGallery instance pointing to the cloned directory.

Return type

anise.features.mediagalleries.MediaGallery

getmedialist()

Returns the list of media in the gallery.

Return type

List[anise.features.mediagalleries.Media]

anise.features.milieus module

Features that provide tools to run a procedure in different environments in a transparent way.

class anise.features.milieus.DefaultMilieu

Bases: anise.features.milieus.Milieu

The default milieu.

class anise.features.milieus.Internals

Bases: object

static _initproject()
static get(x=None, defaultmilieu=None)

Returns a Milieu (or MilieuComposite).

Typically this milieu is created by the given specification. The specification is a list of tuples. Each tuple has at least a 'class' key pointing to a Milieu(Composite) subclass and optional parameters. The milieux will be created stacked together.

Parameters
  • x (Any) – The milieu specification (or a direct milieu instance).

  • defaultmilieu (Optional[anise.features.milieus.Milieu]) – The default milieu to create if no other one is specified.

Return type

Union[anise.features.milieus.Milieu, anise.features.milieus.MilieuComposite]

static registermilieu(name, createcallable)

Registers a milieu by a name.

This allows shorter names for large class names, and also to register easier factories.

Parameters
  • name (str) – The name to register the new milieu with.

  • createcallable (Type[Milieu]) – The class or callable that creates the instances.

class anise.features.milieus.Milieu

Bases: object

Milieux are a functionality that allows a build task to work in different environments.

This is advanced functionality and requires the build task to be coded in a special way. Instead of directly executing actions, e.g. executing external commands, it must use the call() method of a Milieu instance for it.

Tasks can get a Milieu by calling milieus.get (Internals.get()). Making milieux available on the other hand is possible with defaultmilieu and milieus.register (Internals.registermilieu()).

See subclasses or implement an own one. See also MilieuComposite.

Subclasses often not only implement methods from this class, but also add new tools to it.

_initialize()

Called from outside for initialization. This is part of a particular piece of internal infrastructure and is typically not required to be used directly.

Return type

None

call(*cmdline, shell=False, decode=True, raise_on_errors=None, split_output_channels=False)

Executes a command line.

Parameters
  • cmdline (List[str]) – The command line as list of strings.

  • shell (bool) – If the command shall be interpreted by a shell (only the first part of cmdline will apply!).

  • decode (bool) – If the result is to be decoded to a string.

  • raise_on_errors (Optional[str]) – If errors shall raise exceptions (also specifies the exception text in this case).

  • split_output_channels (bool) – If to separately record output and error stream.

Returns

Tuple of returncode, program output.

Return type

Tuple[int, Any]

createtempdir(dirname=None)

Returns a fresh temporary directory.

Parameters

dirname (Optional[str]) – An optional name that the root directory should get; if not given, it gets an random name.

Return type

anise.framework.files.TempDir

initialize()

Initializes the milieu (composite). Override this method in custom subclasses or leave the default implementation.

Return type

None

class anise.features.milieus.MilieuComposite

Bases: object

A milieu composite brings parts of functionality that can be stacked on top of a Milieu.

They behave largely equally to `Milieu`s.

_initialize()

Called from outside for initialization. This is part of a particular piece of internal infrastructure and is typically not required to be used directly.

Return type

None

initialize()

Initializes the milieu (composite). Override this method in custom subclasses or leave the default implementation.

Return type

None

setinner(inner)

Sets the inner milieu. This is part of a particular piece of internal infrastructure and is typically not required to be used directly.

Parameters

inner (Union[Milieu, MilieuComposite]) –

Return type

None

anise.features.packages module

Features for creating distribution packages.

Those are typically packages for download by end users.

class anise.features.packages.Internals

Bases: object

static _initproject()
_makerawpackage_cache = None
static enrichrawpackage(packagedir)

Adds files to a raw packages (as created by makerawpackage), like the license file.

Parameters

packagedir – The raw package root directory path.

static getversion()

Determines the version string of the project.

Return type

str

static makerawpackage()

Builds a raw package in some flavor. This is used by other components (e.g. packaging) for creating distributable binary packages.

Return type

anise.framework.files.Filestructure

class anise.features.packages.RawPackage

Bases: anise.framework.files.TaskExecution

A file structure that contains the raw package, which is the typical starting point for any further packaging steps or for fetching parts of the project file structure for some processing.

This is a convenience shortcut, which is equivalent to a anise.framework.files.TaskExecution with Internals.makerawpackage() as content generator.

Parameters

task – The task implementation for execution.

anise.features.packages.tarpackage(source, namepostfix=None, pkgdescription='')

Builds a tarball that can be distributed. This is mostly a source package and is possibly not the most convenient package type for an end-user.

Parameters
  • source (anise.framework.files.Filestructure) – The source file structure.

  • namepostfix (Optional[str]) – Postfix for the package root directory name.

  • pkgdescription (str) – The package description text.

Returns

A list containing new tarball.

Return type

anise.framework.files.Filestructure

anise.features.packagestore module

Feature for storing packages on disk, for the ability to publish not only the latest release but also older ones.

class anise.features.packagestore.Internals

Bases: object

static _initproject()
static quotename(s)

Quotes a name for using as filename.

Parameters

s (str) – A string to quote.

Returns

A quoted string that can be used as a filename.

Return type

str

static sliceversion(versionstring)

Slices a version string to a tuple.

Parameters

versionstring – Version as string.

Returns

Version tuple.

Return type

Tuple[Any, str]

static unquotename(s)

Unquotes a name quoted by quotename() back.

Parameters

s (str) – The quoted string.

Returns

The original name.

Return type

str

anise.features.packagestore.enable()

Enables using the package store.

Return type

None

anise.features.projectdescriptioneditor module

anise.features.python module

Feature for some stuff around Python.

class anise.features.python.Internals

Bases: object

static django_quickstart(relpath)

Starts the application in a Django development server for fast testing. It updates the database schema before, if required.

Parameters

relpath (str) – Path to the Django application. Relative to the project root directory.

anise.features.python.is_django_project(relpath='')

Configures a project to be a Django project.

Parameters

relpath (str) – Path to the Django application. Relative to the project root directory.

Return type

None

anise.features.releasing module

Feature for a particular release task. It collects actions to execute for releasing, e.g. generating and deploying a project homepage, by triggering a hook. The release task is provided, which bundles all those actions.

anise.features.releasing.HOOK_RELEASE = <anise.framework.features.Hook object>

Hook triggered for collecting all sub-tasks for release.

class anise.features.releasing.Internals

Bases: object

class Releasetasks

Bases: object

Storage of all actions to execute for releasing.

add(task, *, provides=None, requires=None, prepares=None, **params)

Specifies a new task and adds it into the releasing chain.

Parameters
  • task (Callable) – The task implementation to add.

  • provides (Optional[Union[str, List[str]]]) – A list of symbol names this hook participates to provide (dependency provider).

  • requires (Optional[Union[str, List[str]]]) – A list of symbol names this hook requires to be executed before.

  • prepares (Optional[Union[str, List[str]]]) – A list of symbol names this hook must prepend.

  • params – Additional parameters for calling that task.

static _initproject1()
static _initproject2()
static release()

Releases the project. Mostly this is executing all registered hookhandlers for HOOK_RELEASE.

Return type

None

anise.features.signing module

Feature for signing binaries with cryptographic certificates.

class anise.features.signing.Internals

Bases: object

static p12cert2pem(*, opensslpath, p12path, pemoutpath, password)

Converts a .p12 certificate to a .pem file.

Parameters
  • opensslpath (str) – Path to the OpenSSL binary.

  • p12path (str) – Path to the p12 certificate file.

  • pemoutpath (str) – Destination path for the pem file.

  • password (str) – Certificate password of the p12 file.

Return type

None

static win32_osslsigncode(*, binpath, pempath, outpath, projectname, projecthomepage, osslsigncodepath, password)

Signs a win32 binary with osslsigncode.

Parameters
  • binpath (str) – Path to the binary to sign.

  • pempath (str) – Path to the pem certificate file to use.

  • outpath (str) – Destination path for the signed binary.

  • projectname (str) – The project name.

  • projecthomepage (Optional[str]) – The project homepage url.

  • osslsigncodepath (str) – Path to the osslsigncode tool.

  • password (str) – Certificate password.

Return type

None

class anise.features.signing.OsslsigncodeConfiguration(p12path, intermediatepath=None, osslsigncodepath='osslsigncode', opensslpath='openssl', password='')

Bases: object

Signing configuration for signing a win32 binary with the ‘osslsigncode’ tool.

Parameters
  • p12path (str) – Path to the .p12 file.

  • intermediatepath (Optional[str]) – Path to intermediate certificates.

  • osslsigncodepath (str) – Path to the osslsigncode tool.

  • opensslpath (str) – Path to the openssl tool.

  • password (str) – The certificate passphrase.

anise.features.signing.signwin32_osslsigncode(signconfig, source, required=True)

Signs a win32 binary with a cryptographic code-signing certificate.

Parameters
Return type

anise.framework.files.Filestructure

anise.features.testing module

anise.features.ui module

Feature for user interfaces and interaction with the user.

class anise.features.ui.ChoiceTree

Bases: object

A tree of possible choices. Typically used in UserFeedback.treechoice().

For adding nodes to the tree, use the ChoiceTree.Node.createchild() method, which is available on the root node of this tree as well as on all deeper nodes.

class Node(key, val, parent, childs, image)

Bases: object

One node in a tree of possible choices.

createchild(key, val, image=None)

Creates a new node in tree as as child of this node.

Parameters
  • key (str) – The key string. This is displayed in tree.

  • val (str) – The value description string. It is displayed in the tree as well.

  • image (Optional[str]) – Icon name.

Returns

The new node.

Return type

anise.features.ui.ChoiceTree.Node

class anise.features.ui.Internals

Bases: object

class SetImplicitStopAllowed(val)

Bases: object

Controls if implicit application stop is enabled (e.g. not asking user for confirmation). This is part of a particular piece of internal infrastructure and is typically not required to be used directly.

class UserFeedback

Bases: object

This interface provides mechanisms for asking the user for some kinds of interaction.

choice(msg, choices, canceltext, image, choiceimages)

Asks the user to choose from a list of alternatives.

Parameters
  • msg (str) – The message to show.

  • choices (List[str]) – List of choices.

  • canceltext (Optional[str]) – Label of the Cancel button.

  • image (Optional[str]) – Icon name.

  • choiceimages (Optional[List[Optional[str]]]) – Icon names for the choices.

Returns

The index of the choice the user made, or None if user cancelled.

Return type

int

input(msg, default, image)

Asks the user to enter text (single line).

Parameters
  • msg (str) – The message to show.

  • default (str) – The default text.

  • image (Optional[str]) – Icon name.

Returns

The entered text, or None if user cancelled.

Return type

Optional[str]

message(msg, btns, image)

Shows a message and asks the user to trigger one of the buttons.

Parameters
  • msg (str) – Message text.

  • btns (List[str]) – Buttons to show.

  • image (Optional[str]) – Icon name.

Returns

The index of the selected button.

Return type

int

messageok(msg, image=None)

Shows a message and asks the user to confirm it.

Parameters
  • msg (str) – The message to show.

  • image (Optional[str]) – Icon name.

Return type

None

messageyesno(msg, image=None)

Shows a message and asks the user to trigger either Yes or No.

Parameters
  • msg (str) – The message to show.

  • image (Optional[str]) – Icon name.

Returns

True, if the user selected Yes.

Return type

bool

multilineinput(msg, default, image)

Asks the user to enter text (multi line).

Parameters
  • msg (str) – The message to show.

  • default (str) – The default text.

  • image (Optional[str]) – Icon name.

Returns

The entered text, or None if user cancelled.

Return type

Optional[str]

treechoice(msg, choicetree, canceltext, actions, image)

Asks the user to choose from a tree of alternatives.

Parameters
  • msg (str) – The message to show.

  • choicetree (anise.features.ui.ChoiceTree) – The tree of available choices.

  • canceltext (Optional[str]) – Label of the Cancel button.

  • actions (Optional[List[str]]) – Additional actions.

  • image (Optional[str]) – Icon name.

Returns

The chosen tree node, or None if user cancelled.

Return type

Optional[anise.features.ui.ChoiceTree.Node]

class UserFeedbackProxy

Bases: anise.features.ui.Internals.UserFeedback

This user feedback implementation forwards requests to another internal UserFeedback, depending on which mode (web, terminal) is selected.

_getimpl()
choice(msg, choices, canceltext='Cancel', image=None, choiceimages=None)

Asks the user to choose from a list of alternatives.

Parameters
  • msg – The message to show.

  • choices – List of choices.

  • canceltext – Label of the Cancel button.

  • image – Icon name.

  • choiceimages – Icon names for the choices.

Returns

The index of the choice the user made, or None if user cancelled.

input(msg, default='', image=None)

Asks the user to enter text (single line).

Parameters
  • msg – The message to show.

  • default – The default text.

  • image – Icon name.

Returns

The entered text, or None if user cancelled.

message(msg, btns, image=None)

Shows a message and asks the user to trigger one of the buttons.

Parameters
  • msg – Message text.

  • btns – Buttons to show.

  • image – Icon name.

Returns

The index of the selected button.

multilineinput(msg, default='', image=None)

Asks the user to enter text (multi line).

Parameters
  • msg – The message to show.

  • default – The default text.

  • image – Icon name.

Returns

The entered text, or None if user cancelled.

treechoice(msg, choicetree, canceltext='Cancel', actions=None, image=None)

Asks the user to choose from a tree of alternatives.

Parameters
  • msg – The message to show.

  • choicetree – The tree of available choices.

  • canceltext – Label of the Cancel button.

  • actions – Additional actions.

  • image – Icon name.

Returns

The chosen tree node, or None if user cancelled.

static _default()

Opens the graphical task chooser and executes the selected task afterwards.

static _default_baddir()

Opens the graphical guide for starts in non-Anise directories.

static initproject1()
static initproject2()
class anise.features.ui.Mode

Bases: object

Enumeration of user interface modes.

TERMINAL = 'TERMINAL'

Terminal user interface.

WEB = 'WEB'

Web user interface.

anise.features.ui.chooser_hide_showall(hide=True)

Sets the availability of the show all button in the task chooser, that also shows the unimportant tasks.

Parameters

hide (bool) – If the show all button is to be hidden.

Return type

None

anise.features.ui.enforce_terminal_mode()

Force usage of terminal mode.

Return type

None

anise.features.versioncontrol module

Features for interaction with version control systems.

class anise.features.versioncontrol.ChangeLogChange(changetext, commitmessage)

Bases: object

A change entry in a change log.

Parameters
class anise.features.versioncontrol.ChangeLogRevision(versionlabel, commitmessage)

Bases: object

A revision section in a change log.

Parameters
class anise.features.versioncontrol.CommitMessage(message, revision, committime=None, username=None, **kwargs)

Bases: object

A commit message.

Parameters
  • message (str) – The message text.

  • revision (int) – The revision.

  • committime (Optional[datetime.datetime]) – The time of committing.

  • username (Optional[str]) – The user who committed.

  • kwargs – Additional commit data.

class anise.features.versioncontrol.Internals

Bases: object

class PseudoVersionControlSystem

Bases: anise.features.versioncontrol.Internals.VersionControlSystem

A pseudo version control system implementation, which does nothing. This is the default as long as no real version control system is configured.

syncversioncontrolsystem(commitmessage='', forceskipped=True, forceunchanged=False)

Synchronizes the local working copy with the version control system. Override this method in custom subclasses.

Parameters
  • commitmessage – Commit message text.

  • forceskipped – Force synchronizing even if the user decided to skip that.

  • forceunchanged – Force synchronizing even if there are no changes to commit.

class VersionControlSystem

Bases: object

A version control system.

Override this for providing an own version control system.

addchange(changetext=None)

Adds a change to the changelog.

Parameters

changetext (Optional[str]) – The changelog entry text (None: input dialog).

Return type

None

addlabel(label=None)

Adds a version label for the current state.

Parameters

label (Optional[str]) – The label string (None: input dialog).

Return type

None

bindvcs(l)

Binds the current project to this version control system. Uses user interaction for getting details like urls. Override this method in custom subclasses or leave the default implementation.

Parameters

l (anise.framework.projects.IntermediateStructure.Let) – The let configuration node for storing additional parameters.

Returns

True if the project was bound successfully.

Return type

bool

branchfromhere(branchname=None)

Creates a new branch from here and switches to it. Unpushed changes will become part of that new branch. Override this method in custom subclasses.

Parameters

branchname (Optional[str]) – The branch name (None: input dialog).

Return type

None

createrawpackage()

Generates a raw package. This package is the basis for most (or all) of the other package types. Override this method in custom subclasses.

Return type

anise.framework.files.Filestructure

fetchrawcommitmessage(revision)

Fetches a raw commit message. Do not use it directly, but getcommitmessage instead. Override this method in custom subclasses or leave the default implementation.

Parameters

revision (int) – The revision.

Returns

The raw commit message as string in a custom format.

Return type

str

findvcs()

Checks if the current project is bound to a version control system of this kind. Override this method in custom subclasses or leave the default implementation.

Return type

bool

getchangelog(asstring=True)

Computes the project change log from information in specially formatted vcs commit messages.

Parameters

asstring (bool) – If to output the changelog as string (instead of an internal data structure).

Return type

Union[str, List[anise.features.versioncontrol.ChangeLogRevision]]

getcommitmessage(revision)

Returns the raw commit message (as formatted by the vcs tool) for a revision.

Parameters

revision (int) – The revision.

Return type

anise.features.versioncontrol.CommitMessage

getcommitmessagefromrawcommitmessage(s)

Gets the actual commit message from the raw fetchrawcommitmessage() commit message output. Do not use it directly, but getcommitmessage() instead. Override this method in custom subclasses or leave the default implementation.

Parameters

s (str) – The raw commit message string.

Return type

anise.features.versioncontrol.CommitMessage

getfullversion()

Returns a complete version string. Override this method in custom subclasses.

Return type

str

getheadrevision()

Gets the head revision. Override this method in custom subclasses or leave the default implementation.

Return type

Optional[int]

getpreviousrevision(revision)

Gets the predecessor revision for a given revision. Override this method in custom subclasses or leave the default implementation.

Parameters

revision (int) – A revision.

Returns

The predecessing revision.

Return type

Optional[int]

storechange(changetext)

Stores a new entry to the changelog.

Do not use this directly, but addchange() instead.

Parameters

changetext (str) – The changelog entry text.

Return type

None

storelabel(label)

Stores a new version label.

Do not use this directly, but addlabel() instead.

Parameters

label (str) – The label string.

Return type

None

syncversioncontrolsystem(commitmessage='', forceskipped=True, forceunchanged=False)

Synchronizes the local working copy with the version control system. Override this method in custom subclasses.

Parameters
  • commitmessage (str) – Commit message text.

  • forceskipped (bool) – Force synchronizing even if the user decided to skip that.

  • forceunchanged (bool) – Force synchronizing even if there are no changes to commit.

Return type

None

static _add_homepage_section()
static _prepare_fallbacks()
static _prepare_vcstasks()
anise.features.versioncontrol.setvcs(vcs)

Sets the version control system for this project.

Parameters

vcs (anise.features.versioncontrol.Internals.VersionControlSystem) – A version control system.

Return type

None

Module contents

High level functionality provided by Anise (read documentation for more!).

Anise features are a plugin system. All high-level functionality of anise is implemented in one of the features that are bundled with Anise. They are loaded by the feature loader anise.framework.features at runtime.