### Update Example Files Source: https://docs.rendercv.com/developer_guide?q= Run `just update-examples` to update the example files within the project. ```bash just update-examples ``` -------------------------------- ### Install via OpenSkills Source: https://docs.rendercv.com/user_guide/how_to/use_the_ai_agent_skill?q= Alternative installation method using the OpenSkills CLI. ```bash npx openskills install rendercv/rendercv-skill ``` -------------------------------- ### Install RenderCV with uv Source: https://docs.rendercv.com/user_guide?q= Use this command to install RenderCV and all optional dependencies using the uv tool. ```bash uv tool install "rendercv[full]" ``` -------------------------------- ### CLI version and help Source: https://docs.rendercv.com/user_guide/cli_reference Check the installed version or access help documentation. ```bash rendercv --version ``` ```bash rendercv --help ``` -------------------------------- ### Entry Data Example Source: https://docs.rendercv.com/user_guide/how_to/arbitrary_keys_in_entries?q= This is an example of an entry with custom fields like 'company', 'position', and 'tech_stack'. ```yaml company: Google position: Software Engineer tech_stack: Python, Go, Kubernetes ``` -------------------------------- ### entry_point() Source: https://docs.rendercv.com/api_reference/cli/entry_point?q= The main entry point for the RenderCV CLI, which validates the installation environment and initializes the application. ```APIDOC ## entry_point() ### Description Entry point for the RenderCV CLI. It attempts to import the CLI application and provides a helpful error message if the user installed the package without the required 'full' dependencies. ### Method N/A (Python Function) ### Parameters None ### Response - **Success**: Executes the CLI application (cli_app). - **Error (SystemExit)**: Raises a SystemExit(1) if the required dependencies are missing, printing an installation instruction message to stderr. ``` -------------------------------- ### Usage Examples for process_date Source: https://docs.rendercv.com/api_reference/renderer/templater/entry_templates_from_input?q= Examples demonstrating how to format single dates for publications and date ranges with time spans for employment entries. ```python # Single date for publication result = process_date( date="2024-03", start_date=None, end_date=None, locale=english_locale, current_date=Date(2025, 1, 1), show_time_span=False, single_date_template="MONTH_NAME YEAR", date_range_template="", time_span_template="", ) # Returns: "March 2024" # Date range with time span for employment result = process_date( date=None, start_date="2020-06", end_date="present", locale=english_locale, current_date=Date(2025, 1, 1), show_time_span=True, single_date_template="MONTH_ABBREVIATION YEAR", date_range_template="START_DATE to END_DATE", time_span_template="HOW_MANY_YEARS YEARS", ) # Returns: "Jun 2020 to present 4 years" ``` -------------------------------- ### Write a simple test function Source: https://docs.rendercv.com/developer_guide/testing?q= This example demonstrates how to write a basic test function using Python's assert statement. Ensure your function is named starting with 'test_' and placed in a file matching 'test_*.py' within the tests directory. ```python def sum(a, b): return a + b def test_sum(): assert sum(2, 3) == 5 assert sum(-1, 1) == 0 assert sum(0, 0) == 0 ``` -------------------------------- ### Install RenderCV with pipx Source: https://docs.rendercv.com/user_guide?q= Use this command to install RenderCV and all optional dependencies using pipx, which provides isolated environments. ```bash pipx install "rendercv[full]" ``` -------------------------------- ### Install RenderCV Package Source: https://docs.rendercv.com/developer_guide/project_management Users can install the RenderCV package directly using pip. This command handles all dependency installations automatically. ```bash pip install rendercv ``` -------------------------------- ### Markdown Highlights Example Source: https://docs.rendercv.com/developer_guide/understanding_rendercv Example of how Markdown syntax for bold text and links can be used in YAML configuration for highlights. ```yaml highlights: - "**Published** [3 papers](https://example.com) on neural networks" - "Collaborated with *Professor Smith*" ``` -------------------------------- ### ProgressPanel Example Usage Source: https://docs.rendercv.com/api_reference/cli/render_command/progress_panel Example demonstrating how to use the ProgressPanel to show CV generation progress. It updates the panel with a generated PDF and then finishes the progress. ```python with ProgressPanel(quiet=False) as progress: progress.update_progress("50", "Generated PDF", [Path("cv.pdf")]) progress.finish_progress() # Displays: ✓ 50 ms Generated PDF: ./cv.pdf ``` -------------------------------- ### Install the RenderCV Skill for Specific Agents Source: https://docs.rendercv.com/user_guide/how_to/use_the_ai_agent_skill?q= Target specific AI agents during the installation process using the -a flag. ```bash npx skills add rendercv/rendercv-skill -a claude-code npx skills add rendercv/rendercv-skill -a cursor npx skills add rendercv/rendercv-skill -a codex ``` -------------------------------- ### Example Entry Template Syntax Source: https://docs.rendercv.com/user_guide/how_to/override_default_templates?q= Demonstrates using Jinja2 loops within a Typst template file. ```typst // Example: entries/NormalEntry.j2.typ #regular-entry( [ {% for line in entry.main_column.splitlines() %} {{ line }} {% endfor %} ], [ {% for line in entry.date_and_location_column.splitlines() %} {{ line }} {% endfor %} ], ) ``` -------------------------------- ### Manual Skill Installation Source: https://docs.rendercv.com/user_guide/how_to/use_the_ai_agent_skill?q= Manually clone the repository and copy the skill files into the agent's configuration directory. ```bash git clone https://github.com/rendercv/rendercv-skill.git cp -r rendercv-skill/skills/rendercv ~/.claude/skills/ ``` -------------------------------- ### VS Code settings.json example Source: https://docs.rendercv.com/developer_guide/json_schema Demonstrates how JSON Schema enables error detection for configuration files. ```json { "editor.fontSize": 14, "editor.tabSiz": 4 // ← Typo! VS Code highlights it red immediately } ``` -------------------------------- ### RenderCV CLI Entry Point Function Source: https://docs.rendercv.com/api_reference/cli/entry_point This function serves as the main entry point for the RenderCV CLI. It checks if RenderCV was installed with the necessary extras (`pip install "rendercv[full]"`) and displays an informative error message if not, before proceeding to launch the CLI application. ```python def entry_point() -> None: """Entry point for the RenderCV CLI.""" try: from .app import app as cli_app # NOQA: PLC0415 except ImportError: error_message = """ It looks like you installed RenderCV with: pip install rendercv But RenderCV needs to be installed with: pip install "rendercv[full]" Please reinstall with the correct command above. """ sys.stderr.write(error_message) raise SystemExit(1) from None cli_app() ``` -------------------------------- ### GitHub Actions workflow example Source: https://docs.rendercv.com/developer_guide/json_schema Shows how schema validation provides suggestions for CI/CD configuration files. ```yaml on: push: branchs: # ← Typo! Your editor underlines it, suggests "branches" - main ``` -------------------------------- ### Install the RenderCV Skill Source: https://docs.rendercv.com/user_guide/how_to/use_the_ai_agent_skill Use npx to add the RenderCV skill to your AI agent environment. ```bash npx skills add rendercv/rendercv-skill ``` ```bash npx skills add rendercv/rendercv-skill -a claude-code npx skills add rendercv/rendercv-skill -a cursor npx skills add rendercv/rendercv-skill -a codex ``` ```bash npx openskills install rendercv/rendercv-skill ``` -------------------------------- ### Example YAML Input Source: https://docs.rendercv.com/developer_guide/understanding_rendercv?q= A sample YAML structure representing CV data. ```yaml cv: name: John Doe location: San Francisco, CA sections: education: - institution: MIT degree: PhD start_date: 2020-09 end_date: 2024-05 ``` -------------------------------- ### OneLineEntry Example Source: https://docs.rendercv.com/user_guide/yaml_input_structure/cv Use OneLineEntry for compact key-value pairs, ideal for skills or technical proficiencies. ```yaml label: Programming details: Python, C++, JavaScript, MATLAB ``` -------------------------------- ### ExperienceEntry Example Source: https://docs.rendercv.com/user_guide/yaml_input_structure/cv Detail work history with `ExperienceEntry`, including company, position, dates, location, and accomplishments in highlights. ```yaml company: Some Company position: Software Engineer date: start_date: 2020-07 end_date: '2021-08-12' location: TX, USA summary: highlights: - Developed an [IOS application](https://example.com) that has received more than **100,000 downloads**. - Managed a team of **5** engineers. ``` -------------------------------- ### Pydantic Field for Start Date Source: https://docs.rendercv.com/api_reference/schema/models/cv/entries/experience Defines a 'start_date' field with a default value and a description of its format, including examples. ```python start_date = pydantic.Field(default=None, description='The start date in YYYY-MM-DD, YYYY-MM, or YYYY format.', examples=['2020-09-24', '2020-09', '2020']) ``` -------------------------------- ### Serve Documentation Locally Source: https://docs.rendercv.com/developer_guide?q= Run `just serve-docs` to serve the documentation locally with live reload capabilities. ```bash just serve-docs ``` -------------------------------- ### Define CV Entry Fields Source: https://docs.rendercv.com/api_reference/schema/models/cv/entries/experience?q= Field definitions for CV entries including position, start date, and summary with example values for schema generation. ```python position = pydantic.Field(examples=['Software Engineer', 'Research Assistant', 'Project Manager']) ``` ```python start_date = pydantic.Field(default=None, description='The start date in YYYY-MM-DD, YYYY-MM, or YYYY format.', examples=['2020-09-24', '2020-09', '2020']) ``` ```python summary = pydantic.Field(default=None, examples=['Led a team of 5 engineers to develop innovative solutions.', 'Completed advanced coursework in machine learning and artificial intelligence.']) ``` -------------------------------- ### Get cached Typst package path Source: https://docs.rendercv.com/api_reference/renderer/pdf_png Sets up a temporary directory with the required Typst package structure for bundled packages. Uses lru_cache to ensure the setup runs only once. ```python @functools.lru_cache(maxsize=1) def get_package_path() -> pathlib.Path: """Set up local Typst package resolution from bundled Typst packages. Why: Bundled Typst packages (rendercv, fontawesome) are shipped inside the Python package so that PDF compilation works without downloading from Typst Universe. The Typst compiler expects packages in a directory structure of preview/{name}/{version}/, so this creates a temporary directory with that layout. Returns: Path to temporary package cache directory. """ temp_dir = pathlib.Path(tempfile.mkdtemp(prefix="rendercv-pkg-")) atexit.register(shutil.rmtree, str(temp_dir), True) renderer_dir = pathlib.Path(__file__).parent install_bundled_typst_package( bundled_path=renderer_dir / "rendercv_typst", package_name="rendercv", temp_dir=temp_dir, typ_files=["lib.typ"], ) install_bundled_typst_package( bundled_path=renderer_dir / "typst_fontawesome", package_name="fontawesome", temp_dir=temp_dir, typ_files=[ "lib.typ", "lib-impl.typ", "lib-gen-func.typ", "lib-gen-map.typ", ], ) return temp_dir ``` -------------------------------- ### Build Documentation Source: https://docs.rendercv.com/developer_guide?q= Use `just build-docs` to build the project's documentation. ```bash just build-docs ``` -------------------------------- ### Initialize a new CV project Source: https://docs.rendercv.com/user_guide/cli_reference?q= Generate a sample CV file to begin editing. ```bash rendercv new "John Doe" ``` ```bash rendercv new "John Doe" --theme moderncv ``` ```bash rendercv new "John Doe" --locale french ``` ```bash rendercv new "John Doe" --create-typst-templates ``` -------------------------------- ### Install RenderCV Package Source: https://docs.rendercv.com/ Install the RenderCV package using pip. This command requires Python 3.12 or newer and installs the full package with all dependencies. ```bash pip install "rendercv[full]" ``` -------------------------------- ### Initialize a new CV project Source: https://docs.rendercv.com/user_guide/cli_reference Generate a sample CV file using the new command. Options allow specifying themes, locales, or generating editable templates. ```bash rendercv new "John Doe" --theme moderncv ``` ```bash rendercv new "John Doe" ``` ```bash rendercv new "John Doe" --locale french ``` ```bash rendercv new "John Doe" --create-typst-templates ``` -------------------------------- ### Create a new theme YAML file Source: https://docs.rendercv.com/developer_guide/how_to/add_theme Initialize the theme configuration file in the designated themes directory. ```bash touch src/rendercv/schema/models/design/other_themes/mytheme.yaml ``` -------------------------------- ### Create a custom theme with cli_command_create_theme Source: https://docs.rendercv.com/api_reference/cli/create_theme_command/create_theme_command?q= Initializes a new theme directory by copying Typst templates and creating an __init__.py file. Requires a theme name argument and checks for existing directories to prevent overwriting. ```python @app.command( name="create-theme", help=( "Create a custom theme folder with Typst templates to customize. Example:" " [yellow]rendercv create-theme customtheme[/yellow]. Details: [cyan]rendercv" " create-theme --help[/cyan]" ), ) @handle_user_errors def cli_command_create_theme( theme_name: Annotated[ str, typer.Argument(help="The name of the new theme"), ], ) -> None: new_theme_folder = pathlib.Path.cwd() / theme_name if new_theme_folder.exists(): message = f'The theme folder "{theme_name}" already exists!' raise RenderCVUserError(message) copy_templates("typst", new_theme_folder) # Create the __init__.py file for the new theme: create_init_file_for_theme(theme_name, new_theme_folder / "__init__.py") # Build the panel message = textwrap.dedent(f""" [green]✓[/green] Created your custom theme: [purple]./{theme_name}[/purple] What you can do with this theme: 1. Modify the Typst templates in [purple]./{theme_name}/ 2. Edit [purple]./{theme_name}/__init__.py[/purple] to: - Add your own design options to use in the YAML input file - Change the default values of existing options - Or simply delete it if you only want to customize templates To use your theme, set in your YAML input file: [cyan] design: [cyan] theme: {theme_name} """).strip("\n") print( rich.panel.Panel( message, title="Theme created", title_align="left", border_style="bright_black", ) ) ``` -------------------------------- ### Serve Docs Locally with Live Reload Source: https://docs.rendercv.com/developer_guide/documentation Starts a local development server for previewing documentation changes. Edits to Markdown files will be reflected instantly. ```shell just serve-docs ``` -------------------------------- ### CLI Command: new Source: https://docs.rendercv.com/api_reference/cli/new_command/new_command Initializes a new RenderCV project by creating a sample YAML input file and optionally generating template files. ```APIDOC ## CLI Command: new ### Description Initializes a new RenderCV project. This command generates a sample YAML input file for your CV and can optionally create template files for Typst or Markdown. ### Method CLI Command ### Endpoint `rendercv new ""` ### Parameters #### Path Parameters - **full_name** (string) - Required - Your full name, used to generate the default input file name (e.g., "John Doe" becomes "John_Doe_CV.yaml"). #### Query Parameters - **--theme** (string) - Optional - Specifies the theme for the CV. Defaults to 'classic'. Available themes are listed dynamically. - **--locale** (string) - Optional - Specifies the locale for the CV. Defaults to 'english'. Available locales are listed dynamically. - **--create-typst-templates** (boolean) - Optional - If set to true, creates Typst template files. - **--create-markdown-templates** (boolean) - Optional - If set to true, creates Markdown template files. ### Request Example ```bash rendercv new "Jane Doe" --theme "modern" --locale "english" --create-typst-templates ``` ### Response #### Success Response - **Output**: Prints messages to the console indicating which files and templates were created or already exist. #### Response Example ``` Welcome to RenderCV! Panel: - Your YAML input file: John_Doe_CV.yaml - Typst templates: modern Created: - Your YAML input file: John_Doe_CV.yaml - Typst templates: modern ``` ``` -------------------------------- ### OneLineEntry Label Field Example Source: https://docs.rendercv.com/api_reference/schema/models/cv/entries/one_line Example usage of the 'label' field in OneLineEntry, which is used to provide a human-readable label for the entry. ```python pydantic.Field(examples=['Languages', 'Citizenship', 'Security Clearance']) ``` -------------------------------- ### OneLineEntry Details Field Example Source: https://docs.rendercv.com/api_reference/schema/models/cv/entries/one_line Example usage of the 'details' field in OneLineEntry, which accepts strings for various pieces of information. ```python pydantic.Field(examples=['English (native), Spanish (fluent)', 'US Citizen', 'Top Secret']) ``` -------------------------------- ### Create a Custom Theme Source: https://docs.rendercv.com/user_guide/how_to/override_default_templates?q= Initializes a new directory structure for a reusable custom theme. ```bash rendercv create-theme mytheme ``` -------------------------------- ### Create a custom theme Source: https://docs.rendercv.com/user_guide/cli_reference Generate a directory with template files for creating a custom theme. ```bash rendercv create-theme "mytheme" ``` -------------------------------- ### BulletEntry Field Example Source: https://docs.rendercv.com/api_reference/schema/models/cv/entries/bullet Example usage of the 'bullet' field within a BulletEntry, demonstrating acceptable string inputs for list items. ```python bullet = pydantic.Field(examples=['Python, JavaScript, C++', 'Excellent communication skills']) ``` -------------------------------- ### Install Bundled Typst Package Source: https://docs.rendercv.com/api_reference/renderer/pdf_png?q= Installs a bundled Typst package into the temporary package cache, ensuring the correct directory structure for the Typst compiler. ```APIDOC ## install_bundled_typst_package(bundled_path, package_name, temp_dir, typ_files) ### Description Copy a bundled Typst package into the temporary package cache. The Typst compiler expects packages in a directory structure of preview/{name}/{version}/. This copies the required files from a bundled package into that layout. ### Parameters #### Path Parameters - **bundled_path** (Path) - Required - Path to the bundled package directory. - **package_name** (str) - Required - Name of the Typst package (used in directory structure). - **temp_dir** (Path) - Required - Root of the temporary package cache. - **typ_files** (list[str]) - Required - List of .typ filenames to copy alongside typst.toml. ### Returns - None ``` -------------------------------- ### Typst Template Structure Example Source: https://docs.rendercv.com/user_guide/how_to/override_default_templates An example of a Typst template file using Jinja2 syntax for dynamic content rendering. It shows how to iterate over entry data. ```typst // Example: entries/NormalEntry.j2.typ #regular-entry( [ {% for line in entry.main_column.splitlines() %} {{ line }} {% endfor %} ], [ {% for line in entry.date_and_location_column.splitlines() %} {{ line }} {% endfor %} ], ) ``` -------------------------------- ### print_welcome Function Source: https://docs.rendercv.com/api_reference/cli/new_command/print_welcome?q= Displays a welcome banner with the RenderCV version and useful links to documentation, source code, and issue tracker. ```APIDOC ## `print_welcome()` ### Description Displays a welcome banner with the RenderCV version and useful links. ### Method N/A (This is a CLI function, not an HTTP endpoint) ### Endpoint N/A ### Parameters None ### Request Example N/A ### Response N/A (This function prints to the console) ### Console Output Example ``` Welcome to RenderCV vX.Y.Z! +-----------------------------------------------------------------------------+ | Useful Links | +-----------------------------------------------------------------------------+ | RenderCV App: https://rendercv.com | | Documentation: https://docs.rendercv.com | | Source code: https://github.com/rendercv/rendercv/ | | Bug reports: https://github.com/rendercv/rendercv/issues/ | +-----------------------------------------------------------------------------+ ``` (Note: Version number and exact formatting may vary.) ``` -------------------------------- ### Install RenderCV AI Skill Source: https://docs.rendercv.com/ Install the RenderCV skill for AI coding agents to enable them to create and edit your CV. This command uses npx to add the skill. ```bash npx skills add rendercv/rendercv-skill ``` -------------------------------- ### Create Sample Settings YAML File - Python Source: https://docs.rendercv.com/api_reference/schema/sample_generator?q= Generates a sample YAML file containing only the settings section. Useful for creating standalone settings files to configure render options independently. ```python def create_sample_settings_file( *, file_path: pathlib.Path | None = None, omitted_fields: list[str] | None = None, ) -> str | None: """Generate a sample YAML file containing only the settings section. Why: Standalone settings files let users configure render options independently from CV content, design, and locale. Args: file_path: Optional path to write file. Returns: YAML string if file_path is None, otherwise None after writing file. """ data_model = create_sample_rendercv_pydantic_model() dictionary = rendercv_model_to_dictionary(data_model) if omitted_fields is not None: for field in omitted_fields: dictionary["settings"].pop(field, None) return create_sample_yaml_file( dictionary={"settings": dictionary["settings"]}, file_path=file_path ) ``` -------------------------------- ### Render Top Note Template Example Source: https://docs.rendercv.com/api_reference/renderer/templater/footer_and_top_note?q= Example usage of render_top_note_template to generate a 'Last Updated' string. Requires locale, current date, and date formatting template. ```python result = render_top_note_template( "LAST_UPDATED: CURRENT_DATE", locale=english_locale, current_date=date(2025, 1, 15), name="John Doe", single_date_template="MONTH_ABBREVIATION YEAR", ) # Returns: "Last Updated: Jan 2025" ``` -------------------------------- ### Install Bundled Typst Package Source: https://docs.rendercv.com/api_reference/renderer/pdf_png Installs a Typst package from a bundled directory into the temporary package cache. This is necessary because the Typst compiler expects packages in a specific directory structure. ```APIDOC ## POST /websites/rendercv/typst/packages/install ### Description Copies files from a bundled Typst package into the temporary package cache, organizing them according to the expected directory structure (preview/{name}/{version}/). This function ensures that the Typst compiler can locate and use the bundled package. ### Method POST ### Endpoint /websites/rendercv/typst/packages/install ### Parameters #### Request Body - **bundled_path** (Path) - Required - Path to the directory containing the bundled Typst package. - **package_name** (str) - Required - The name of the Typst package, used in the directory structure. - **temp_dir** (Path) - Required - The root directory of the temporary package cache. - **typ_files** (list[str]) - Required - A list of .typ filenames to be copied along with the typst.toml file. ### Request Example ```json { "bundled_path": "/path/to/bundled/package", "package_name": "my_package", "temp_dir": "/tmp/typst_cache", "typ_files": ["main.typ", "utils.typ"] } ``` ### Response #### Success Response (200) - **message** (str) - Indicates successful installation of the package. #### Response Example ```json { "message": "Bundled Typst package 'my_package' installed successfully." } ``` ``` -------------------------------- ### Initialize RenderCV CLI App Source: https://docs.rendercv.com/api_reference/cli/app?q= Sets up the main Typer application instance for RenderCV CLI. It configures rich markup for help messages and handles the --version flag, displaying the version or showing help if no subcommand is invoked. ```python @app.callback() def cli_command_no_args( ctx: typer.Context, version_requested: Annotated[ bool | None, typer.Option("--version", "-v", help="Show the version") ] = None, ): """RenderCV is a command-line tool for rendering CVs from YAML input files. For more information, see https://docs.rendercv.com. """ warn_if_new_version_is_available() if version_requested: print(f"RenderCV v{__version__}") elif ctx.invoked_subcommand is None: # No command was provided, show help print(ctx.get_help()) raise typer.Exit() ``` -------------------------------- ### Deploy Documentation Source: https://docs.rendercv.com/developer_guide/github_workflows This workflow builds and deploys the documentation website to GitHub Pages. It runs on pushes to the main branch and can be triggered manually. ```yaml name: deploy-docs on: push: branches: [ main ] workflow_dispatch: jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.12" - name: Install uv run: pip install uv - name: Install just run: pip install just - name: Build documentation run: just build-docs - name: Deploy to GitHub Pages uses: actions/deploy-pages@v4 id: deployment with: artifact_name: documentation ``` -------------------------------- ### Start RenderCV with Watch Mode Source: https://docs.rendercv.com/user_guide/how_to/set_up_vs_code_for_rendercv?q= Run this command in your terminal to start the RenderCV rendering process with watch mode enabled. It monitors your YAML CV file for changes and automatically re-renders the PDF upon saving. ```bash rendercv render --watch John_Doe_CV.yaml ``` -------------------------------- ### CLI Command: create-theme Source: https://docs.rendercv.com/api_reference/cli/create_theme_command/create_theme_command The create-theme command initializes a new custom theme folder containing Typst templates and an __init__.py file for configuration. ```APIDOC ## CLI Command: create-theme ### Description Creates a custom theme folder with Typst templates to allow for user customization. It also generates an __init__.py file for theme-specific design options. ### Method CLI Command ### Parameters #### Path Parameters - **theme_name** (str) - Required - The name of the new theme folder to be created in the current working directory. ### Response - **Success** - Creates a new directory named after the theme, copies necessary templates, and prints a confirmation panel with instructions on how to use the theme in a YAML input file. ``` -------------------------------- ### Validate and Adjust Entry Dates Source: https://docs.rendercv.com/api_reference/schema/models/cv/entries/bases/entry_with_complex_fields?q= This Pydantic model validator ensures that dates within an entry are consistent. It handles cases where only a date, only an end date, or only a start date is provided, and validates that the start date does not occur after the end date. ```python @pydantic.model_validator(mode="after") def check_and_adjust_dates(self, info: pydantic.ValidationInfo) -> Self: date_is_provided = self.date is not None start_date_is_provided = self.start_date is not None end_date_is_provided = self.end_date is not None if date_is_provided: # If only date is provided, ignore start_date and end_date: self.start_date = None self.end_date = None elif not start_date_is_provided and end_date_is_provided: # If only end_date is provided, assume it is a one-day event and act like # only the date is provided: self.date = self.end_date self.start_date = None self.end_date = None elif start_date_is_provided and not end_date_is_provided: # If only start_date is provided, assume it is an ongoing event, i.e., the # end_date is present: self.end_date = "present" if self.start_date and self.end_date: # Check if the start_date is before the end_date: current_date = get_current_date(info) start_date_object = get_date_object(self.start_date, current_date) end_date_object = get_date_object(self.end_date, current_date) if start_date_object > end_date_object: raise pydantic_core.PydanticCustomError( CustomPydanticErrorTypes.other.value, "`start_date` cannot be after `end_date`. The `start_date` is" " {start_date} and the `end_date` is {end_date}.", { "start_date": self.start_date, "end_date": self.end_date, }, ) return self ``` -------------------------------- ### check_and_adjust_dates Model Validator Source: https://docs.rendercv.com/api_reference/schema/models/cv/entries/bases/entry_with_complex_fields?q= This model validator ensures that date fields within CV entries are consistent and correctly formatted. It handles cases where only a date is provided, or when start and end dates are specified, and validates that the start date does not occur after the end date. ```APIDOC ## check_and_adjust_dates(info) ### Description Validates and adjusts date fields within a CV entry model. It prioritizes a single `date` field, handles cases with `start_date` and `end_date`, and ensures `start_date` precedes `end_date`. ### Method Model Validator (`@pydantic.model_validator(mode="after")`) ### Parameters - **info** (pydantic.ValidationInfo) - Information about the validation context. ### Request Body (Implicitly the model instance being validated) - **date** (str | None) - A specific date for the entry. - **start_date** (str | None) - The start date of an event or period. - **end_date** (str | None) - The end date of an event or period. ### Response #### Success Response (Self) - Returns the validated and adjusted model instance. #### Response Example (The model instance itself after validation) ### Error Handling - Raises `pydantic_core.PydanticCustomError` if `start_date` is after `end_date`. ``` -------------------------------- ### Create Executable Source: https://docs.rendercv.com/developer_guide?q= Use `just create-executable` to create a standalone executable version of the project. ```bash just create-executable ``` -------------------------------- ### NumberedEntry Example Source: https://docs.rendercv.com/user_guide/yaml_input_structure/cv Use NumberedEntry for content that should be automatically numbered. ```yaml number: This is a numbered entry. ``` -------------------------------- ### General RenderCV Commands Source: https://docs.rendercv.com/user_guide/cli_reference?q= Commands for checking version and getting help. ```APIDOC ## `rendercv` Check your installed version: ``` rendercv --version ``` Get help anytime: ``` rendercv --help ``` ``` -------------------------------- ### Build Static Documentation Website Source: https://docs.rendercv.com/developer_guide/documentation Generates the final static website files in the 'site/' directory. This command is typically used for deployment. ```shell just build-docs ``` -------------------------------- ### BulletEntry Example Source: https://docs.rendercv.com/user_guide/yaml_input_structure/cv Use BulletEntry for simple lists where each item is a single bullet point. ```yaml bullet: This is a bullet entry. ``` -------------------------------- ### Pydantic Field for Summary Source: https://docs.rendercv.com/api_reference/schema/models/cv/entries/experience Defines a 'summary' field with a default value and example descriptions. ```python summary = pydantic.Field(default=None, examples=['Led a team of 5 engineers to develop innovative solutions.', 'Completed advanced coursework in machine learning and artificial intelligence.']) ``` -------------------------------- ### Display Welcome Banner with Links Source: https://docs.rendercv.com/api_reference/cli/new_command/print_welcome Use this function to display a welcome message including the RenderCV version and links to the app, documentation, source code, and bug reports. It requires the `rich` library for formatted output. ```python def print_welcome() -> None: """Display welcome banner with version and useful links. Why: New users need guidance on where to find documentation and support. """ print(f"\nWelcome to [dodger_blue3]RenderCV v{__version__}[/dodger_blue3]!\n") links = { "RenderCV App": "https://rendercv.com", "Documentation": "https://docs.rendercv.com", "Source code": "https://github.com/rendercv/rendercv/", "Bug reports": "https://github.com/rendercv/rendercv/issues/", } link_strings = [ f"[bold cyan]{title + ':':<15}[/bold cyan] [link={link}]{link}[/link]" for title, link in links.items() ] link_panel = rich.panel.Panel( "\n".join(link_strings), title="Useful Links", title_align="left", border_style="bright_black", ) print(link_panel) ```