pydmt.api package — pydmt Documentation

# pydmt.api package

## Submodules

## pydmt.api.builder module

builder.py

class pydmt.api.builder.Builder

  Bases: `ABC`

  A Builder is what really builds things in the system. A builder knows on which inputs it relies and what outputs it generates (sometimes before build and sometimes after).

  abstractmethod build() → None

    this method actually does the building Just do whatever you want here. Options are: - Write pure python code - Call native code - Call external programs - A combination of the above If there are any problems then throw an exception. Try not to segfault the interpreter in this method…:)

  get_name() → str

    Override this to get better names :return: the name of this builder

  get_signature() → str

    return the sha1 of anything that identifies the sources of the build Techically this is the sha1 of the file content of the list of files returned from `get_sources()`

  abstractmethod get_sources() → Sequence[Node]

    return the name of the source files for this builder If the builder takes a whole folder the list all the filers in that folder. If a built takes all the .py files in a folder then list those. In the current implementation this method is not really that important because it is not used to calculate the signature of the input to the build. The @get_signature method is use for that. In the future the get_signature method will go away.

  abstractmethod get_targets() → Sequence[Node]

    return list of targets

  get_targets_as_string() → str
  abstractmethod yield_results() → Generator[tuple[str, str], None, None]

    Return the signatures and names of results :return:

class pydmt.api.builder.File(filename: str)

  Bases: `Node`

  This is a node which is a file

  add_to_digester(d: Digester) → None
  get_name()
  remove()

class pydmt.api.builder.Folder(folder: str)

  Bases: `Node`

  This is a node representing a single Folder

  add_to_digester(d: Digester) → None
  get_name()
  remove()

class pydmt.api.builder.Node

  Bases: `ABC`

  This is a source object which knows how to add his checksum to a checksum calculation

  abstractmethod add_to_digester(d: Digester) → None
  abstractmethod get_name() → str
  abstractmethod remove() → None

class pydmt.api.builder.SourceFile(filename: str)

  Bases: `File`

class pydmt.api.builder.SourceFiles(filenames: list[str], name: str)

  Bases: `Node`

  This is a source of many files

  add_to_digester(d: Digester) → None
  get_name()
  remove()

class pydmt.api.builder.SourceFolder(folder: str)

  Bases: `Folder`

class pydmt.api.builder.TargetFile(filename: str)

  Bases: `File`

class pydmt.api.builder.TargetFolder(folder: str)

  Bases: `Folder`

## pydmt.api.copy module

copy.py

class pydmt.api.copy.Copy(source: str, target: str)

  Bases: `OneSourceOneTarget`

  build()

    this method actually does the building Just do whatever you want here. Options are: - Write pure python code - Call native code - Call external programs - A combination of the above If there are any problems then throw an exception. Try not to segfault the interpreter in this method…:)

## pydmt.api.fail module

fail.py

class pydmt.api.fail.Fail(source: str, target: str)

  Bases: `OneSourceOneTarget`

  This is a builder that fails. Why do we need it? Tests Why does it need a source and target? Because otherwise it would not get triggered

  build()

    this method actually does the building Just do whatever you want here. Options are: - Write pure python code - Call native code - Call external programs - A combination of the above If there are any problems then throw an exception. Try not to segfault the interpreter in this method…:)

## pydmt.api.feature module

feature.py

class pydmt.api.feature.Feature

  Bases: `ABC`

  A Feature is a piece of code that adds builder to a pydmt system in a predefined way. This is a way to share common practices between projects.

  Examples of features can be: - all the rules about how to build a python module with documentation and release it. - all the rules about how to build a C project and release it.

  These are similar to facets or natures in development environments.

  abstractmethod setup(pydmt: PyDMT) → None

    build your feature here

## pydmt.api.one_source_one_target module

one_source_one_target.py

class pydmt.api.one_source_one_target.OneSourceOneTarget(source: str, target: str)

  Bases: `Builder`

  This is a builder which has one source file and one target file

  get_sources() → Sequence[Node]

    return the name of the source files for this builder If the builder takes a whole folder the list all the filers in that folder. If a built takes all the .py files in a folder then list those. In the current implementation this method is not really that important because it is not used to calculate the signature of the input to the build. The @get_signature method is use for that. In the future the get_signature method will go away.

  get_targets() → Sequence[Node]

    return list of targets

  yield_results() → Generator[tuple[str, str], None, None]

    Return the signatures and names of results :return:

## Module contents

__init__.py