Validate in CI virtualenvs don't have dependency collisions with "global" virtualenv, or between vendored + pypi'd deps
Categories
(Firefox Build System :: Mach Core, enhancement, P2)
Tracking
(firefox94 fixed)
Tracking | Status | |
---|---|---|
firefox94 | --- | fixed |
People
(Reporter: mhentges, Assigned: mhentges)
References
(Blocks 2 open bugs)
Details
Attachments
(4 files)
First, some backstory: there's a two different ways of activating the command's virtual environment:
- Use an independent Python process.
- Re-use the existing process and activate the new virtualenv within it.
Using an independent Python process fully insulates the command (and its dependencies) from the global mach operations' dependencies. However, in addition to the performance hit (roughly ~100ms Python startup time on a fast Linux machine), it has some inflexibilities:
- Passing data (
moz.build
parsed goodies, context, etc) becomes more difficult - it has to be encoded, transferred to the other process, and decoded. - Behaviour that would be trivial in a single Python process becomes harder:
- Having
sentry
capture exceptions from eithermach
or the active command. - Passing a
glean
handle into virtualenvs (we'd have to ensure that commands are using the same version of glean as global mach, as well as find a nice way of sharing the initialization logic).
- Having
Now, the downside of re-using the same python process is that import state is maintained: if we import glean-sdk==38.0.1
(mach venv), and that imports glean_parser==3.2.0
(mach venv), and that imports PyYAML==3.13
(mach venv), then import yaml
will always return PyYAML==3.13
from the (mach venv), even after the virtualenv changes. (Technically, imports can be re-loaded, but then that can cause issues if glean-sdk
performs an import from within a function and gets the wrong package).
Fortunately, this issue is completely manageable - if we validate that each virtualenv's dependencies are compatible with the global mach venv's dependencies, then we won't have issues.
From my perspective, the "validation" technique is the most manageable: we still get to write a single cohesive Python application, but we are able to have the different commands have their own distinct dependencies which are incompatible with each other.
This ticket is to capture the automatic validation of the command virtualenvs in CI.
Note that, due to system-specific requirements, we probably need to run these tests in:
- All supported Pythons (Python 3.6 through 3.9)
- All primary platforms (Mac, Windows, Linux)
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 1•3 years ago
|
||
We're going to need to validate command dependency compatibility with both:
- Global Mach dependencies and
- Python testing dependencies
Assignee | ||
Comment 2•3 years ago
|
||
The existing version of pyasn1-modules
(0.1.5
) is incompatible with
our version of pyasn1
(0.4.8
).
By bumping pyasn1-modules
to 0.2.8
, we now meet its compatibility
requirements.
Depends on D122896
Assignee | ||
Comment 3•3 years ago
|
||
Add pystache to vendor requirements.in
so that it's vendored according
to ./mach vendor python
"ignore" rules.
This ensures that sufficient files are vendored such that installing the
package from it's setup.py
file is possible.
Depends on D122897
Assignee | ||
Comment 4•3 years ago
|
||
We vendor glean_parser==3.6.0
, and that was incompatible with
glean-sdk==36.0.0
's requirement of glean_parser==2.5.0
.
glean-sdk==40.0.0
expects glean_parser==3.6.0
, which is perfect.
Depends on D122898
Assignee | ||
Comment 5•3 years ago
|
||
This adds two main compatibility guarantees:
- Vendored dependencies <=> Pypi-downloaded dependencies
- Global Mach dependencies <=> command-specific dependencies
As part of this, a new vendored:
action was added to the virtualenv
definition format. Otherwise similar to pth:
paths, vendored:
packages are assumed to be "pip install"-able.
Some validation (the .dist-info
check) was added to requirements.py
to verify that pth:
and vendored:
are correctly used. However, I
couldn't add a setup.py
check because some of our un-installable
internal modules (mozbase
, etc) have out-of-date and potentially
inaccurate setup.py
files. Though it would be nice to leverage each
internal module as an independent package with its own scoped set of
dependencies, that's a project for another time.
Depends on D122899
Updated•3 years ago
|
Pushed by mhentges@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3f85c601e434 Bump glean-sdk version to 40.0.0 r=ahal
Pushed by mhentges@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9ccf99dae3c7 Use compatible version of pyasn1-modules r=ahal https://hg.mozilla.org/integration/autoland/rev/2c6edefd8417 Vendor pystache automatically r=ahal
Comment 8•3 years ago
|
||
Backed out for causing invalid handle xpcshell failures.
Failure log: https://treeherder.mozilla.org/logviewer?job_id=350477627&repo=autoland
Backout link: https://hg.mozilla.org/integration/autoland/rev/6b58b83b626e01f7b2af85156c293c9bccd82816
Comment 9•3 years ago
|
||
Bump glean-sdk version to 40.0.0 r=ahal
https://hg.mozilla.org/integration/autoland/rev/3f85c601e434331a3b06eac39c216bfadc39cf7f
https://hg.mozilla.org/mozilla-central/rev/3f85c601e434
Comment 10•3 years ago
|
||
Pushed by mhentges@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c196c1ecdff7 Use compatible version of pyasn1-modules r=ahal https://hg.mozilla.org/integration/autoland/rev/089c1a0d9ec8 Vendor pystache automatically r=ahal
Comment 11•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/c196c1ecdff7
https://hg.mozilla.org/mozilla-central/rev/089c1a0d9ec8
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Updated•3 years ago
|
Updated•3 years ago
|
Comment 12•3 years ago
|
||
Pushed by mhentges@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7adf7e2136a3 Add test to verify virtualenv compatibility r=ahal
Comment 13•3 years ago
|
||
Backout by ccozmuta@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b59ab731aecf Backed out 10 changesets (bug 1712151, bug 1724279, bug 1730712, bug 1717051, bug 1723031, bug 1731145) for causing failures on test_yaml.py
Comment 14•3 years ago
|
||
Backed out 10 changesets (Bug 1712151, Bug 1724279, Bug 1730712, Bug 1717051, Bug 1723031, Bug 1731145) for causing failures on test_yaml.py
Log: https://treeherder.mozilla.org/logviewer?job_id=352859436&repo=autoland&lineNumber=925
Bustage: https://treeherder.mozilla.org/logviewer?job_id=352865415&repo=autoland&lineNumber=1148
Backout: https://hg.mozilla.org/integration/autoland/rev/b59ab731aecfcc3b9cb4e1388950b70039bf95ac
Assignee | ||
Updated•3 years ago
|
Comment 15•3 years ago
|
||
Pushed by mhentges@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1860400b41c4 Add test to verify virtualenv compatibility r=ahal
Comment 16•3 years ago
|
||
bugherder |
Assignee | ||
Comment 17•2 years ago
|
||
Note that, due to system-specific requirements, we probably need to run these tests in:
- All supported Pythons (Python 3.6 through 3.9)
- All primary platforms (Mac, Windows, Linux)
I'm going to defer the cross-platform-test part of this ticket.
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Description
•