Skip to content
Projects

Quickstart

First, ensure that template-python is installed.

After installation, you can run the application with:

template-python

which calls app.main.main and prints a greeting.

from app.main import main
main()

See the API reference for every module and function.

template-python’s coarse operations are scope-profiler regions (template_python.main here), tagged with the opt-in tag template_python: they are off by default and cost a fraction of a microsecond per call. A code that profiles itself with scope-profiler turns them on with the tag:

import scope_profiler as sp
sp.setup(enable_tags=["template_python"])

or without editing the code, with SCOPE_PROFILER_ENABLE_TAGS=template_python, scope-profiler run --enable-tag template_python or enable_tags = ["template_python"] in the TOML configuration. New regions use @sp.profile("template_python.<name>", tags=PROFILE_TAGS) with PROFILE_TAGS from the package’s _profiling module.