sinaatalay / rendercv

A LaTeX CV/resume framework
http://docs.rendercv.com
MIT License
574 stars 54 forks source link

Move boilerplate CV/resume content out of data_models.py #103

Closed 1993CRV closed 2 days ago

1993CRV commented 1 month ago

create separate file for boilerplate content. remove from get_a_sample_data_model function in data_models.py

data_models.py is a bit long and unwieldy (1811 lines)

def get_a_sample_data_model(
    name: str = "John Doe", theme: str = "classic"
) -> RenderCVDataModel:
    """Return a sample data model for new users to start with.

    Args:
        name (str, optional): The name of the person. Defaults to "John Doe".
    Returns:
        RenderCVDataModel: A sample data model.
    """
    # Check if the theme is valid:
    if theme not in available_themes:
        available_themes_string = ", ".join(available_themes)
        raise ValueError(
            f"The theme should be one of the following: {available_themes_string}!"
            f' The provided theme is "{theme}".'
        )

    name = name.encode().decode("unicode-escape")

    sections = {
        "welcome_to_rendercv!": [
            (
                "[RenderCV](https://github.com/sinaatalay/rendercv) is a LaTeX-based"
                " CV/resume framework. It allows you to create a high-quality CV or"
                " resume as a PDF file from a YAML file, with **full Markdown syntax"
                " support** and **complete control over the LaTeX code**."
            ),
            (
                "The boilerplate content is taken from"
                " [here](https://github.com/dnl-blkv/mcdowell-cv), where a"
                " *clean and tidy CV* pattern is proposed by"
                " **[Gayle Laakmann McDowell](https://www.gayle.com/)**."
            ),
        ],
        "quick_guide": [
            BulletEntry(
                bullet=(
                    "Each section title is arbitrary, and each section contains a list"
                    " of entries."
                ),
            ),
            BulletEntry(
                bullet=(
                    "There are 7 unique entry types: *BulletEntry*, *TextEntry*,"
                    " *EducationEntry*, *ExperienceEntry*, *NormalEntry*,"
                    " *PublicationEntry*, and *OneLineEntry*."
                ),
            ),
            BulletEntry(
                bullet=(
                    "Select a section title, pick an entry type, and start writing your"
                    " section!"
                )
            ),
            BulletEntry(
                bullet=(
                    "[Here](https://docs.rendercv.com/user_guide/), you can find a"
                    " comprehensive user guide for RenderCV."
                )
            ),
        ],
        "education": [
            EducationEntry(
                institution="University of Pennsylvania",
                area="Computer Science",
                degree="BS",
                start_date="2000-09",
                end_date="2005-05",
                highlights=[
                    "GPA: 3.9/4.0 ([Transcript](https://example.com))",
                    (
                        "**Coursework:** Computer Architecture, Artificial"
                        " Intelligence, Comparison of Learning Algorithms,"
                        " Computational Theory"
                    ),
                ],
            ),
        ],
        "experience": [
            ExperienceEntry(
                company="Apple",
                position="Software Engineer",
                start_date="2005-06",
                end_date="2007-08",
                location="Cupertino, CA",
                highlights=[
                    (
                        "Reduced time to render the user's buddy list by 75% by"
                        " implementing a prediction algorithm"
                    ),
                    (
                        "Implemented iChat integration with OS X Spotlight Search by"
                        " creating a tool to extract metadata from saved chat"
                        " transcripts and provide metadata to a system-wide search"
                        " database"
                    ),
                    (
                        "Redesigned chat file format and implemented backward"
                        " compatibility for search"
                    ),
                ],
            ),
            ExperienceEntry(
                company="Microsoft",
                position="Lead Student Ambassador",
                start_date="2003-09",
                end_date="2005-04",
                location="Redmond, WA",
                highlights=[
                    (
                        "Promoted to Lead Student Ambassador in the Fall of 2004,"
                        " supervised 10-15 Student Ambassadors"
                    ),
                    (
                        "Created and taught a computer science course, CSE 099:"
                        " Software Design and Development"
                    ),
                ],
            ),
            ExperienceEntry(
                company="University of Pennsylvania",
                position="Head Teaching Assistant",
                start_date="2001-10",
                end_date="2003-05",
                location="Philadelphia, PA",
                highlights=[
                    (
                        "Implemented a user interface for the VS open file switcher"
                        " (ctrl-tab) and extended it to tool windows"
                    ),
                    (
                        "Created a service to provide gradient across VS and VS"
                        " add-ins, optimized its performance via caching"
                    ),
                    "Programmer Productivity Research Center (Summers 2001, 2002)",
                    (
                        "Built an app to compute the similarity of all methods in a"
                        " code base, reducing the time from $\\mathcal{O}(n^2)$ to"
                        " $\\mathcal{O}(n \\log n)$"
                    ),
                    (
                        "Created a test case generation tool that creates random XML"
                        " docs from XML Schema"
                    ),
                ],
            ),
            ExperienceEntry(
                company="Microsoft",
                position="Software Engineer, Intern",
                start_date="2003-06",
                end_date="2003-08",
                location="Redmond, WA",
                highlights=[
                    (
                        "Automated the extraction and processing of large datasets from"
                        " legacy systems using SQL and Perl scripts"
                    ),
                ],
            ),
        ],
        "publications": [
            PublicationEntry(
                title=(
                    "Magneto-Thermal Thin Shell Approximation for 3D Finite Element"
                    " Analysis of No-Insulation Coils"
                ),
                authors=[
                    "Albert Smith",
                    f"***{name}***",
                    "Jane Derry",
                    "Harry Tom",
                    "Frodo Baggins",
                ],
                date="2004-01",
                doi="10.1109/TASC.2023.3340648",
            )
        ],
        "projects": [
            NormalEntry(
                name="Multi-User Drawing Tool",
                date="[github.com/name/repo](https://github.com/sinaatalay/rendercv)",
                highlights=[
                    (
                        "Developed an electronic classroom where multiple users can"
                        ' view and simultaneously draw on a "chalkboard" with each'
                        " person's edits synchronized"
                    ),
                    "Tools Used: C++, MFC",
                ],
            ),
            NormalEntry(
                name="Synchronized Calendar",
                date="[github.com/name/repo](https://github.com/sinaatalay/rendercv)",
                highlights=[
                    (
                        "Developed a desktop calendar with globally shared and"
                        " synchronized calendars, allowing users to schedule meetings"
                        " with other users"
                    ),
                    "Tools Used: C#, .NET, SQL, XML",
                ],
            ),
            NormalEntry(
                name="Operating System",
                date="2002",
                highlights=[
                    (
                        "Developed a UNIX-style OS with a scheduler, file system, text"
                        " editor, and calculator"
                    ),
                    "Tools Used: C",
                ],
            ),
        ],
        "additional_experience_and_awards": [
            OneLineEntry(
                label="Instructor (2003-2005)",
                details="Taught 2 full-credit computer science courses",
            ),
            OneLineEntry(
                label="Third Prize, Senior Design Project",
                details=(
                    "Awarded 3rd prize for a synchronized calendar project out of 100"
                    " entries"
                ),
            ),
        ],
        "technologies": [
            OneLineEntry(
                label="Languages",
                details="C++, C, Java, Objective-C, C#, SQL, JavaScript",
            ),
            OneLineEntry(
                label="Software",
                details=".NET, Microsoft SQL Server, XCode, Interface Builder",
            ),
        ],
    }
    cv = CurriculumVitae(
        name=name,
        location="Your Location",
        email="youremail@yourdomain.com",
        phone="+905419999999",  # type: ignore
        website="https://yourwebsite.com",  # type: ignore
        social_networks=[
            SocialNetwork(network="LinkedIn", username="yourusername"),
            SocialNetwork(network="GitHub", username="yourusername"),
        ],
        sections=sections,  # type: ignore
    )

    if theme == "classic":
        design = ClassicThemeOptions(theme="classic", show_timespan_in=["Experience"])
    else:
        design = rendercv_design_validator.validate_python({"theme": theme})  # type: ignore

    return RenderCVDataModel(cv=cv, design=design)
sinaatalay commented 3 weeks ago

I agree that data_models.py is huge right now, but I intend to maintain the project structure unless there is a critical requirement for change.

1993CRV commented 3 weeks ago

Can you re-visit this? I think more people are likely to contribute to the project if this file were a bit less wieldy. It's 1811 lines long.

sinaatalay commented 2 days ago

Thank you. I changed my mind; the source code was getting out of hand. I completely refactored rendercv. Now, the boilerplate content is in here.