pydmt.builders package — pydmt Documentation

# pydmt.builders package

## Submodules

## pydmt.builders.apt module

This is a module that will install OS packages for you.

class pydmt.builders.apt.BuilderApt(source: str, target: str, packages: list[str], packages_remove: list[str])

  Bases: `OneSourceOneTarget`

  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…:)

## pydmt.builders.gem module

This module installs gem modules

class pydmt.builders.gem.Installer(source: str, target: str)

  Bases: `OneSourceOneTarget`

  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…:)

## pydmt.builders.make module

This module runs make

class pydmt.builders.make.BuilderMake(source: str, target: str)

  Bases: `OneSourceOneTarget`

  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…:)

## pydmt.builders.mako module

mako.py

class pydmt.builders.mako.BuilderMako(source: str, target: str, data: dict[str, object] | None, config_files: list[str], snipplet_files: list[str])

  Bases: `Builder`

  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…:)

  get_sources() → list[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() → list[Node]

    return list of targets

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

    Return the signatures and names of results :return:

pydmt.builders.mako.print_exception(e, input_file)

pydmt.builders.mako.print_full_exception()

## pydmt.builders.npm module

This module installs npm packages

class pydmt.builders.npm.Installer(source: str, target: str)

  Bases: `OneSourceOneTarget`

  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…:)

## pydmt.builders.reqs module

Install requirements

class pydmt.builders.reqs.BuilderReqs(source: str, target: str)

  Bases: `OneSourceOneTarget`

  This is a review of how to build a python virtual environment: # create the virtualenv virtualenv [folder] # activate it source [folder]/bin/activate # install packages from file pip install -r requirements.txt # OR python -m pip install -r requirements.txt # OR if you want to install a list of packages: pip install -r [list of packages] # OR python -m pip install [list of packages]

  build() → None

    If we check if there is a “requirements.txt” file with frozen requirements and install it if there is.

    If we do not have a frozen requirements we install from config/{python|bootstrap}.py Why do we do this in two stages? What’s wrong with doing this in one stage? Because importing python.py may fail because of prereqs that python.py needs. In this case the user specifies these prereqs in bootstrap.py

## pydmt.builders.sphinx module

This is the module which is in charge of running sphinx to generate automatic documentation.

TODO maybe call sphinx programatically and this way we would not have to set the PYTHONPATH and get better integration with sphinx?

class pydmt.builders.sphinx.BuilderSphinx(source_folder: str = 'sphinx', target_folder: str = 'docs')

  Bases: `Builder`

  This is review of how to build a sphinx documentation: - if you want documentation for the code you need to run “sphinx-apidoc” - it will generate files that describe every sub package in your package. - after this you run “sphinx-build” - “sphinx-quickstart” is not needed unless you are starting a new project.

  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_sources() → list[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() → list[Node]

    return list of targets

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

    Return the signatures and names of results :return:

## pydmt.builders.venv module

This module builds python virtual envrionments

class pydmt.builders.venv.BuilderVenv(source: str, target: str)

  Bases: `OneSourceOneTarget`

  This is a review of how to build a python virtual environment: # create the virtualenv virtualenv [folder] # activate it source [folder]/bin/activate # install package pip install -r requirements.txt

  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…:)

## pydmt.builders.yaml module

yaml.py

class pydmt.builders.yaml.BuilderYaml(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…:)

## Module contents