journal_manager.core.api module

Core methods that form the journal-manager api.

journal_manager.core.api.create_configuration_file(journal_folder_default: Path, templates_folder_default: Path)[source]

Create journal-manager application configuration file.

Additionally, it creates two more configuration files:
  • journal_data.toml

  • template_data.toml

and a folder to store journal templates.

Parameters:
  • journal_folder_default (Path) – Default location to store journals.

  • templates_folder_default (Path) – Default location to store journal templates.

  • text_editor_default – Path to the default editor used by journal-manager.

journal_manager.core.api.find_journal(journal_data_file: JournalDataList, journal_components: JournalData, logic_operator: LogicOperator) List[JournalData][source]

Search among the registered journals all entries that matches the query.

The journal_components is an instance of JournalData. Attributes with a None value are not considered in the search.

Parameters:
  • journal_data_file (JournalDataList) – Dataclass representation of the journal register file.

  • journal_components (JournalData) – Journal attributes being searched.

  • logic_operator (LogicOperator) – If OR, all journals matching at least one attribute are returned. If AND, a journal must match all attributes to be returned.

Return type:

List[JournalData]

journal_manager.core.api.find_journal_by_location(journal_data_file: JournalDataList, journal_location: str) JournalData | None[source]

Search a registered journal by location.

If the journal is not found, a None object is returned.

Parameters:
  • journal_data_file (JournalDataList) – Dataclass representation of the journal register file.

  • journal_location (str) – Path to the journal folder.

Return type:

JournalData | None

journal_manager.core.api.find_journal_by_name(journal_data_file: JournalDataList, journal_name: str) JournalData | None[source]

Search a registered journal by name.

If the journal is not found, a None object is returned.

Parameters:
  • journal_data_file (JournalDataList) – Dataclass representation of the journal register file.

  • journal_name (str) – Journal name.

Return type:

JournalData | None

journal_manager.core.api.find_template_by_name(template_file: JournalTemplateList, template_name: str) JournalTemplate | None[source]

Search a registered template by name.

If the template is not found, a None object is returned.

Parameters:
  • template_file (JournalTemplateList) – Dataclass representation of the journal template register file.

  • template_name (str) – Template name.

Return type:

JournalTemplate | None

journal_manager.core.api.get_configuration_file() ConfigurationFile[source]

Return ConfigurationFile dataclass instantiated from the configuration file.

Raises:

ConfigurationFileDoesNotExist – if configuration file does not exist.

Return type:

ConfigurationFile

journal_manager.core.api.get_configuration_filepath()[source]

Return the path to the journal-manager configuration file.

journal_manager.core.api.get_configuration_folder() Path[source]

Return the value stored by environment variable JOURNAL_MANAGER_CONFIG_FOLDER

Raises:

ConfigurationFolderDoesNotExist – if JOURNAL_MANAGER_CONFIG_FOLDER is not set.

Return type:

Path

journal_manager.core.api.get_journal_data_file() JournalDataList[source]

Return JournalDataList dataclass instantiated from the journals register file.

Return type:

JournalDataList

journal_manager.core.api.get_template_list_file() JournalTemplateList[source]

Return JournalTemplateList dataclass instantiated from the templates register file.

Return type:

JournalTemplateList

journal_manager.core.api.is_valid_template_path(template_path: Path)[source]

Validates a journal templates folder.

The journal template folder must contain the file mkdocs.tpl.yml.

Parameters:

template_path (Path) – The journal template folder to check.

journal_manager.core.api.update_journal(journal_data_file: JournalDataList, journal_data: JournalData)[source]

Update journal entry in the journal data file.

Parameters:
  • journal_data_file (JournalDataList) – Dataclass representation of the journal register file.

  • journal_data (JournalData) – Updated journal.