module pycode.build_helper

Short summary

module pyquickhelper.pycode.build_helper

Produces a build file for a module following pyquickhelper design.

source on GitHub

Functions

function

truncated documentation

choose_path

Returns the first path which exists in the list.

get_build_script

Builds the build script which builds the setup, run the unit tests and the documentation.

get_extra_script_command

Produces a script which runs the notebook, a documentation server, which publishes…

get_pyproj_project

returns a string which corresponds to a pyproj project

get_script_command

Produces a script which runs a command available through the setup.

get_script_module

Produces a script which runs the notebook, a documentation server, which publishes and other scripts.

private_path_choice

Custom logic to reference other currently developped modules.

private_replacement_

Less copy/paste.

private_script_replacements

Runs last replacements.

Documentation

Produces a build file for a module following pyquickhelper design.

source on GitHub

pyquickhelper.pycode.build_helper._default_nofolder = '__NOFOLDERSHOULDNOTEXIST39__'[source]

nickname for no folder

pyquickhelper.pycode.build_helper.choose_path(*paths)[source]

Returns the first path which exists in the list.

Parameters:

paths – list of paths

Returns:

a path

source on GitHub

pyquickhelper.pycode.build_helper.get_build_script(module, requirements=None, port=8067, default_engine_paths=None, additional_local_path=None)[source]

Builds the build script which builds the setup, run the unit tests and the documentation.

Parameters:
  • module – module name

  • requirements – list of dependencies (not in your python distribution)

  • port – port for the local pypi_server which gives the dependencies

  • default_engine_paths – define the default location for python engine, should be dictionary { engine: path }, see below.

  • additional_local_path – additional paths to add to PYTHONPATH

Returns:

scripts

source on GitHub

pyquickhelper.pycode.build_helper.get_extra_script_command(command, module, requirements, port=8067, blog_list=None, platform='linux', default_engine_paths=None, unit_test_folder=None, unittest_modules=None, additional_notebook_path=None, additional_local_path=None)[source]

Produces a script which runs the notebook, a documentation server, which publishes…

Parameters:
  • command – command to run (notebook, publish, publish_doc, local_pypi, setupdep, run27, build27, copy_dist, any_setup_command, lab)

  • module – module name

  • requirements – list of dependencies (not in your python distribution)

  • port – port for the local pypi_server which gives the dependencies

  • blog_list – list of blog to listen for this module (usually stored in module.__blog__)

  • platform – platform (only Windows)

  • default_engine_paths – define the default location for python engine, should be dictionary { engine: path }, see below.

  • unit_test_folder – unit test folders, used for command run27

  • additional_notebook_path – additional paths to add when running the script launching the notebooks

  • additional_local_path – additional paths to add when running a local command

  • unittest_modules – list of modules to be used during unit tests

Returns:

scripts

The available list of commands is given by function process_standard_options_for_setup.

source on GitHub

pyquickhelper.pycode.build_helper.get_pyproj_project(name, file_list)[source]

returns a string which corresponds to a pyproj project

Parameters:
  • name – project name

  • file_list – file_list

Returns:

string

source on GitHub

pyquickhelper.pycode.build_helper.get_script_command(command, module, requirements, port=8067, platform='linux', default_engine_paths=None, additional_local_path=None)[source]

Produces a script which runs a command available through the setup.

Parameters:
  • command – command to run

  • module – module name

  • requirements – list of dependencies (not in your python distribution)

  • port – port for the local pypi_server which gives the dependencies

  • platform – platform (only Windows)

  • default_engine_paths – define the default location for python engine, should be dictionary { engine: path }, see below.

  • additional_local_path – additional local path to add before running command setup.py <command>

Returns:

scripts

The available list of commands is given by function process_standard_options_for_setup.

source on GitHub

pyquickhelper.pycode.build_helper.get_script_module(command, platform='linux', blog_list=None, default_engine_paths=None)[source]

Produces a script which runs the notebook, a documentation server, which publishes and other scripts.

Parameters:
  • command – command to run (blog)

  • platform – platform (only Windows)

  • blog_list – list of blog to listen for this module (usually stored in module.__blog__)

  • default_engine_paths – define the default location for python engine, should be dictionary { engine: path }, see below.

Returns:

scripts

The available list of commands is given by function process_standard_options_for_setup.

source on GitHub

pyquickhelper.pycode.build_helper.private_path_choice(path)[source]

Custom logic to reference other currently developped modules.

source on GitHub

pyquickhelper.pycode.build_helper.private_replacement_(script, paths, key='__ADDITIONAL_LOCAL_PATH__')[source]

Less copy/paste.

source on GitHub

pyquickhelper.pycode.build_helper.private_script_replacements(script, module, requirements, port, raise_exception=True, platform='linux', default_engine_paths=None, additional_local_path=None)[source]

Runs last replacements.

Parameters:
  • script – script or list of scripts

  • module – module name

  • requirements – requirements - (list or 2-uple of lists)

  • port – port

  • raise_exception – raise an exception if there is an error, otherwise, return None

  • platform – platform

  • default_engine_paths – define the default location for python engine, should be dictionary { engine: path }, see below.

  • additional_local_path – additional local path to add to PYTHONPATH

Returns:

modified script

An example for default_engine_paths:

default_engine_paths = {
    "windows": {
        "__PY35__": None,
        "__PY36_X64__": "c:\Python365_x64",
        "__PY37_X64__": "c:\Python372_x64",
        "__PY38_X64__": "c:\Python387_x64",
        "__PY39_X64__": "c:\Python391_x64",
        "__PY310_X64__": "c:\Python3101_x64",
    },
}

Parameter requirements can a list of requirements, we assume these requirements are available from a local PyPi server. There can be extra requirements obtained from PiPy. In that case, those can be specified as a tuple (requirements_local, requirements_pipy).

The function replaces rem _PATH_VIRTUAL_ENV_ with an instruction to copy these DLLs. Parameter requirements can be a list or a tuple.

source on GitHub