API

Core

System: CLI

class noora.system.App.App(name=None, invoke_without_command=False, no_args_is_help=None, subcommand_metavar=None, chain=False, result_callback=None, **attrs)
get_command(ctx, cmd_name)

Given a context and a command name, this returns a Command object if it exists or returns None.

static initialize_and_get_properties(ctx)

Makes sure the Properties object is initialized and assigned to the context object. :param ctx: The click context :return: a reference to the properties object

list_commands(ctx)

Get the commands based on the context. If ‘project’ is defined on the properties, look up all available plugins for the project’s technology. Else, only return ‘generate’.

Returns:A list of available commands
class noora.system.GenerateCommand.GenerateCommand(name=None, invoke_without_command=False, no_args_is_help=None, subcommand_metavar=None, chain=False, result_callback=None, **attrs)
get_command(ctx, cmd_name)

Given a context and a command name, this returns a Command object if it exists or returns None.

list_commands(ctx)

Return a list of technologies that contain a ‘generate’ package with a cli_outside_scope method

Returns:A list of available technologies

System

class noora.system.Properties.Properties

The properties object analyzes the environment and looks for project settings. The properties instance emulates the dict type.

update_config()

Update the project configuration

noora.system.Ora.nvl(*args)

Return the first argument, or the second argument if the first was not provided. Serves as default value selector.

Utilities

Database interaction

Base classes for database connectivity. For implementations, see Plugin Reference.

class noora.connectors.Connectable.Connectable

Abstract connector class indicating if an object is ‘connectable’, i.e., can connect to a database and execute queries.

class noora.connectors.Connector.Connector

Connector base class. All technology connectors should inherit this.

execute(executable, properties)

Override this method in a subclass

class noora.connectors.ConnectionExecutor.ConnectionExecutor

This class unlocks functionality to execute a list of files in a specified folder, supporting file, folder and extension filtering.

static execute(connector, executor, properties, folder)

Execute all applicable files in the specified folder.

Parameters:

Version tools

Utilities for version checking and manipulation.

class noora.version.Version.Version(value)

Inspection class for a version string.

get_major()

Return major part of the version

get_minor()

Return minor version part, if applicable

get_patch()

Get patch version, if applicable

get_revision()

Return revision part, if applicable

get_value()

Get version

get_weight()

Return weight of the version

has_major()

Return True if version has a major part

has_minor()

Return True if version has a minor part

has_patch()

Return True if version has a patch part

has_revision()

Return True if version has a revision part

class noora.version.Versions.Versions

Management class for handling versions of a project. Useful for inspecting and testing the versions on a project and to manage updating projects to specific versions.

add(version)

Add a version to the list

clear()

Remove all versions from the class

exists(other)

Check if the specified version exists

get_part(version)

Return the number of parts in the specified version

last()

Return the last version in the list

list()

Return the list of versions

next()

Calculate the next version number based on the last version in the list, incrementing the smallest version component by one depending on the number of parts.

previous(other)

Return the version that precedes the provided version

sort()

Sort the versions by weight

class noora.version.VersionLoader.VersionLoader(versions)

Class providing functionality to determine all versions on the current project.

load(properties)

Find all versions on the current project and add them to the list.

Parameters:properties – An instance of noora.system.Properties.Properties.
class noora.version.VersionGuesser.VersionGuesser(properties, versions)

Utilities for inspecting current version of a project

guess(version=None)

Do some guessing based on the current version.

Parameters:(optional) (version) – if provided, find the version in the list. If not provided, find the next version on the project;
Returns:The current (if found) or next version, or the default version if all else fails.

Shell tools

Functionality for interacting with the shell. Mainly used by connectors.

class noora.shell.Shell.Shell

Shell interaction

static execute(call)

Execute the command in call. Returns the standard output if execution was successful, raises an exception with results from standard error otherwise.

Parameters:call

A dictionary, containing:

  • args: The command to execute as a string;
  • stdout: File-like object to write standard output to (optional);
  • stderr: File-like object to write standard error to (optional);
  • stdin: File-like object to read standard input from (optional);
  • startupinfo: Extra flags (optional).
Returns:The result from standard output.
class noora.shell.CallFactory.CallFactory

Factory for creating call instances

class noora.shell.StartupInfoFactory.StartupInfoFactory

Factory for creating startup info instances

Template processing

class noora.processor.PreProcessor.PreProcessor

Template parser

static parse(file, properties)

Parse the template and replace all keys if applicable.

Parameters:
  • file (noora.io.File.File) – The file to process;
  • properties (dict) – All keys to replace in the file with their respective values;
Returns:

The parsed file as a string.

Argument checking

Mainly used by plugins to check plugin arguments against the project settings.

class noora.plugins.Fail.Fail

Class providing assertion methods for various attributes. PluginExceptions will be raised when an assertion fails.

static fail_on_blocked_hosts(host, properties)

Make sure that host is not in the list of blocked hosts

static fail_on_invalid_alias(alias, properties)

Verify that alias is valid for this project

static fail_on_invalid_database(database, properties)

Verify that database is valid for this project

static fail_on_invalid_environment(environment, properties)

Verify that environment is valid for this project

static fail_on_invalid_host(host, properties)

Verify that host is in the host list for this project

Parameters:
  • host – The host to look up
  • host_list – Properties containing the host list
static fail_on_invalid_schema(schema, properties)

Verify that schema is valid for this project

static fail_on_no_database(database)

Verify that database is a string

static fail_on_no_host(host)

Verify that host is a string

static fail_on_no_port(port)

Verify that port is an integer

static fail_on_no_schema(schema)

Verify that schema is a string

static fail_on_no_user(user)

Verify that user is a string

static fail_on_no_users(users)

Verify that users is a list

static fail_on_no_version(version)

Verify that version is a string

static fail_on_unknown_version(version, properties)

Verify that version is valid for this project

File utilities

To be expanded.

class noora.io.File.File(url=None)

File management functionality. Initialize a file object with its path (url).

exists()

Check if the file exists.

extension()

Get the file’s extension

get_url()

Return the path to the file

head()

Returns the head part after splitting the File’s url.

is_dir()

Returns True if url points to a directory, False otherwise.

is_file()

Returns True if url points to a file, false if not (e.g. when the file is a directory).

tail()

Returns the tail part after splitting the File’s url.