Fix API issues and update schema (#358)

This commit is contained in:
Sina Atalay
2025-02-16 20:30:03 -05:00
parent 0318d26854
commit 8385b529e9
15 changed files with 618 additions and 738 deletions

View File

@@ -1,4 +1,3 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/rendercv/rendercv/refs/tags/v2.2/schema.json
cv:
name: John Doe
location: Location
@@ -113,112 +112,6 @@ cv:
- reversed_number: This is the third reversed numbered entry.
design:
theme: classic
page:
size: us-letter
top_margin: 2cm
bottom_margin: 2cm
left_margin: 2cm
right_margin: 2cm
show_page_numbering: true
show_last_updated_date: true
colors:
text: rgb(0, 0, 0)
name: rgb(0, 79, 144)
connections: rgb(0, 79, 144)
section_titles: rgb(0, 79, 144)
links: rgb(0, 79, 144)
last_updated_date_and_page_numbering: rgb(128, 128, 128)
text:
font_family: Source Sans 3
font_size: 10pt
leading: 0.6em
alignment: justified
date_and_location_column_alignment: right
links:
underline: false
use_external_link_icon: true
header:
name_font_family: Source Sans 3
name_font_size: 30pt
name_bold: true
small_caps_for_name: false
photo_width: 3.5cm
vertical_space_between_name_and_connections: 0.7cm
vertical_space_between_connections_and_first_section: 0.7cm
horizontal_space_between_connections: 0.5cm
connections_font_family: Source Sans 3
separator_between_connections: ''
use_icons_for_connections: true
use_urls_as_placeholders_for_connections: false
make_connections_links: true
alignment: center
section_titles:
type: with-partial-line
font_family: Source Sans 3
font_size: 1.4em
bold: true
small_caps: false
line_thickness: 0.5pt
vertical_space_above: 0.5cm
vertical_space_below: 0.3cm
entries:
date_and_location_width: 4.15cm
left_and_right_margin: 0.2cm
horizontal_space_between_columns: 0.1cm
vertical_space_between_entries: 1.2em
allow_page_break_in_sections: true
allow_page_break_in_entries: true
short_second_row: false
show_time_spans_in: []
highlights:
bullet:
nested_bullet: '-'
top_margin: 0.25cm
left_margin: 0.4cm
vertical_space_between_highlights: 0.25cm
horizontal_space_between_bullet_and_highlight: 0.5em
summary_left_margin: 0cm
entry_types:
one_line_entry:
template: '**LABEL:** DETAILS'
education_entry:
main_column_first_row_template: '**INSTITUTION**, AREA'
degree_column_template: '**DEGREE**'
degree_column_width: 1cm
main_column_second_row_template: |-
SUMMARY
HIGHLIGHTS
date_and_location_column_template: |-
LOCATION
DATE
normal_entry:
main_column_first_row_template: '**NAME**'
main_column_second_row_template: |-
SUMMARY
HIGHLIGHTS
date_and_location_column_template: |-
LOCATION
DATE
experience_entry:
main_column_first_row_template: '**COMPANY**, POSITION'
main_column_second_row_template: |-
SUMMARY
HIGHLIGHTS
date_and_location_column_template: |-
LOCATION
DATE
publication_entry:
main_column_first_row_template: '**TITLE**'
main_column_second_row_template: |-
AUTHORS
URL (JOURNAL)
main_column_second_row_without_journal_template: |-
AUTHORS
URL
main_column_second_row_without_url_template: |-
AUTHORS
JOURNAL
date_and_location_column_template: DATE
locale:
language: en
phone_number_format: national
@@ -259,5 +152,4 @@ locale:
- December
rendercv_settings:
date: '2025-02-16'
render_command:
bold_keywords: []

View File

@@ -1,4 +1,3 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/rendercv/rendercv/refs/tags/v2.2/schema.json
cv:
name: John Doe
location: Location
@@ -113,106 +112,6 @@ cv:
- reversed_number: This is the third reversed numbered entry.
design:
theme: engineeringclassic
page:
size: us-letter
top_margin: 2cm
bottom_margin: 2cm
left_margin: 2cm
right_margin: 2cm
show_page_numbering: false
show_last_updated_date: true
colors:
text: rgb(0, 0, 0)
name: rgb(0, 79, 144)
connections: rgb(0, 79, 144)
section_titles: rgb(0, 79, 144)
links: rgb(0, 79, 144)
last_updated_date_and_page_numbering: rgb(128, 128, 128)
text:
font_family: Raleway
font_size: 10pt
leading: 0.6em
alignment: justified
date_and_location_column_alignment: right
links:
underline: false
use_external_link_icon: false
header:
name_font_family: Raleway
name_font_size: 30pt
name_bold: false
small_caps_for_name: false
photo_width: 3.5cm
vertical_space_between_name_and_connections: 0.7cm
vertical_space_between_connections_and_first_section: 0.7cm
horizontal_space_between_connections: 0.5cm
connections_font_family: Raleway
separator_between_connections: ''
use_icons_for_connections: true
use_urls_as_placeholders_for_connections: false
make_connections_links: true
alignment: left
section_titles:
type: with-partial-line
font_family: Raleway
font_size: 1.4em
bold: false
small_caps: false
line_thickness: 0.5pt
vertical_space_above: 0.5cm
vertical_space_below: 0.3cm
entries:
date_and_location_width: 4.15cm
left_and_right_margin: 0.2cm
horizontal_space_between_columns: 0.1cm
vertical_space_between_entries: 1.2em
allow_page_break_in_sections: true
allow_page_break_in_entries: true
short_second_row: false
show_time_spans_in: []
highlights:
bullet:
nested_bullet: '-'
top_margin: 0.25cm
left_margin: 0cm
vertical_space_between_highlights: 0.25cm
horizontal_space_between_bullet_and_highlight: 0.5em
summary_left_margin: 0cm
entry_types:
one_line_entry:
template: '**LABEL:** DETAILS'
education_entry:
main_column_first_row_template: '**INSTITUTION**, AREA -- LOCATION'
degree_column_template: '**DEGREE**'
degree_column_width: 1cm
main_column_second_row_template: |-
SUMMARY
HIGHLIGHTS
date_and_location_column_template: DATE
normal_entry:
main_column_first_row_template: '**NAME** -- **LOCATION**'
main_column_second_row_template: |-
SUMMARY
HIGHLIGHTS
date_and_location_column_template: DATE
experience_entry:
main_column_first_row_template: '**POSITION**, COMPANY -- LOCATION'
main_column_second_row_template: |-
SUMMARY
HIGHLIGHTS
date_and_location_column_template: DATE
publication_entry:
main_column_first_row_template: '**TITLE**'
main_column_second_row_template: |-
AUTHORS
URL (JOURNAL)
main_column_second_row_without_journal_template: |-
AUTHORS
URL
main_column_second_row_without_url_template: |-
AUTHORS
JOURNAL
date_and_location_column_template: DATE
locale:
language: en
phone_number_format: national
@@ -253,5 +152,4 @@ locale:
- December
rendercv_settings:
date: '2025-02-16'
render_command:
bold_keywords: []

View File

@@ -1,4 +1,3 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/rendercv/rendercv/refs/tags/v2.2/schema.json
cv:
name: John Doe
location: Location
@@ -113,107 +112,6 @@ cv:
- reversed_number: This is the third reversed numbered entry.
design:
theme: engineeringresumes
page:
size: us-letter
top_margin: 2cm
bottom_margin: 2cm
left_margin: 2cm
right_margin: 2cm
show_page_numbering: false
show_last_updated_date: true
colors:
text: rgb(0, 0, 0)
name: rgb(0, 0, 0)
connections: rgb(0, 0, 0)
section_titles: rgb(0, 0, 0)
links: rgb(0, 0, 0)
last_updated_date_and_page_numbering: rgb(128, 128, 128)
text:
font_family: XCharter
font_size: 10pt
leading: 0.6em
alignment: justified
date_and_location_column_alignment: right
links:
underline: true
use_external_link_icon: false
header:
name_font_family: XCharter
name_font_size: 25pt
name_bold: false
small_caps_for_name: false
photo_width: 3.5cm
vertical_space_between_name_and_connections: 0.7cm
vertical_space_between_connections_and_first_section: 0.7cm
horizontal_space_between_connections: 0.5cm
connections_font_family: XCharter
separator_between_connections: '|'
use_icons_for_connections: false
use_urls_as_placeholders_for_connections: true
make_connections_links: true
alignment: center
section_titles:
type: with-partial-line
font_family: XCharter
font_size: 1.2em
bold: true
small_caps: false
line_thickness: 0.5pt
vertical_space_above: 0.55cm
vertical_space_below: 0.3cm
line_type: with-full-line
entries:
date_and_location_width: 4.15cm
left_and_right_margin: 0cm
horizontal_space_between_columns: 0.1cm
vertical_space_between_entries: 0.4cm
allow_page_break_in_sections: true
allow_page_break_in_entries: true
short_second_row: false
show_time_spans_in: []
highlights:
bullet:
nested_bullet: '-'
top_margin: 0.25cm
left_margin: 0cm
vertical_space_between_highlights: 0.19cm
horizontal_space_between_bullet_and_highlight: 0.3em
summary_left_margin: 0cm
entry_types:
one_line_entry:
template: '**LABEL:** DETAILS'
education_entry:
main_column_first_row_template: '**INSTITUTION**, DEGREE in AREA -- LOCATION'
degree_column_template:
degree_column_width: 1cm
main_column_second_row_template: |-
SUMMARY
HIGHLIGHTS
date_and_location_column_template: DATE
normal_entry:
main_column_first_row_template: '**NAME** -- **LOCATION**'
main_column_second_row_template: |-
SUMMARY
HIGHLIGHTS
date_and_location_column_template: DATE
experience_entry:
main_column_first_row_template: '**POSITION**, COMPANY -- LOCATION'
main_column_second_row_template: |-
SUMMARY
HIGHLIGHTS
date_and_location_column_template: DATE
publication_entry:
main_column_first_row_template: '**TITLE**'
main_column_second_row_template: |-
AUTHORS
URL (JOURNAL)
main_column_second_row_without_journal_template: |-
AUTHORS
URL
main_column_second_row_without_url_template: |-
AUTHORS
JOURNAL
date_and_location_column_template: DATE
locale:
language: en
phone_number_format: national
@@ -254,5 +152,4 @@ locale:
- December
rendercv_settings:
date: '2025-02-16'
render_command:
bold_keywords: []

View File

@@ -1,4 +1,3 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/rendercv/rendercv/refs/tags/v2.2/schema.json
cv:
name: John Doe
location: Location
@@ -113,106 +112,6 @@ cv:
- reversed_number: This is the third reversed numbered entry.
design:
theme: moderncv
page:
size: us-letter
top_margin: 2cm
bottom_margin: 2cm
left_margin: 2cm
right_margin: 2cm
show_page_numbering: true
show_last_updated_date: true
colors:
text: rgb(0, 0, 0)
name: rgb(0, 79, 144)
connections: rgb(0, 79, 144)
section_titles: rgb(0, 79, 144)
links: rgb(0, 79, 144)
last_updated_date_and_page_numbering: rgb(128, 128, 128)
text:
font_family: Fontin
font_size: 10pt
leading: 0.6em
alignment: justified
date_and_location_column_alignment: right
links:
underline: true
use_external_link_icon: false
header:
name_font_family: Fontin
name_font_size: 25pt
name_bold: false
small_caps_for_name: false
photo_width: 3.5cm
vertical_space_between_name_and_connections: 0.7cm
vertical_space_between_connections_and_first_section: 0.7cm
horizontal_space_between_connections: 0.5cm
connections_font_family: Fontin
separator_between_connections: ''
use_icons_for_connections: true
use_urls_as_placeholders_for_connections: false
make_connections_links: true
alignment: left
section_titles:
type: moderncv
font_family: Fontin
font_size: 1.4em
bold: false
small_caps: false
line_thickness: 0.15cm
vertical_space_above: 0.55cm
vertical_space_below: 0.3cm
entries:
date_and_location_width: 4.15cm
left_and_right_margin: 0cm
horizontal_space_between_columns: 0.4cm
vertical_space_between_entries: 0.4cm
allow_page_break_in_sections: true
allow_page_break_in_entries: true
short_second_row: false
show_time_spans_in: []
highlights:
bullet:
nested_bullet: '-'
top_margin: 0.25cm
left_margin: 0cm
vertical_space_between_highlights: 0.19cm
horizontal_space_between_bullet_and_highlight: 0.3em
summary_left_margin: 0cm
entry_types:
one_line_entry:
template: '**LABEL:** DETAILS'
education_entry:
main_column_first_row_template: '**INSTITUTION**, DEGREE in AREA -- LOCATION'
degree_column_template:
degree_column_width: 1cm
main_column_second_row_template: |-
SUMMARY
HIGHLIGHTS
date_and_location_column_template: DATE
normal_entry:
main_column_first_row_template: '**NAME** -- **LOCATION**'
main_column_second_row_template: |-
SUMMARY
HIGHLIGHTS
date_and_location_column_template: DATE
experience_entry:
main_column_first_row_template: '**POSITION**, COMPANY -- LOCATION'
main_column_second_row_template: |-
SUMMARY
HIGHLIGHTS
date_and_location_column_template: DATE
publication_entry:
main_column_first_row_template: '**TITLE**'
main_column_second_row_template: |-
AUTHORS
URL (JOURNAL)
main_column_second_row_without_journal_template: |-
AUTHORS
URL
main_column_second_row_without_url_template: |-
AUTHORS
JOURNAL
date_and_location_column_template: DATE
locale:
language: en
phone_number_format: national
@@ -253,5 +152,4 @@ locale:
- December
rendercv_settings:
date: '2025-02-16'
render_command:
bold_keywords: []

View File

@@ -1,4 +1,3 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/rendercv/rendercv/refs/tags/v2.2/schema.json
cv:
name: John Doe
location: Location
@@ -113,117 +112,6 @@ cv:
- reversed_number: This is the third reversed numbered entry.
design:
theme: sb2nov
page:
size: us-letter
top_margin: 2cm
bottom_margin: 2cm
left_margin: 2cm
right_margin: 2cm
show_page_numbering: true
show_last_updated_date: true
colors:
text: rgb(0, 0, 0)
name: rgb(0, 0, 0)
connections: rgb(0, 0, 0)
section_titles: rgb(0, 0, 0)
links: rgb(0, 79, 144)
last_updated_date_and_page_numbering: rgb(128, 128, 128)
text:
font_family: New Computer Modern
font_size: 10pt
leading: 0.6em
alignment: justified
date_and_location_column_alignment: right
links:
underline: true
use_external_link_icon: false
header:
name_font_family: New Computer Modern
name_font_size: 30pt
name_bold: true
small_caps_for_name: false
photo_width: 3.5cm
vertical_space_between_name_and_connections: 0.7cm
vertical_space_between_connections_and_first_section: 0.7cm
horizontal_space_between_connections: 0.5cm
connections_font_family: New Computer Modern
separator_between_connections: ''
use_icons_for_connections: true
use_urls_as_placeholders_for_connections: false
make_connections_links: true
alignment: center
section_titles:
type: with-partial-line
font_family: New Computer Modern
font_size: 1.4em
bold: true
small_caps: false
line_thickness: 0.5pt
vertical_space_above: 0.5cm
vertical_space_below: 0.3cm
line_type: with-full-line
entries:
date_and_location_width: 4.15cm
left_and_right_margin: 0.2cm
horizontal_space_between_columns: 0.1cm
vertical_space_between_entries: 1.2em
allow_page_break_in_sections: true
allow_page_break_in_entries: true
short_second_row: false
show_time_spans_in: []
highlights:
bullet:
nested_bullet: '-'
top_margin: 0.25cm
left_margin: 0.4cm
vertical_space_between_highlights: 0.25cm
horizontal_space_between_bullet_and_highlight: 0.5em
summary_left_margin: 0cm
entry_types:
one_line_entry:
template: '**LABEL:** DETAILS'
education_entry:
main_column_first_row_template: |-
**INSTITUTION**
*DEGREE in AREA*
degree_column_template:
degree_column_width: 1cm
main_column_second_row_template: |-
SUMMARY
HIGHLIGHTS
date_and_location_column_template: |-
*LOCATION*
*DATE*
normal_entry:
main_column_first_row_template: '**NAME**'
main_column_second_row_template: |-
SUMMARY
HIGHLIGHTS
date_and_location_column_template: |-
*LOCATION*
*DATE*
experience_entry:
main_column_first_row_template: |-
**POSITION**
*COMPANY*
main_column_second_row_template: |-
SUMMARY
HIGHLIGHTS
date_and_location_column_template: |-
*LOCATION*
*DATE*
publication_entry:
main_column_first_row_template: '**TITLE**'
main_column_second_row_template: |-
AUTHORS
URL (JOURNAL)
main_column_second_row_without_journal_template: |-
AUTHORS
URL
main_column_second_row_without_url_template: |-
AUTHORS
JOURNAL
date_and_location_column_template: DATE
locale:
language: en
phone_number_format: national
@@ -264,5 +152,4 @@ locale:
- December
rendercv_settings:
date: '2025-02-16'
render_command:
bold_keywords: []

View File

@@ -65,8 +65,8 @@ def _create_a_file_from_something(
with tempfile.TemporaryDirectory() as temp_dir:
temporary_output_path = pathlib.Path(temp_dir)
typst_file = renderer(data_model, temporary_output_path)
shutil.move(typst_file, output_file_path)
file = renderer(data_model, temporary_output_path)
shutil.move(file, output_file_path)
return None
@@ -350,7 +350,9 @@ def create_a_pdf_from_a_yaml_string(
return _create_a_file_from_something(
yaml_file_as_string,
read_a_yaml_string_and_return_a_data_model,
renderer.create_a_typst_file,
lambda x, y: renderer.render_a_pdf_from_typst(
renderer.create_a_typst_file(x, y)
),
output_file_path,
)
@@ -373,6 +375,8 @@ def create_a_pdf_from_a_python_dictionary(
return _create_a_file_from_something(
input_file_as_a_dict,
read_a_python_dictionary_and_return_a_data_model,
renderer.create_a_typst_file,
lambda x, y: renderer.render_a_pdf_from_typst(
renderer.create_a_typst_file(x, y),
),
output_file_path,
)

View File

@@ -107,9 +107,15 @@ def create_a_sample_yaml_input_file(
# process easier. "cv.sections_input" exists for the convenience of the user.
# Also, we don't want to show the cv.photo field in the Web app.
data_model_as_json = data_model.model_dump_json(
exclude_none=False, by_alias=True, exclude={"cv": {"sections", "photo"}}
exclude_none=False,
by_alias=True,
exclude={
"cv": {"sections", "photo"},
"rendercv_settings": {"render_command"},
},
)
data_model_as_dictionary = json.loads(data_model_as_json)
data_model_as_dictionary["design"] = {"theme": theme}
yaml_string = dictionary_to_yaml(data_model_as_dictionary)

View File

@@ -327,6 +327,9 @@ available_social_networks = get_args(SocialNetworkName)
class SocialNetwork(RenderCVBaseModelWithoutExtraKeys):
"""This class is the data model of a social network."""
model_config = pydantic.ConfigDict(
title="Social Network",
)
network: SocialNetworkName = pydantic.Field(
title="Social Network",
)
@@ -393,6 +396,9 @@ class SocialNetwork(RenderCVBaseModelWithoutExtraKeys):
class CurriculumVitae(RenderCVBaseModelWithExtraKeys):
"""This class is the data model of the `cv` field."""
model_config = pydantic.ConfigDict(
title="CV",
)
name: Optional[str] = pydantic.Field(
default=None,
title="Name",

View File

@@ -207,6 +207,7 @@ def make_keywords_bold_in_a_string(string: str, keywords: list[str]) -> str:
class OneLineEntry(RenderCVBaseModelWithExtraKeys, EntryType):
"""This class is the data model of `OneLineEntry`."""
model_config = pydantic.ConfigDict(title="One Line Entry")
label: str = pydantic.Field(
title="Label",
)
@@ -230,6 +231,7 @@ class OneLineEntry(RenderCVBaseModelWithExtraKeys, EntryType):
class BulletEntry(RenderCVBaseModelWithExtraKeys, EntryType):
"""This class is the data model of `BulletEntry`."""
model_config = pydantic.ConfigDict(title="Bullet Entry")
bullet: str = pydantic.Field(
title="Bullet",
)
@@ -250,6 +252,8 @@ class BulletEntry(RenderCVBaseModelWithExtraKeys, EntryType):
class NumberedEntry(RenderCVBaseModelWithExtraKeys, EntryType):
"""This class is the data model of `NumberedEntry`."""
model_config = pydantic.ConfigDict(title="Numbered Entry")
number: str = pydantic.Field(
title="Number",
)
@@ -270,6 +274,7 @@ class NumberedEntry(RenderCVBaseModelWithExtraKeys, EntryType):
class ReversedNumberedEntry(RenderCVBaseModelWithExtraKeys, EntryType):
"""This class is the data model of `ReversedNumberedEntry`."""
model_config = pydantic.ConfigDict(title="Reversed Numbered Entry")
reversed_number: str = pydantic.Field(
title="Reversed Number",
)
@@ -386,6 +391,8 @@ class PublicationEntry(EntryWithDate, PublicationEntryBase, EntryType):
the fields in the correct order.
"""
model_config = pydantic.ConfigDict(title="Publication Entry")
class EntryBase(EntryWithDate):
"""This class is the parent class of some of the entry types. It is being used
@@ -534,6 +541,8 @@ class NormalEntry(EntryBase, NormalEntryBase, EntryType):
correct order.
"""
model_config = pydantic.ConfigDict(title="Normal Entry")
class ExperienceEntryBase(RenderCVBaseModelWithExtraKeys):
"""This class is the parent class of the `ExperienceEntry` class."""
@@ -552,6 +561,8 @@ class ExperienceEntry(EntryBase, ExperienceEntryBase, EntryType):
fields in the correct order.
"""
model_config = pydantic.ConfigDict(title="Experience Entry")
class EducationEntryBase(RenderCVBaseModelWithExtraKeys):
"""This class is the parent class of the `EducationEntry` class."""
@@ -576,6 +587,8 @@ class EducationEntry(EntryBase, EducationEntryBase, EntryType):
fields in the correct order.
"""
model_config = pydantic.ConfigDict(title="Education Entry")
# ======================================================================================
# Create custom types based on the entry models: =======================================

View File

@@ -17,6 +17,8 @@ class Locale(RenderCVBaseModelWithoutExtraKeys):
updates the `locale` dictionary.
"""
model_config = pydantic.ConfigDict(title="Locale")
language: pydantic_extra_types.language_code.LanguageAlpha2 = pydantic.Field(
default="en", # type: ignore
title="Language",

View File

@@ -191,6 +191,8 @@ class RenderCommandSettings(RenderCVBaseModelWithoutExtraKeys):
class RenderCVSettings(RenderCVBaseModelWithoutExtraKeys):
"""This class is the data model of the RenderCV settings."""
model_config = pydantic.ConfigDict(title="RenderCV Settings")
date: datetime.date = pydantic.Field(
default=datetime.date.today(),
title="Date",

View File

@@ -97,7 +97,10 @@ def validate_font_family(font_family: str) -> str:
FontFamily = Annotated[
str,
pydantic.PlainValidator(validate_font_family),
pydantic.PlainValidator(
validate_font_family,
json_schema_input_type=Literal[tuple(available_font_families)],
),
]
BulletPoint = Literal["", "", "-", "", "", "", "", ""]
PageSize = Literal[
@@ -121,10 +124,11 @@ PageSize = Literal[
]
Alignment = Literal["left", "center", "right"]
TextAlignment = Literal["left", "justified", "justified-with-no-hyphenation"]
SectionTitleType = Optional[
Literal["with-partial-line", "with-full-line", "without-line", "moderncv"]
SectionTitleType = Literal[
"with-partial-line", "with-full-line", "without-line", "moderncv"
]
page_size_field_info = pydantic.Field(
default="us-letter",
title="Page Size",
@@ -169,6 +173,8 @@ page_show_last_updated_date_field_info = pydantic.Field(
class Page(RenderCVBaseModelWithoutExtraKeys):
"""Options related to the page."""
model_config = pydantic.ConfigDict(title="Page")
size: PageSize = page_size_field_info
top_margin: TypstDimension = page_top_margin_field_info
bottom_margin: TypstDimension = page_bottom_margin_field_info
@@ -232,6 +238,8 @@ colors_last_updated_date_and_page_numbering_field_info = pydantic.Field(
class Colors(RenderCVBaseModelWithoutExtraKeys):
"""Color used throughout the CV."""
model_config = pydantic.ConfigDict(title="Colors")
text: pydantic_color.Color = colors_text_field_info
name: pydantic_color.Color = colors_name_field_info
connections: pydantic_color.Color = colors_connections_field_info
@@ -283,6 +291,8 @@ text_date_and_location_column_alignment_field_info = pydantic.Field(
class Text(RenderCVBaseModelWithoutExtraKeys):
"""Options related to text."""
model_config = pydantic.ConfigDict(title="Text")
font_family: FontFamily = text_font_family_field_info
font_size: TypstDimension = text_font_size_field_info
leading: TypstDimension = text_leading_field_info
@@ -310,6 +320,7 @@ links_use_external_link_icon_field_info = pydantic.Field(
class Links(RenderCVBaseModelWithoutExtraKeys):
"""Options related to links."""
model_config = pydantic.ConfigDict(title="Links")
underline: bool = links_underline_field_info
use_external_link_icon: bool = links_use_external_link_icon_field_info
@@ -401,6 +412,7 @@ header_alignment_field_info = pydantic.Field(
class Header(RenderCVBaseModelWithoutExtraKeys):
"""Options related to headers."""
model_config = pydantic.ConfigDict(title="Header")
name_font_family: FontFamily = header_name_font_family_field_info
name_font_size: TypstDimension = header_name_font_size_field_info
name_bold: bool = header_name_bold_field_info
@@ -450,7 +462,7 @@ section_titles_bold_field_info = pydantic.Field(
)
section_titles_type_field_info = pydantic.Field(
default="with-partial-line",
title="Line Type",
title="Type",
description="The type of the section titles.",
)
section_titles_line_thickness_field_info = pydantic.Field(
@@ -478,6 +490,8 @@ section_titles_small_caps_field_info = pydantic.Field(
class SectionTitles(RenderCVBaseModelWithoutExtraKeys):
"""Options related to section titles."""
model_config = pydantic.ConfigDict(title="Section Titles")
type: SectionTitleType = section_titles_type_field_info
font_family: FontFamily = section_titles_font_family_field_info
font_size: TypstDimension = section_titles_font_size_field_info
@@ -546,6 +560,8 @@ entries_show_time_spans_in_field_info = pydantic.Field(
class Entries(RenderCVBaseModelWithoutExtraKeys):
"""Options related to entries."""
model_config = pydantic.ConfigDict(title="Entries")
date_and_location_width: TypstDimension = entries_date_and_location_width_field_info
left_and_right_margin: TypstDimension = entries_left_and_right_margin_field_info
horizontal_space_between_columns: TypstDimension = (
@@ -600,6 +616,8 @@ highlights_summary_left_margin_field_info = pydantic.Field(
class Highlights(RenderCVBaseModelWithoutExtraKeys):
"""Options related to highlights."""
model_config = pydantic.ConfigDict(title="Highlights")
bullet: BulletPoint = highlights_bullet_field_info
nested_bullet: BulletPoint = highlights_nested_bullet_field_info
top_margin: TypstDimension = highlights_top_margin_field_info
@@ -687,6 +705,8 @@ publication_entry_date_and_location_column_template_field_info = pydantic.Field(
class PublicationEntryOptions(RenderCVBaseModelWithoutExtraKeys):
"""Options related to publication entries."""
model_config = pydantic.ConfigDict(title="Publication Entry Options")
main_column_first_row_template: str = (
publication_entry_main_column_first_row_template_field_info
)
@@ -745,6 +765,8 @@ class EducationEntryBase(RenderCVBaseModelWithoutExtraKeys):
class EducationEntryOptions(EntryBaseWithDate, EducationEntryBase):
"""Options related to education entries."""
model_config = pydantic.ConfigDict(title="Education Entry Options")
normal_entry_main_column_first_row_template_field_info = pydantic.Field(
default="**NAME**",
@@ -767,6 +789,8 @@ class NormalEntryBase(RenderCVBaseModelWithoutExtraKeys):
class NormalEntryOptions(EntryBaseWithDate, NormalEntryBase):
"""Options related to normal entries."""
model_config = pydantic.ConfigDict(title="Normal Entry Options")
experience_entry_main_column_first_row_template_field_info = pydantic.Field(
default="**COMPANY**, POSITION",
@@ -789,6 +813,8 @@ class ExperienceEntryBase(RenderCVBaseModelWithoutExtraKeys):
class ExperienceEntryOptions(EntryBaseWithDate, ExperienceEntryBase):
"""Options related to experience entries."""
model_config = pydantic.ConfigDict(title="Experience Entry Options")
one_line_entry_template_field_info = pydantic.Field(
default="**LABEL:** DETAILS",
@@ -803,6 +829,7 @@ one_line_entry_template_field_info = pydantic.Field(
class OneLineEntryOptions(RenderCVBaseModelWithoutExtraKeys):
"""Options related to one-line entries."""
model_config = pydantic.ConfigDict(title="One Line Entry Options")
template: str = one_line_entry_template_field_info
@@ -836,6 +863,7 @@ entry_types_publication_entry_field_info = pydantic.Field(
class EntryTypes(RenderCVBaseModelWithoutExtraKeys):
"""Options related to the templates."""
model_config = pydantic.ConfigDict(title="Entry Types")
one_line_entry: OneLineEntryOptions = entry_types_one_line_entry_field_info
education_entry: EducationEntryOptions = entry_types_education_entry_field_info
normal_entry: NormalEntryOptions = entry_types_normal_entry_field_info
@@ -900,6 +928,7 @@ theme_options_entry_types_field_info = pydantic.Field(
class ThemeOptions(RenderCVBaseModelWithoutExtraKeys):
"""Full design options."""
model_config = pydantic.ConfigDict(title="Theme Options")
theme: Literal["tobeoverwritten"] = theme_options_theme_field_info
page: Page = theme_options_page_field_info
colors: Colors = theme_options_colors_field_info

View File

File diff suppressed because it is too large Load Diff

View File

@@ -32,6 +32,9 @@ def generate_examples():
)
yaml_file_path = examples_directory_path / "John_Doe_CV.yaml"
# Remove the first line from the YAML file (Json Schema):
yaml_file_path.write_text(yaml_file_path.read_text().split("\n", 1)[1])
# Rename John_Doe_CV.yaml
proper_theme_name = theme.capitalize() + "Theme"
new_yaml_file_path = (

View File

@@ -1,6 +1,3 @@
import pathlib
import tempfile
import rendercv
import rendercv.data
@@ -24,9 +21,9 @@ def test_create_contents_of_a_typst_file_with_errors(
)
def test_create_a_typst_file_from_a_yaml_string(input_file_path):
def test_create_a_typst_file_from_a_yaml_string(input_file_path, tmp_path):
yaml_string = input_file_path.read_text()
output_file_path = pathlib.Path(tempfile.mktemp(suffix=".typst"))
output_file_path = tmp_path / "output.typ"
errors = rendercv.create_a_typst_file_from_a_yaml_string(
yaml_string, output_file_path
)
@@ -35,9 +32,9 @@ def test_create_a_typst_file_from_a_yaml_string(input_file_path):
def test_create_a_typst_file_from_a_python_dictionary(
rendercv_data_as_python_dictionary,
rendercv_data_as_python_dictionary, tmp_path
):
output_file_path = pathlib.Path(tempfile.mktemp(suffix=".typst"))
output_file_path = tmp_path / "output.typ"
errors = rendercv.create_a_typst_file_from_a_python_dictionary(
rendercv_data_as_python_dictionary, output_file_path
)
@@ -60,9 +57,9 @@ def test_create_contents_of_a_markdown_file_from_a_python_dictionary(
assert isinstance(result, str)
def test_create_a_markdown_file_from_a_yaml_string(input_file_path):
def test_create_a_markdown_file_from_a_yaml_string(input_file_path, tmp_path):
yaml_string = input_file_path.read_text()
output_file_path = pathlib.Path(tempfile.mktemp(suffix=".md"))
output_file_path = tmp_path / "output.md"
errors = rendercv.create_a_markdown_file_from_a_yaml_string(
yaml_string, output_file_path
)
@@ -71,9 +68,9 @@ def test_create_a_markdown_file_from_a_yaml_string(input_file_path):
def test_create_a_markdown_file_from_a_python_dictionary(
rendercv_data_as_python_dictionary,
rendercv_data_as_python_dictionary, tmp_path
):
output_file_path = pathlib.Path(tempfile.mktemp(suffix=".md"))
output_file_path = tmp_path / "output.md"
errors = rendercv.create_a_markdown_file_from_a_python_dictionary(
rendercv_data_as_python_dictionary, output_file_path
)
@@ -81,9 +78,9 @@ def test_create_a_markdown_file_from_a_python_dictionary(
assert output_file_path.exists()
def test_create_an_html_file_from_a_yaml_string(input_file_path):
def test_create_an_html_file_from_a_yaml_string(input_file_path, tmp_path):
yaml_string = input_file_path.read_text()
output_file_path = pathlib.Path(tempfile.mktemp(suffix=".html"))
output_file_path = tmp_path / "output.html"
errors = rendercv.create_an_html_file_from_a_yaml_string(
yaml_string, output_file_path
)
@@ -92,9 +89,9 @@ def test_create_an_html_file_from_a_yaml_string(input_file_path):
def test_create_an_html_file_from_a_python_dictionary(
rendercv_data_as_python_dictionary,
rendercv_data_as_python_dictionary, tmp_path
):
output_file_path = pathlib.Path(tempfile.mktemp(suffix=".html"))
output_file_path = tmp_path / "output.html"
errors = rendercv.create_an_html_file_from_a_python_dictionary(
rendercv_data_as_python_dictionary, output_file_path
)
@@ -102,16 +99,18 @@ def test_create_an_html_file_from_a_python_dictionary(
assert output_file_path.exists()
def test_create_a_pdf_from_a_yaml_string(input_file_path):
def test_create_a_pdf_from_a_yaml_string(input_file_path, tmp_path):
yaml_string = input_file_path.read_text()
output_file_path = pathlib.Path(tempfile.mktemp(suffix=".pdf"))
output_file_path = tmp_path / "output.pdf"
errors = rendercv.create_a_pdf_from_a_yaml_string(yaml_string, output_file_path)
assert errors is None
assert output_file_path.exists()
def test_create_a_pdf_from_a_python_dictionary(rendercv_data_as_python_dictionary):
output_file_path = pathlib.Path(tempfile.mktemp(suffix=".pdf"))
def test_create_a_pdf_from_a_python_dictionary(
rendercv_data_as_python_dictionary, tmp_path
):
output_file_path = tmp_path / "output.pdf"
errors = rendercv.create_a_pdf_from_a_python_dictionary(
rendercv_data_as_python_dictionary, output_file_path
)