bibliotekar.Module#

class bibliotekar.Module(content, script_metadata, script_metadata_span, *, name)[source]#

A Python module or script.

This class does not distinguish between scripts and modules. It supports PEP723 - Inline script metadata for both even though that metadata is technically only meant for scripts.

__init__(content, script_metadata, script_metadata_span, *, name)[source]#

Methods

__init__(content, script_metadata, ...)

load(path)

Load a module or script from a file.

save(path)

Save the module to a file.

tracking_data()

Return the tracking metadata associated with the module, if any.

with_tracking_data(metadata)

Return a new module with new tracking metadata.

classmethod load(path)[source]#

Load a module or script from a file.

Return type:

Module

save(path)[source]#

Save the module to a file.

Return type:

None

tracking_data()[source]#

Return the tracking metadata associated with the module, if any.

Return type:

TrackingData | None

with_tracking_data(metadata)[source]#

Return a new module with new tracking metadata.

Return type:

Module