ietfbib2bibtex package

ietfbib2bibtex module

This library aims to convert the XML-based formats of the IETF bibxml and rfc-index) to bibtex format.

ietfbib2bibtex.bib module

Bibliography representation

class ietfbib2bibtex.bib.Bib(bib_config: Bib, bib_path=None)[source]

Bases: object

Representation of a bibliography.

classmethod create_all_bibtexs(the_config: Config)[source]

Create bibtex files for all bibliographies in configuration.

Py:param the_config:

ietfbib2bibtex.config.Config object for configuration

create_bibtex()[source]

Create bibtex file name.bib from bibliography source.

iterate()[source]

Iterate over all valid entries of the source of the bibliography.

ietfbib2bibtex.cli module

CLI definitions

ietfbib2bibtex.cli.main()[source]

The main command: Take IETF bibliographies from configuration file (taken from CLI arguments if provided) and create bibtex format files from all of them.

ietfbib2bibtex.cli.parse_args()[source]

Parse arguments for main command.

ietfbib2bibtex.config module

Configuration

class ietfbib2bibtex.config.Bib(*, name: str, rfc_index: RFCIndexSource | None = None, bibxml_ids: BibXMLIDsSource | None = None)[source]

Bases: BaseModel

Bibliography configuration validation model.

bibxml_ids: BibXMLIDsSource | None
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'bibxml_ids': FieldInfo(annotation=Union[BibXMLIDsSource, NoneType], required=False, default=None, validate_default=True), 'name': FieldInfo(annotation=str, required=True), 'rfc_index': FieldInfo(annotation=Union[RFCIndexSource, NoneType], required=False, default=None)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

name: str
rfc_index: RFCIndexSource | None
class ietfbib2bibtex.config.BibXMLIDsSource(*, remote: str, local: str)[source]

Bases: Source

rsync://rsync.ietf.org/bibxml-ids/ source configuration validation model.

local: str
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'local': FieldInfo(annotation=str, required=True), 'remote': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

class ietfbib2bibtex.config.Config(_case_sensitive: bool | None = None, _nested_model_default_partial_update: bool | None = None, _env_prefix: str | None = None, _env_file: DotenvType | None = PosixPath('.'), _env_file_encoding: str | None = None, _env_ignore_empty: bool | None = None, _env_nested_delimiter: str | None = None, _env_parse_none_str: str | None = None, _env_parse_enums: bool | None = None, _cli_prog_name: str | None = None, _cli_parse_args: bool | list[str] | tuple[str, ...] | None = None, _cli_settings_source: CliSettingsSource[Any] | None = None, _cli_parse_none_str: str | None = None, _cli_hide_none_type: bool | None = None, _cli_avoid_json: bool | None = None, _cli_enforce_required: bool | None = None, _cli_use_class_docs_for_groups: bool | None = None, _cli_exit_on_error: bool | None = None, _cli_prefix: str | None = None, _cli_implicit_flags: bool | None = None, _secrets_dir: PathType | None = None, *, bibpath: str | None = None, bibs: List[Bib] = [])[source]

Bases: BaseSettings

Base settings validation model.

bibpath: str | None
bibs: List[Bib]
classmethod from_file(config_file: str | None = None)[source]

Read configuration from file.

Parameters:

config_file – Name of the configuration file.

Returns:

Config object generated from file.

model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[SettingsConfigDict] = {'arbitrary_types_allowed': True, 'case_sensitive': False, 'cli_avoid_json': False, 'cli_enforce_required': False, 'cli_exit_on_error': True, 'cli_hide_none_type': False, 'cli_implicit_flags': False, 'cli_parse_args': None, 'cli_parse_none_str': None, 'cli_prefix': '', 'cli_prog_name': None, 'cli_settings_source': None, 'cli_use_class_docs_for_groups': False, 'env_file': None, 'env_file_encoding': None, 'env_ignore_empty': False, 'env_nested_delimiter': None, 'env_parse_enums': None, 'env_parse_none_str': None, 'env_prefix': '', 'extra': 'forbid', 'json_file': None, 'json_file_encoding': None, 'nested_model_default_partial_update': False, 'protected_namespaces': ('model_', 'settings_'), 'secrets_dir': None, 'toml_file': None, 'validate_default': True, 'yaml_file': None, 'yaml_file_encoding': None}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'bibpath': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'bibs': FieldInfo(annotation=List[Bib], required=False, default=[])}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

class ietfbib2bibtex.config.RFCIndexSource(*, remote: str)[source]

Bases: Source

rfc-index.xml source configuration validation model.

model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'remote': FieldInfo(annotation=str, required=True, validate_default=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

class ietfbib2bibtex.config.Source(*, remote: str)[source]

Bases: BaseModel

Base bibliography source configuration validation model.

model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'remote': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

remote: str

ietfbib2bibtex.sources module

Bibliography sources

class ietfbib2bibtex.sources.BibXMLIDsSource(bibxml_ids_source_config: BibXMLIDsSource)[source]

Bases: Source

rsync://rsync.ietf.org/bibxml-ids/ source.

iterate_entries()[source]

Iterate over all valid entries of the bibliography source.

property local

The directory for the bibliography source.

property remote

The remote resource of the bibliography source.

class ietfbib2bibtex.sources.RFCIndexSource(rfc_index_config: RFCIndexSource)[source]

Bases: Source

rfc-index.xml source.

iterate_entries()[source]

Iterate over all valid entries of the bibliography source.

property remote

The remote resource of the bibliography source.

class ietfbib2bibtex.sources.Source[source]

Bases: ABC

Base class for a bibliography source.

abstract iterate_entries()[source]

Iterate over all valid entries of the bibliography source.

abstract property remote

The remote resource of the bibliography source.