Skip to content

_loader: Adding LoadContext

Tristan Van Berkom requested to merge tristan/load-context into master

Instead of passing around many details though calling signatures throughout the loader code, create a single LoadContext object which holds any overall loading state along with any values which are constant to a full load process.

Overall this patch does:

  • _frontend/app.py: No need to pass Stream.fetch_subprojects() along anymore

  • _loader/loadelement.pyx: collect_element_no_deps() no longer takes a task argument

  • _loader/loader.py: Now the Loader has a load_context member, and no more _fetch_subprojects member or _context members

    Further, rewritable and ticker is no longer passed along through all of the recursing calling signatures, and ticker itself is finally removed because this has been replaced a long time ago with Task API from State.

  • _pipeline.py: The load() function no longer has a rewritable parameter

  • _project.py: The Project() is responsible for creating the toplevel LoadContext() if one doesn't exist yet, and this is passed through to the Loader() (and also passed to the Project() constructor by the Loader() when instantiating subprojects).

  • _stream.py: The Stream._fetch_subprojects() is now private and set on the project when giving the Project to the Stream in Stream.set_project(), also the Stream() sets the rewritable state on the LoadContext at the earliest opportunity, as the Stream() is the one who decides this detail.

    Further, some double underscore private functions are now regular single underscores, there was no reason for this inconsistency.

Merge request reports