Closed Bug 1655781 Opened 4 years ago Closed 4 years ago

Can I `import glean_parser` without having to change `sys.path`?

Categories

(Firefox Build System :: General, enhancement)

enhancement

Tracking

(firefox81 fixed)

RESOLVED FIXED
81 Branch
Tracking Status
firefox81 --- fixed

People

(Reporter: chutten, Assigned: rstewart)

Details

Attachments

(1 file)

After bug 1654663 we can no longer just import glean_parser at the top of a file during the build or test. I'd like to be able to do that again as we'll be using the vendored glean_parser to check geckoview's metrics.yaml for lint (toolkit/components/telemetry/build_scripts/run_glean_parser.yaml), run some FOG tests (toolkit/components/glean/pytest/), and to generate a variety of metrics APIs for Firefox Desktop (toolkit/components/glean/build_scripts).

Right now the current plan is to add the vendored glean_parser to sys.path just before importing it, either at file level or inline. I would appreciate any tips, tricks, or small tweaks to make this more ergonomic. glean_parser's role will only increase as Project FOG picks up steam.

Assignee: nobody → rstewart

Oh, and to be clear, import glean_parser never worked in tests. Probably due to python-test's use of pipenv or something

What's project FOG, ooc? Is there a website or doc or something I can peek at?

Flags: needinfo?(chutten)

This solves the same problem we attempted to solve in bug 1654663. That was a low-cost, sensible solution when there was only one in-build reference to glean_parser, but with project FOG we're about to drastically increase the in-build reliance on the library, so the ad-hoc sys.path manipulation is an increasingly insensible solution. Here we address this in a first-class way by specifying that glean_parser should be imported in virtualenvs, but NOT by mach when bootstrapping.

Project FOG is "Firefox on Glean"

Flags: needinfo?(chutten)

(seems like i should've been able to guess that one, huh)

Pushed by rstewart@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3cf9282868b9
Allow specifying that certain packages should only be included in a `virtualenv` when parsing `virtualenv_packages.txt` r=chutten,nalexander
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 81 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: