Port out-of-tree taskgraph to Python 3
Categories
(Release Engineering :: General, task)
Tracking
(Not tracked)
People
(Reporter: ahal, Assigned: ahal)
References
Details
Attachments
(21 files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
Bug 1700716 - Fix remaining tests in test_util_attributes.py under Python 3, r?#taskgraph-reviewers!
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
The in-tree taskgraph code has been running with Python 3 for awhile, but the out-of-tree one is still running with Python 2. It hasn't been synced in awhile and is missing much of the py3 work that went into the in-tree one.
This is also the last known consumer of the taskcluster package with Python 2 and is therefore blocking them from dropping py2 support:
https://github.com/taskcluster/taskcluster/issues/4614
We also plan on merging the two taskgraphs at some point, and this is also blocking that in a way as we first need to sync up the two code bases (syncs haven't been happening for awhile).
| Assignee | ||
Updated•4 years ago
|
| Assignee | ||
Updated•4 years ago
|
| Assignee | ||
Comment 1•4 years ago
|
||
We use 'basestring' in a few 'attrs' type hints. Since I'd like to maintain
backwards compatibility with Python 2 for now, I'd like to use the 'typing'
module's AnyStr feature.
| Assignee | ||
Comment 2•4 years ago
|
||
This removes all instances of 'basestring' and a few other necessary tweaks to get
all files importable under Python 3.
Depends on D115009
| Assignee | ||
Comment 3•4 years ago
|
||
| Assignee | ||
Comment 4•4 years ago
|
||
I originally wrote this in a phabricator comment, but it's worth copying to the bug:
My plan for the migration here is roughly:
- Make standalone taskgraph support both Python 2 and Python 3 at the same time (via six).
- Update all consumers to use latest version of taskgraph, but still use Python 2 (to make sure there are no issues)
- Migrate consumers to Python 3 one by one
- Drop Python 2 support (both in standalone and gecko taskgraph) by removing all references to six
Once step 4 is finished, the gecko and standalone taskgraphs will be in-sync again (at least as far as the Py2 -> Py3 compatibility layer goes).
The problem with using six.text_type like Gecko does, is that this will break compatibility with Python 2 (unless we can guarantee that all consumers are using u"foo" rather than "foo" everywhere). Which means if we need to make changes to taskgraph in the middle of the migration, we'll need to fork a new branch (one for Py2 consumers, and one for Py3 consumers). Having distinct Py2 / Py3 branches is certainly a valid approach to this problem, I just thought that trying to keep all consumers on the same code base would make things easier and smoother.
The downside to my approach is that getting to step 4 is a prerequisite to starting on the gecko <-> standalone sync up. But I think that's a reasonable thing to block on.
| Assignee | ||
Comment 6•4 years ago
|
||
| Assignee | ||
Comment 7•4 years ago
|
||
This uses 'set' rather than 'list' to stay more in-sync with gecko taskgraph
(which also uses set).
Depends on D115218
| Assignee | ||
Comment 8•4 years ago
|
||
This fixes a compatibility issue in 're.sub' after Python 3.7
Comment 10•4 years ago
|
||
| Assignee | ||
Comment 11•4 years ago
|
||
This also fixed a few of the 'test_optimize.py' tests as a side effect.
Comment 12•4 years ago
|
||
| Assignee | ||
Comment 13•4 years ago
|
||
These tests were failing for the same reasons.
| Assignee | ||
Comment 14•4 years ago
|
||
Depends on D115401
| Assignee | ||
Comment 15•4 years ago
|
||
Depends on D115409
| Assignee | ||
Comment 16•4 years ago
|
||
I was looking at Gecko to see how we solved the compat issues there and noticed
they functions were nearly the same, so decided to just copy it wholesale.
This adds the 'enforce_single_match' feature which likely isn't needed in
standalone taskgraph (yet), but I added it anyway in the interest of keeping
things synced.
Depends on D115410
Comment 17•4 years ago
|
||
Comment 18•4 years ago
|
||
(In reply to Andrew Halberstadt [:ahal] from comment #4)
- Drop Python 2 support (both in standalone and gecko taskgraph) by removing all references to six
https://github.com/asottile/pyupgrade should help with Step 4 and remove a bunch of busy-work.
| Assignee | ||
Comment 19•4 years ago
|
||
| Assignee | ||
Comment 20•4 years ago
|
||
Depends on D115505
| Assignee | ||
Comment 21•4 years ago
|
||
I noticed these were failing for me locally when using 3.8+ as the hashes are
different than the expectations. More than that, the hashes with 3.9 are also
different from the hashes in 3.8.
Interestingly the version of the test in Gecko passes with 3.6 -> 3.8, but
fails with different hashes under 3.9. There are quite a few differences in the
tar generation logic between Gecko -> standalone, but even syncing everything
wouldn't fix the issue entirely.
I guess the root problem is that I don't know whether the tests are just overly
brittle, or if there is an actual problem here. Either way, marking these xfail
for now.
Depends on D115506
| Assignee | ||
Comment 22•4 years ago
|
||
(In reply to Justin Wood (:Callek) from comment #18)
(In reply to Andrew Halberstadt [:ahal] from comment #4)
- Drop Python 2 support (both in standalone and gecko taskgraph) by removing all references to six
https://github.com/asottile/pyupgrade should help with Step 4 and remove a bunch of busy-work.
Thanks! I recall you pointing that library out in the gecko version of this bug, but forgot the name. IIRC it even handles removal of six code, so we can run it on both Gecko and standalone taskgraphs to get back into sync.
| Assignee | ||
Comment 23•4 years ago
|
||
This avoids errors when running locally with custom extensions / defaults in
the user ~/.hgrc file.
Depends on D115507
Comment 24•4 years ago
|
||
| Assignee | ||
Comment 25•4 years ago
|
||
| Assignee | ||
Comment 26•4 years ago
|
||
Depends on D115626
| Assignee | ||
Comment 27•4 years ago
|
||
Depends on D115633
Comment 28•4 years ago
|
||
| Assignee | ||
Updated•4 years ago
|
| Assignee | ||
Comment 29•4 years ago
|
||
This version of the image contains the 'python3-pip' package (as well as few
others I wasn't entirely sure were necessary).
| Assignee | ||
Comment 30•4 years ago
|
||
Depends on D115926
| Assignee | ||
Comment 31•4 years ago
|
||
While the decision task passes even without this, it's grabbing dependencies
directly from 'setup.py' (which uses the 'requirements.in' file rather than
'requirements.txt'). This will ensure the actual dependencies used in the lock
file are also used in CI.
Comment 32•4 years ago
|
||
| Assignee | ||
Comment 33•4 years ago
|
||
With the latest two patches, taskgraph's own CI is running with Python 3!
So I think I'm going to call this bug done for now, and I'll file follow-ups to track migrating taskgraph's various consumers to Python 3.
Comment 34•4 years ago
|
||
| Assignee | ||
Updated•4 years ago
|
Description
•