Skip to content

Respect gitignore when copying files in DefaultDriver.build_local #30

@vpratz

Description

@vpratz

Building local can get slow when the working directory includes large folders, like the virtual environment for a larger project, as copying can take some time.

shutil.copytree has an ignore parameter, that could be used to exclude certain files/directories. For me, it would be intuitive to ignore files in .gitignore by default. A different project has implemented it like this, we could do something similar.

The easier option would be to ignore some default directories, then we would just do a call like this in driver.py, L.337

shutil.copytree(
    self.root,
    path,
    symlinks=True,
    dirs_exist_ok=True,
    ignore=shutil.ignore_patterns(".venv", "venv", "_build"),
)

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions