Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up builds with large number of git ignored files #499

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

erikjohnston
Copy link

Poetry calls git ls-files against the package directory to get the full list of files to exclude during build. This is very slow if you have e.g. hundreds of thousands of files that are ignored (don't ask why I have that).

Calling git ls-files --directory instead is a lot faster, as it doesn't return all files in directories that are ignored.

Doing that, however, requires refactoring find_excluded_files to not simply return the set of all files that are to be ignored. Instead, we return a container object that correctly handles ignored directories.

This does change the API of Builder.find_excluded_files to return a Container[str] rather than set[str], but I'm not sure if that is part of any public API.

  • Added tests for changed code.
  • Updated documentation for changed code.

erikjohnston and others added 3 commits October 11, 2022 10:50
Poetry checks a lot of files against the list of excluded files. If
there are many files ignored by git this can severly slow down builds.

Currently, if a directory is ignored by git then all files within that
directory get added to set of excluded files to check.
@sonarcloud
Copy link

sonarcloud bot commented Oct 11, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.0 PRs for core 2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants