Closed Bug 1646427 Opened 2 years ago Closed 2 years ago

|mach vendor python| should exclude tests and docs


(Firefox Build System :: General, enhancement)



(firefox79 fixed)

Tracking Status
firefox79 --- fixed


(Reporter: ahal, Assigned: ahal)



(4 files)

Currently |mach vendor python| will often include superfluous files like tests, docs, dotfiles, etc. Some of our vendored packages have pretty massive test directories.

I think in the past there was a bit of push back against removing them because they could theoretically be required by the package. But imo the lack of removal causes real pain here, and in the spirit of not letting perfect be the enemy of good, I'd like to simply exclude directories named "test", "tests" or "docs" (and then not worry about other stuff like the dotfiles).

In the rare event that a package actually needs one of the files in those directories, we can add a flag to disable that behaviour.

This adds a way to exclude certain file patterns when extracting Python
packages in |mach vendor python|. For now I've excluded likely test and doc
dirs, though we may want to expand on the list in the future.

Depends on D80208

Pushed by
[mozfile] Convert '' to the pytest format, r=gbrown
[mozfile] Add ability to ignore file patterns while extracting, r=gbrown
[vendor] Exclude test and documentation dirs when vendoring Python packages, r=rstewart
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79

There's a bug in moz-phab that has been preventing me from landing the last patch.. I'll ask a sheriff to land it for me if I can't figure out a work around.

Resolution: FIXED → ---
Pushed by
[vendor] Re-run |mach vendor python| with the new ignore rules, r=rstewart

It looks like the most recent changeset added /third_party/python/pathspec/pathspec/tests/ which wasn't included before.

Yes, that was somewhat intentional.

I think the end goal here is that what we vendor should match what we specify in the ignore list so that developers running ./mach vendor python don't need to worry about it. In this case the developer that vendored pathspec manually removed that tests directory (I likely asked them to). But going forward, I think it's more important that the set of vendored files stays in sync with what is specified in the ignore list. Otherwise, running ./mach vendor python will cause unrelated side effects (i.e, constantly trying to add or remove stuff back in).

In the case of pathspec, it got added because pathspec places their tests directly in the actual package (pathspec/pathspect/tests instead of pathspec/tests) which imo is bad practice. Therefore our ignore rule of */tests doesn't match. To catch that tests directory as well we could change it to **/tests, but this feels a bit risky as there could be a legitimate directory called tests somewhere that would actually be needed by the package to function. So it felt safer to simply allow those files back in.

Closed: 2 years ago2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.