Add options for sparse checkout in GitFetcher#45473
Merged
psakievich merged 18 commits intospack:developfrom Aug 15, 2024
psakievich:f/git-sparse-checkout
Merged
Add options for sparse checkout in GitFetcher#45473psakievich merged 18 commits intospack:developfrom psakievich:f/git-sparse-checkout
psakievich merged 18 commits intospack:developfrom
psakievich:f/git-sparse-checkout
Conversation
Newer versions of git have a beta feature called sparse checkout that allow users to check out a portion of a large repo. This feature will be ideal for monolithic repo projects that want to model their infrastructure via spack. This PR implements an addition to the GitFetcher that allows users to add a `git_sparse_paths` attribute to package classes or versions which will then use sparse checkout on those directories/files for the package.
Contributor
Author
|
@spackbot fix-style |
Contributor
Author
|
@spackbot fix style |
|
Let me see if I can fix that for you! |
|
I was able to run spack style --fix==> Running style checks on spack
selected: isort, black, flake8, mypy
==> Modified files
lib/spack/spack/fetch_strategy.py
lib/spack/spack/test/conftest.py
lib/spack/spack/test/git_fetch.py
lib/spack/spack/test/packages.py
lib/spack/spack/version/git_ref_lookup.py
var/spack/repos/builtin.mock/packages/git-monorepo-mock/package.py
==> Running isort checks
isort checks were clean
==> Running black checks
reformatted lib/spack/spack/test/git_fetch.py
reformatted lib/spack/spack/test/conftest.py
All done! ✨ 🍰 ✨
2 files reformatted, 4 files left unchanged.
black checks were clean
==> Running flake8 checks
flake8 checks were clean
==> Running mypy checks
lib/spack/spack/version/version_types.py:145: error: Argument 2 to "StandardVersion" has incompatible type "*Tuple[Tuple[Any, ...], Tuple[Any, ...]]"; expected "Tuple[Tuple[Any, ...], Tuple[Any, ...]]" [arg-type]
lib/spack/spack/version/version_types.py:452: error: Argument 2 to "StandardVersion" has incompatible type "*Tuple[Tuple[Any, ...], Tuple[Any, ...]]"; expected "Tuple[Tuple[Any, ...], Tuple[Any, ...]]" [arg-type]
lib/spack/spack/version/version_types.py:481: error: Argument 2 to "StandardVersion" has incompatible type "*Tuple[Tuple[Any, ...], Tuple[Any, ...]]"; expected "Tuple[Tuple[Any, ...], Tuple[Any, ...]]" [arg-type]
Found 3 errors in 1 file (checked 621 source files)
mypy found errors
I've updated the branch with style fixes. |
Contributor
|
We are modeling the internal products in the SIERRA code suite as spack packages and this sparse checkout feature is reducing the fetch times from O(min) to O(s) for each package and there are O(50) packages and growing (we are actively converting things). This is a huge win for us in monorepo land! |
mdmosby
reviewed
Aug 9, 2024
Co-authored-by: Matthew Mosby <[email protected]>
becker33
requested changes
Aug 12, 2024
…ut' into f/git-sparse-checkout
Contributor
Author
|
@spackbot fix style |
becker33
approved these changes
Aug 14, 2024
Chrismarsh
pushed a commit
to Chrismarsh/spack
that referenced
this pull request
Aug 16, 2024
* Add options for sparse checkout in GitFetcher Newer versions of git have a beta feature called sparse checkout that allow users to check out a portion of a large repo. This feature will be ideal for monolithic repo projects that want to model their infrastructure via spack. This PR implements an addition to the GitFetcher that allows users to add a `git_sparse_paths` attribute to package classes or versions which will then use sparse checkout on those directories/files for the package. * Style * Split git clone into multiple functions * Add sparse-checkout impl * Internalize src clone functions * Docs * Adding sparse clone test * Add test for partial clone * [@spackbot] updating style on behalf of psakievich * Small fixes * Restore default branch status * Fix attributes for package * Update lib/spack/docs/packaging_guide.rst Co-authored-by: Matthew Mosby <[email protected]> * Extend unit test to multiple git versions * style --------- Co-authored-by: psakievich <[email protected]> Co-authored-by: Matthew Mosby <[email protected]>
tldahlgren
pushed a commit
to AcriusWinter/spack
that referenced
this pull request
Aug 20, 2024
* Add options for sparse checkout in GitFetcher Newer versions of git have a beta feature called sparse checkout that allow users to check out a portion of a large repo. This feature will be ideal for monolithic repo projects that want to model their infrastructure via spack. This PR implements an addition to the GitFetcher that allows users to add a `git_sparse_paths` attribute to package classes or versions which will then use sparse checkout on those directories/files for the package. * Style * Split git clone into multiple functions * Add sparse-checkout impl * Internalize src clone functions * Docs * Adding sparse clone test * Add test for partial clone * [@spackbot] updating style on behalf of psakievich * Small fixes * Restore default branch status * Fix attributes for package * Update lib/spack/docs/packaging_guide.rst Co-authored-by: Matthew Mosby <[email protected]> * Extend unit test to multiple git versions * style --------- Co-authored-by: psakievich <[email protected]> Co-authored-by: Matthew Mosby <[email protected]>
FrederickDeny
pushed a commit
to FrederickDeny/spack
that referenced
this pull request
Aug 26, 2024
* Add options for sparse checkout in GitFetcher Newer versions of git have a beta feature called sparse checkout that allow users to check out a portion of a large repo. This feature will be ideal for monolithic repo projects that want to model their infrastructure via spack. This PR implements an addition to the GitFetcher that allows users to add a `git_sparse_paths` attribute to package classes or versions which will then use sparse checkout on those directories/files for the package. * Style * Split git clone into multiple functions * Add sparse-checkout impl * Internalize src clone functions * Docs * Adding sparse clone test * Add test for partial clone * [@spackbot] updating style on behalf of psakievich * Small fixes * Restore default branch status * Fix attributes for package * Update lib/spack/docs/packaging_guide.rst Co-authored-by: Matthew Mosby <[email protected]> * Extend unit test to multiple git versions * style --------- Co-authored-by: psakievich <[email protected]> Co-authored-by: Matthew Mosby <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Newer versions of git have a beta feature called sparse checkout that allow users to check out a portion of a large repo.
This feature will be ideal for monolithic repo projects that want to model their infrastructure via spack. This PR implements an addition to the GitFetcher that allows users to add a
git_sparse_pathsattribute to package classes or versions which will then use sparse checkout on those directories/files for the package.Steps for completion
git_sparse_pathsattribute and test it can be called for versions and package attributesThis PR also refactors the
GitFetcher.clonemethod to break it up into somewhat smaller functions. This is to improve readability and compatibility with further refactors with #44319 when we will be able to do the vast majority of git clones per commit instead per branch/tag.